You are here

public static function PHPUnit_Framework_Assert::assertNotContains in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertNotContains()

Asserts that a haystack does not contain a needle.

@since Method available since Release 2.1.0

Parameters

mixed $needle:

mixed $haystack:

string $message:

bool $ignoreCase:

bool $checkForObjectIdentity:

bool $checkForNonObjectIdentity:

11 calls to PHPUnit_Framework_Assert::assertNotContains()
Framework_AssertTest::testAssertArrayNotContainsNonObject in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertNotContains
Framework_AssertTest::testAssertArrayNotContainsObject in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertNotContains
Framework_AssertTest::testAssertArrayNotContainsString in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertNotContains
Framework_AssertTest::testAssertNotContainsThrowsException in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertNotContains @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testAssertSplObjectStorageNotContainsObject in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertNotContains

... See full list

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 191

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) {
  if (is_array($haystack) || is_object($haystack) && $haystack instanceof Traversable) {
    $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_TraversableContains($needle, $checkForObjectIdentity, $checkForNonObjectIdentity));
  }
  elseif (is_string($haystack)) {
    if (!is_string($needle)) {
      throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
    }
    $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_StringContains($needle, $ignoreCase));
  }
  else {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array, traversable or string');
  }
  self::assertThat($haystack, $constraint, $message);
}