lessThanOrEqual() public static method

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.
public static lessThanOrEqual ( mixed $value ) : PHPUnit_Framework_Constraint_Or
$value mixed
return PHPUnit_Framework_Constraint_Or
 /**
  * @covers PHPUnit_Framework_Constraint_IsEqual
  * @covers PHPUnit_Framework_Constraint_LessThan
  * @covers PHPUnit_Framework_Constraint_Or
  * @covers PHPUnit_Framework_Constraint_Not
  * @covers PHPUnit_Framework_Assert::lessThanOrEqual
  * @covers PHPUnit_Framework_Assert::logicalNot
  */
 public function testConstraintNotLessThanOrEqual2()
 {
     $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::lessThanOrEqual(1));
     try {
         $constraint->fail(1, 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:1> not( is equal to <integer:1> or is less than <integer:1> ).", $e->getDescription());
         return;
     }
     $this->fail();
 }
示例#2
0
/**
 * Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps
 * a PHPUnit_Framework_Constraint_IsEqual and a
 * PHPUnit_Framework_Constraint_LessThan matcher object.
 *
 * @param  mixed $value
 * @return PHPUnit_Framework_Constraint_Or
 * @since  Method available since Release 3.1.0
 */
function lessThanOrEqual($value)
{
    return PHPUnit_Framework_Assert::lessThanOrEqual($value);
}
    /**
     * @covers PHPUnit_Framework_Constraint_IsEqual
     * @covers PHPUnit_Framework_Constraint_LessThan
     * @covers PHPUnit_Framework_Constraint_Or
     * @covers PHPUnit_Framework_Constraint_Not
     * @covers PHPUnit_Framework_Assert::lessThanOrEqual
     * @covers PHPUnit_Framework_Assert::logicalNot
     * @covers PHPUnit_Framework_TestFailure::exceptionToString
     */
    public function testConstraintNotLessThanOrEqual2()
    {
        $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::lessThanOrEqual(1));
        try {
            $constraint->evaluate(1, 'custom message');
        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
            $this->assertEquals(<<<EOF
custom message
Failed asserting that not( 1 is equal to 1 or is less than 1 ).

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