You are here

public function Framework_ConstraintTest::testConstraintStringStartsNotWith in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php \Framework_ConstraintTest::testConstraintStringStartsNotWith()

@covers PHPUnit_Framework_Constraint_StringStartsWith @covers PHPUnit_Framework_Constraint_Not @covers PHPUnit_Framework_Assert::stringStartsWith @covers PHPUnit_Framework_Assert::logicalNot @covers PHPUnit_Framework_TestFailure::exceptionToString

File

vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php, line 2554

Class

Framework_ConstraintTest
@since Class available since Release 3.0.0

Code

public function testConstraintStringStartsNotWith() {
  $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::stringStartsWith('prefix'));
  $this
    ->assertTrue($constraint
    ->evaluate('foo', '', true));
  $this
    ->assertFalse($constraint
    ->evaluate('prefixfoo', '', true));
  $this
    ->assertEquals('starts not with "prefix"', $constraint
    ->toString());
  $this
    ->assertEquals(1, count($constraint));
  try {
    $constraint
      ->evaluate('prefixfoo');
  } catch (PHPUnit_Framework_ExpectationFailedException $e) {
    $this
      ->assertEquals(<<<EOF
Failed asserting that 'prefixfoo' starts not with "prefix".

EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
    return;
  }
  $this
    ->fail();
}