Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] added a test for identifier getter in a trait #337

Closed
wants to merge 4 commits into from

Conversation

dorongutman
Copy link

When the identifier getter method is in a trait, the proxy generation ignores it and treats it as a lazy loading field, causing the $proxyInstance->getId() to initialize the object.

This is a test that proves that.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DCOM-251

We use Jira to track the state of pull requests and the versions they got
included in.

* @since 2.4
*/
class LazyLoadableObject
{
use IdentifierTrait;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use a separate fixture class for the test involving trait, so that the existing test can still run on 5.3 and only the test related to traits need to be skipped

@Ocramius
Copy link
Member

Ocramius commented Sep 3, 2014

As discussed on IRC, these tests are not sustainable as they are written in this PR.

@dorongutman
Copy link
Author

@Ocramius what are the only methods you think should exist in the traits test ?

@Ocramius
Copy link
Member

Ocramius commented Sep 3, 2014

@dorongutman I'm just disagreeing with duplicating the entire test

'publicIdentifierField' => true,
'protectedIdentifierField' => true,
'publicPersistentField' => true,
'protectedPersistentField' => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert these

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof this is not yet ready for review

@Ocramius Ocramius changed the title added a test for identifier getter in a trait [WIP] added a test for identifier getter in a trait Sep 3, 2014
@stof
Copy link
Member

stof commented Sep 3, 2014

you should indeed not copy/paste the whole test. Rely on PHPUnit data providers where needed.

thus, your issue only concern 1 test (i.e. the one failing currently on Travis) so only this test should be added. All other duplicated tests are useless

@Ocramius
Copy link
Member

Closing. A solution to this (without going completely crazy) would be doctrine/orm#1241, but we're far from implementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants