Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
78
vendor/symfony/validator/Tests/Mapping/LegacyElementMetadataTest.php
vendored
Normal file
78
vendor/symfony/validator/Tests/Mapping/LegacyElementMetadataTest.php
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Validator\Tests\Mapping;
|
||||
|
||||
use Symfony\Component\Validator\Mapping\ElementMetadata;
|
||||
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
|
||||
use Symfony\Component\Validator\Tests\Fixtures\ConstraintB;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class LegacyElementMetadataTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $metadata;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->metadata = new TestElementMetadata();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->metadata = null;
|
||||
}
|
||||
|
||||
public function testAddConstraints()
|
||||
{
|
||||
$this->metadata->addConstraint($constraint1 = new ConstraintA());
|
||||
$this->metadata->addConstraint($constraint2 = new ConstraintA());
|
||||
|
||||
$this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints());
|
||||
}
|
||||
|
||||
public function testMultipleConstraintsOfTheSameType()
|
||||
{
|
||||
$constraint1 = new ConstraintA(array('property1' => 'A'));
|
||||
$constraint2 = new ConstraintA(array('property1' => 'B'));
|
||||
|
||||
$this->metadata->addConstraint($constraint1);
|
||||
$this->metadata->addConstraint($constraint2);
|
||||
|
||||
$this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints());
|
||||
}
|
||||
|
||||
public function testFindConstraintsByGroup()
|
||||
{
|
||||
$constraint1 = new ConstraintA(array('groups' => 'TestGroup'));
|
||||
$constraint2 = new ConstraintB();
|
||||
|
||||
$this->metadata->addConstraint($constraint1);
|
||||
$this->metadata->addConstraint($constraint2);
|
||||
|
||||
$this->assertEquals(array($constraint1), $this->metadata->findConstraints('TestGroup'));
|
||||
}
|
||||
|
||||
public function testSerialize()
|
||||
{
|
||||
$this->metadata->addConstraint(new ConstraintA(array('property1' => 'A')));
|
||||
$this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup')));
|
||||
|
||||
$metadata = unserialize(serialize($this->metadata));
|
||||
|
||||
$this->assertEquals($this->metadata, $metadata);
|
||||
}
|
||||
}
|
||||
|
||||
class TestElementMetadata extends ElementMetadata
|
||||
{
|
||||
}
|
Reference in a new issue