public function Framework_ConstraintTest::testConstraintArrayNotContains in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php \Framework_ConstraintTest::testConstraintArrayNotContains()
@covers PHPUnit_Framework_Constraint_TraversableContains @covers PHPUnit_Framework_Constraint_Not @covers PHPUnit_Framework_Assert::logicalNot @covers PHPUnit_Framework_TestFailure::exceptionToString
File
- vendor/
phpunit/ phpunit/ tests/ Framework/ ConstraintTest.php, line 2952
Class
- Framework_ConstraintTest
- @since Class available since Release 3.0.0
Code
public function testConstraintArrayNotContains() {
$constraint = PHPUnit_Framework_Assert::logicalNot(new PHPUnit_Framework_Constraint_TraversableContains('foo'));
$this
->assertTrue($constraint
->evaluate(array(
'bar',
), '', true));
$this
->assertFalse($constraint
->evaluate(array(
'foo',
), '', true));
$this
->assertEquals("does not contain 'foo'", $constraint
->toString());
$this
->assertEquals(1, count($constraint));
try {
$constraint
->evaluate(array(
'foo',
));
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this
->assertEquals(<<<EOF
Failed asserting that an array does not contain 'foo'.
EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
return;
}
$this
->fail();
}