示例#1
0
 public function testFailureLessThan2()
 {
     $constraint = new PHPUnit_Framework_Constraint_LessThan(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> is less than <integer:1>.\n", PHPUnit_Framework_TestFailure::exceptionToString($e));
         return;
     }
     $this->fail();
 }
示例#2
0
 public function testConstraintLessThan2()
 {
     $constraint = new PHPUnit_Framework_Constraint_LessThan(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> is less than <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
示例#3
0
 public function testConstraintLessThan()
 {
     $constraint = new PHPUnit_Framework_Constraint_LessThan(1);
     $this->assertTrue($constraint->evaluate(0));
     $this->assertFalse($constraint->evaluate(2));
     $this->assertEquals('is less than <integer:1>', $constraint->toString());
     try {
         $constraint->fail(0, '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that <integer:0> is less than <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }