class CollectionTest in Plug 7
Same name in this branch
- 7 lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php \Symfony\Component\Validator\Tests\Constraints\CollectionTest
- 7 lib/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php \Doctrine\Tests\Common\Collections\CollectionTest
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Tests\Constraints\CollectionTest extends \Symfony\Component\Validator\Tests\Constraints\PHPUnit_Framework_TestCase
Expanded class hierarchy of CollectionTest
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ CollectionTest.php, line 23
Namespace
Symfony\Component\Validator\Tests\ConstraintsView source
class CollectionTest extends \PHPUnit_Framework_TestCase {
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testRejectInvalidFieldsOption() {
new Collection(array(
'fields' => 'foo',
));
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testRejectNonConstraints() {
new Collection(array(
'foo' => 'bar',
));
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testRejectValidConstraint() {
new Collection(array(
'foo' => new Valid(),
));
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testRejectValidConstraintWithinOptional() {
new Collection(array(
'foo' => new Optional(new Valid()),
));
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testRejectValidConstraintWithinRequired() {
new Collection(array(
'foo' => new Required(new Valid()),
));
}
public function testAcceptOptionalConstraintAsOneElementArray() {
$collection1 = new Collection(array(
'fields' => array(
'alternate_email' => array(
new Optional(new Email()),
),
),
));
$collection2 = new Collection(array(
'fields' => array(
'alternate_email' => new Optional(new Email()),
),
));
$this
->assertEquals($collection1, $collection2);
}
public function testAcceptRequiredConstraintAsOneElementArray() {
$collection1 = new Collection(array(
'fields' => array(
'alternate_email' => array(
new Required(new Email()),
),
),
));
$collection2 = new Collection(array(
'fields' => array(
'alternate_email' => new Required(new Email()),
),
));
$this
->assertEquals($collection1, $collection2);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CollectionTest:: |
public | function | ||
CollectionTest:: |
public | function | ||
CollectionTest:: |
public | function | @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException | |
CollectionTest:: |
public | function | @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException | |
CollectionTest:: |
public | function | @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException | |
CollectionTest:: |
public | function | @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException | |
CollectionTest:: |
public | function | @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException |