PHPUnit_Framework_Constraint_FileExists::fail PHP Метод

fail() публичный Метод

public fail ( mixed $other, string $description, boolean $not = FALSE )
$other mixed The value passed to evaluate() which failed the constraint check.
$description string A string with extra description of what was going on while the evaluation failed.
$not boolean Flag to indicate negation.
    public function fail($other, $description, $not = FALSE)
    {
        $failureDescription = sprintf('Failed asserting that file "%s" exists.', $other);
        if ($not) {
            $failureDescription = self::negate($failureDescription);
        }
        if (!empty($description)) {
            $failureDescription = $description . "\n" . $failureDescription;
        }
        throw new PHPUnit_Framework_ExpectationFailedException($failureDescription);
    }

Usage Example

Пример #1
0
 public function testFailureFileExists2()
 {
     $constraint = new PHPUnit_Framework_Constraint_FileExists();
     try {
         $constraint->fail('foo', 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that file \"foo\" exists.\n", PHPUnit_Framework_TestFailure::exceptionToString($e));
         return;
     }
     $this->fail();
 }
All Usage Examples Of PHPUnit_Framework_Constraint_FileExists::fail
PHPUnit_Framework_Constraint_FileExists