[Validator] Fixed typos, renamed hasGroupSequenceProvider
This commit is contained in:
parent
e0d28284fc
commit
9f2310b2f8
@ -68,8 +68,7 @@ class GraphWalker
|
|||||||
$initializer->initialize($object);
|
$initializer->initialize($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($group === Constraint::DEFAULT_GROUP && ($metadata->hasGroupSequence() || $metadata->hasGroupSequenceProvider())) {
|
if ($group === Constraint::DEFAULT_GROUP && ($metadata->hasGroupSequence() || $metadata->isGroupSequenceProvider())) {
|
||||||
|
|
||||||
if ($metadata->hasGroupSequence()) {
|
if ($metadata->hasGroupSequence()) {
|
||||||
$groups = $metadata->getGroupSequence();
|
$groups = $metadata->getGroupSequence();
|
||||||
} else {
|
} else {
|
||||||
|
@ -249,7 +249,7 @@ class ClassMetadata extends ElementMetadata
|
|||||||
*/
|
*/
|
||||||
public function setGroupSequence(array $groups)
|
public function setGroupSequence(array $groups)
|
||||||
{
|
{
|
||||||
if ($this->hasGroupSequenceProvider()) {
|
if ($this->isGroupSequenceProvider()) {
|
||||||
throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider');
|
throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,11 +319,11 @@ class ClassMetadata extends ElementMetadata
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the class has a group sequence provider.
|
* Returns whether the class is a group sequence provider.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasGroupSequenceProvider()
|
public function isGroupSequenceProvider()
|
||||||
{
|
{
|
||||||
return $this->groupSequenceProvider;
|
return $this->groupSequenceProvider;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ require_once __DIR__.'/EntityParent.php';
|
|||||||
require_once __DIR__.'/EntityInterface.php';
|
require_once __DIR__.'/EntityInterface.php';
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use Symfony\Component\Validator\GroupSequenceProviderInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Symfony\Tests\Component\Validator\Fixtures\ConstraintA
|
* @Symfony\Tests\Component\Validator\Fixtures\ConstraintA
|
||||||
@ -29,8 +28,6 @@ class Entity extends EntityParent implements EntityInterface
|
|||||||
protected $lastName;
|
protected $lastName;
|
||||||
public $reference;
|
public $reference;
|
||||||
|
|
||||||
protected $groups = array();
|
|
||||||
|
|
||||||
private $internal;
|
private $internal;
|
||||||
|
|
||||||
public function __construct($internal = null)
|
public function __construct($internal = null)
|
||||||
|
@ -193,42 +193,39 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP));
|
$this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupSequenceFailesIfGroupSequenceProviderIsSet()
|
/**
|
||||||
|
* @expectedException Symfony\Component\Validator\Exception\GroupDefinitionException
|
||||||
|
*/
|
||||||
|
public function testGroupSequenceFailsIfGroupSequenceProviderIsSet()
|
||||||
{
|
{
|
||||||
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
||||||
$metadata->setGroupSequenceProvider(true);
|
$metadata->setGroupSequenceProvider(true);
|
||||||
|
$metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo'));
|
||||||
try {
|
|
||||||
$metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo'));
|
|
||||||
$this->fail();
|
|
||||||
} catch(GroupDefinitionException $e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupSequenceProviderFailesIfGroupSequenceIsSet()
|
/**
|
||||||
|
* @expectedException Symfony\Component\Validator\Exception\GroupDefinitionException
|
||||||
|
*/
|
||||||
|
public function testGroupSequenceProviderFailsIfGroupSequenceIsSet()
|
||||||
{
|
{
|
||||||
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
||||||
$metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo'));
|
$metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo'));
|
||||||
|
$metadata->setGroupSequenceProvider(true);
|
||||||
try {
|
|
||||||
$metadata->setGroupSequenceProvider(true);
|
|
||||||
$this->fail();
|
|
||||||
} catch(GroupDefinitionException $e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupSequenceProviderFailesIfDomainClassIsInvalid()
|
/**
|
||||||
|
* @expectedException Symfony\Component\Validator\Exception\GroupDefinitionException
|
||||||
|
*/
|
||||||
|
public function testGroupSequenceProviderFailsIfDomainClassIsInvalid()
|
||||||
{
|
{
|
||||||
$metadata = new ClassMetadata('stdClass');
|
$metadata = new ClassMetadata('stdClass');
|
||||||
|
$metadata->setGroupSequenceProvider(true);
|
||||||
try {
|
|
||||||
$metadata->setGroupSequenceProvider(true);
|
|
||||||
$this->fail();
|
|
||||||
} catch(GroupDefinitionException $e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGroupSequenceProvider()
|
public function testGroupSequenceProvider()
|
||||||
{
|
{
|
||||||
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
||||||
$metadata->setGroupSequenceProvider(true);
|
$metadata->setGroupSequenceProvider(true);
|
||||||
$this->assertTrue($metadata->hasGroupSequenceProvider());
|
$this->assertTrue($metadata->isGroupSequenceProvider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user