Assert\Assertion::notEq PHP Method

notEq() public static method

Assert that two values are not equal (using == ).
public static notEq ( mixed $value1, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean
$value1 mixed
$value2 mixed
$message string | null
$propertyPath string | null
return boolean
    public static function notEq($value1, $value2, $message = null, $propertyPath = null)
    {
        if ($value1 == $value2) {
            $message = sprintf($message ?: 'Value "%s" is equal to expected value "%s".', static::stringify($value1), static::stringify($value2));
            throw static::createException($value1, $message, static::INVALID_NOT_EQ, $propertyPath, array('expected' => $value2));
        }
        return true;
    }

Usage Example

 /**
  * @Then All users with a pending and outdated activation should be removed
  */
 public function allUsersWithAPendingAndOutdatedActivationShouldBeRemoved()
 {
     $em = $this->getEntityManager();
     for ($i = 0; $i < 2; ++$i) {
         Assertion::eq(null, $em->getRepository('Account:User')->findOneBy(['username' => (string) $i]));
     }
     Assertion::notEq(null, $em->getRepository('Account:User')->findOneBy(['username' => 'foo']));
 }
All Usage Examples Of Assert\Assertion::notEq