lessThan() 공개 정적인 메소드

Returns a PHPUnit_Framework_Constraint_LessThan matcher object.
public static lessThan ( mixed $value ) : PHPUnit_Framework_Constraint_LessThan
$value mixed
리턴 PHPUnit_Framework_Constraint_LessThan
예제 #1
0
/**
 * Returns a PHPUnit_Framework_Constraint_LessThan matcher object.
 *
 * @param  mixed $value
 * @return PHPUnit_Framework_Constraint_LessThan
 * @since  Method available since Release 3.0.0
 */
function lessThan($value)
{
    return PHPUnit_Framework_Assert::lessThan($value);
}
 /**
  * @covers PHPUnit_Framework_Constraint_LessThan
  * @covers PHPUnit_Framework_Constraint_Not
  * @covers PHPUnit_Framework_Assert::lessThan
  * @covers PHPUnit_Framework_Assert::logicalNot
  */
 public function testConstraintNotLessThan2()
 {
     $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::lessThan(1));
     try {
         $constraint->fail(1, 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:1> is not less than <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
 public function testStatusCanBeAnyConstraint()
 {
     $response = new Response(234);
     $constraint = new HasStatusConstraint(Assert::lessThan(300));
     $constraint->evaluate($response);
 }
    /**
     * @covers PHPUnit_Framework_Constraint_LessThan
     * @covers PHPUnit_Framework_Constraint_Not
     * @covers PHPUnit_Framework_Assert::lessThan
     * @covers PHPUnit_Framework_Assert::logicalNot
     * @covers PHPUnit_Framework_TestFailure::exceptionToString
     */
    public function testConstraintNotLessThan2()
    {
        $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::lessThan(1));
        try {
            $constraint->evaluate(0, 'custom message');
        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
            $this->assertEquals(<<<EOF
custom message
Failed asserting that 0 is not less than 1.

EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
            return;
        }
        $this->fail();
    }
 public static function isServerError()
 {
     return new HasStatusConstraint(Assert::logicalAnd(Assert::greaterThanOrEqual(500), Assert::lessThan(600)));
 }