Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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
Show file tree
Hide file tree
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
Next Next commit
added test for staticClassLoader in LazyLoadingMetadatafactory
  • Loading branch information
angelk committed Feb 5, 2017
commit af76d074a0a0db5509f2bb4ae55f739d72302cb7
20 changes: 20 additions & 0 deletions 20 src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Symfony\Component\Validator\Tests\Fixtures;

use Symfony\Component\Validator\Mapping\ClassMetadata;

use Symfony\Component\Validator\Constraints\Length;

/**
* Description of EntityStatic
*
* @author po_taka <angel.koilov@gmail.com>
*/
class EntityStaticCar extends EntityStaticVehicle
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array ('max' => 99,)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Symfony\Component\Validator\Tests\Fixtures;

use Symfony\Component\Validator\Mapping\ClassMetadata;

use Symfony\Component\Validator\Constraints\Length;

/**
* Description of EntityStaticParent
*
* @author po_taka <angel.koilov@gmail.com>
*/
class EntityStaticCarTurbo extends EntityStaticCar
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array ('max' => 99,)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Symfony\Component\Validator\Tests\Fixtures;

use Symfony\Component\Validator\Mapping\ClassMetadata;

use Symfony\Component\Validator\Constraints\Length;

/**
* Description of EntityStaticVehicle
*
* @author po_taka <angel.koilov@gmail.com>
*/
class EntityStaticVehicle
{
public $wheels;

public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('wheels', new Length(array ('max' => 99,)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ public function testMetadataCacheWithRuntimeConstraint()

$metadata = $factory->getMetadataFor(self::CLASS_NAME);
}

public function testGroupsFromParent()
{
$reader = new \Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader();
$factory = new LazyLoadingMetadataFactory($reader);
$metadata = $factory->getMetadataFor('Symfony\Component\Validator\Tests\Fixtures\EntityStaticCarTurbo');
$classMetaData = $metadata->getPropertyMetadata('wheels');
$groups = $classMetaData[0]->getConstraints()[0]->groups;

$this->assertContains('Default', $groups);
$this->assertContains('EntityStaticCarTurbo', $groups);
$this->assertContains('EntityStaticCar', $groups);
$this->assertContains('EntityStaticVehicle', $groups);
}

}

class TestLoader implements LoaderInterface
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.