8000 LazyLoadingMetadataFactory looks broken by angelk · Pull Request #21538 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

LazyLoadingMetadataFactory looks broken #21538

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added test for staticClassLoader in LazyLoadingMetadatafactory
  • Loading branch information
angelk committed Feb 5, 2017
commit f0c4b645e91b72570c55422cda65688cda6918e1
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public function testGroupsFromParent()
$factory = new LazyLoadingMetadataFactory($reader);
$metadata = $factory->getMetadataFor('Symfony\Component\Validator\Tests\Fixtures\EntityStaticCarTurbo');
$classMetaData = $metadata->getPropertyMetadata('wheels');
$groups = $classMetaData[0]->getConstraints()[0]->groups;
$constraints = $classMetaData[0]->getConstraints();
Copy link
Member

Choose a reason for hiding this comment

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

The culprit here is that you are making the assumption that getPropertyMetadata() of the ClassMetadata class will online return one PropertyMetadata instance (or that the one you need is the first entry in the returned collection). It's true that this was the case before #20793, but that IMO is can implementation detail you shouldn't rely on (the RecursiveContextualValidator, for example, iterates over the return property metadata). I'll see if we can nonetheless update the code to only return one instance, but as said that's not something I would rely on.

$groups = $constraints[0]->groups;

$this->assertContains('Default', $groups);
$this->assertContains('EntityStaticCarTurbo', $groups);
Expand Down
0