logicalNot() public static method

Returns a PHPUnit_Framework_Constraint_Not matcher object.
public static logicalNot ( PHPUnit_Framework_Constraint $constraint ) : PHPUnit_Framework_Constraint_Not
$constraint PHPUnit_Framework_Constraint
return PHPUnit_Framework_Constraint_Not
 public function __construct($name, $constraint = null)
 {
     parent::__construct();
     if ($constraint === null) {
         $constraint = Assert::logicalNot(Assert::isEmpty());
     } elseif (!$constraint instanceof Constraint) {
         $constraint = Assert::equalTo($constraint);
     }
     $this->name = strtolower($name);
     $this->constraint = $constraint;
 }
Esempio n. 2
0
/**
 * Returns a PHPUnit_Framework_Constraint_Not matcher object.
 *
 * @param  PHPUnit_Framework_Constraint $constraint
 * @return PHPUnit_Framework_Constraint_Not
 * @since  Method available since Release 3.0.0
 */
function logicalNot(PHPUnit_Framework_Constraint $constraint)
{
    return PHPUnit_Framework_Assert::logicalNot($constraint);
}
 /**
  * @covers PHPUnit_Framework_Assert::attributeEqualTo
  * @covers PHPUnit_Framework_Assert::logicalNot
  * @covers PHPUnit_Framework_Constraint_Attribute
  * @covers PHPUnit_Framework_Constraint_Not
  */
 public function testAttributeNotEqualTo2()
 {
     $object = new ClassWithNonPublicAttributes();
     $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::attributeEqualTo('foo', 1));
     try {
         $constraint->fail($object, 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that attribute \"foo\" is not equal to <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
    /**
     * @covers PHPUnit_Framework_Constraint_SameSize
     * @covers PHPUnit_Framework_Constraint_Not
     * @covers PHPUnit_Framework_Assert::logicalNot
     * @covers PHPUnit_Framework_TestFailure::exceptionToString
     */
    public function testConstraintNotSameSizeFailing()
    {
        $constraint = PHPUnit_Framework_Assert::logicalNot(new PHPUnit_Framework_Constraint_SameSize(array(1, 2)));
        try {
            $constraint->evaluate(array(3, 4));
        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
            $this->assertEquals(<<<EOF
Failed asserting that actual size 2 does not match expected size 2.

EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
            return;
        }
        $this->fail();
    }
Esempio n. 5
0
 public function toBeJson()
 {
     if ($this->negate) {
         a::assertThat($this->actual, a::logicalAnd(a::isType('string'), a::logicalNot(a::isJson())));
     } else {
         a::assertJson($this->actual);
     }
 }
Esempio n. 6
0
/**
 * Returns a PHPUnit_Framework_Constraint_Not matcher object.
 *
 * @param  PHPUnit_Framework_Constraint $constraint
 * @return PHPUnit_Framework_Constraint_Not
 * @since  Method available since Release 3.0.0
 */
function logicalNot($constraint)
{
    PHPUnit_Framework_Assert::logicalNot($constraint);
}
Esempio n. 7
0
 public function shouldNotContain($value)
 {
     Assert::assertThat($this->it, Assert::logicalNot(Assert::contains($value)));
 }