[Validator] Fixed typos, renamed hasGroupSequenceProvider
This commit is contained in:
parent
e0d28284fc
commit
9f2310b2f8
@ -68,8 +68,7 @@ class GraphWalker
|
||||
$initializer->initialize($object);
|
||||
}
|
||||
|
||||
if ($group === Constraint::DEFAULT_GROUP && ($metadata->hasGroupSequence() || $metadata->hasGroupSequenceProvider())) {
|
||||
|
||||
if ($group === Constraint::DEFAULT_GROUP && ($metadata->hasGroupSequence() || $metadata->isGroupSequenceProvider())) {
|
||||
if ($metadata->hasGroupSequence()) {
|
||||
$groups = $metadata->getGroupSequence();
|
||||
} else {
|
||||
|
@ -249,7 +249,7 @@ class ClassMetadata extends ElementMetadata
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
@ -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
|
||||
*/
|
||||
public function hasGroupSequenceProvider()
|
||||
public function isGroupSequenceProvider()
|
||||
{
|
||||
return $this->groupSequenceProvider;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ require_once __DIR__.'/EntityParent.php';
|
||||
require_once __DIR__.'/EntityInterface.php';
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\GroupSequenceProviderInterface;
|
||||
|
||||
/**
|
||||
* @Symfony\Tests\Component\Validator\Fixtures\ConstraintA
|
||||
@ -29,8 +28,6 @@ class Entity extends EntityParent implements EntityInterface
|
||||
protected $lastName;
|
||||
public $reference;
|
||||
|
||||
protected $groups = array();
|
||||
|
||||
private $internal;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public function testGroupSequenceFailesIfGroupSequenceProviderIsSet()
|
||||
/**
|
||||
* @expectedException Symfony\Component\Validator\Exception\GroupDefinitionException
|
||||
*/
|
||||
public function testGroupSequenceFailsIfGroupSequenceProviderIsSet()
|
||||
{
|
||||
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
||||
$metadata->setGroupSequenceProvider(true);
|
||||
|
||||
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->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo'));
|
||||
|
||||
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');
|
||||
|
||||
try {
|
||||
$metadata->setGroupSequenceProvider(true);
|
||||
$this->fail();
|
||||
} catch(GroupDefinitionException $e) {}
|
||||
}
|
||||
|
||||
public function testGroupSequenceProvider()
|
||||
{
|
||||
$metadata = new ClassMetadata(self::PROVIDERCLASS);
|
||||
$metadata->setGroupSequenceProvider(true);
|
||||
$this->assertTrue($metadata->hasGroupSequenceProvider());
|
||||
$this->assertTrue($metadata->isGroupSequenceProvider());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user