Author: Jan Borsodi (jb@ez.no)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de)
Inheritance: extends PHPUnit_Framework_Constraint
Esempio n. 1
0
 public function testFailureGreaterThan2()
 {
     $constraint = new PHPUnit_Framework_Constraint_GreaterThan(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> is greater than <integer:1>.\n", PHPUnit_Framework_TestFailure::exceptionToString($e));
         return;
     }
     $this->fail();
 }
Esempio n. 2
0
 public function testConstraintGreaterThan2()
 {
     $constraint = new PHPUnit_Framework_Constraint_GreaterThan(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> is greater than <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
Esempio n. 3
0
 public function testConstraintGreaterThan()
 {
     $constraint = new PHPUnit_Framework_Constraint_GreaterThan(1);
     $this->assertFalse($constraint->evaluate(0));
     $this->assertTrue($constraint->evaluate(2));
     $this->assertEquals('is greater than <integer:1>', $constraint->toString());
     try {
         $constraint->fail(0, '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that <integer:0> is greater than <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }