PHPUnit_Framework_Assert::assertNotContains PHP Method

assertNotContains() public static method

Asserts that a haystack does not contain a needle.
public static assertNotContains ( mixed $needle, mixed $haystack, string $message = '', boolean $ignoreCase = false, boolean $checkForObjectIdentity = true, boolean $checkForNonObjectIdentity = false )
$needle mixed
$haystack mixed
$message string
$ignoreCase boolean
$checkForObjectIdentity boolean
$checkForNonObjectIdentity boolean
    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');
        }
        static::assertThat($haystack, $constraint, $message);
    }

Usage Example

コード例 #1
0
 /**
  * Assert that deleted customers address is not displayed on backend during order creation.
  *
  * @param SalesOrderIndex $orderIndex
  * @param SalesOrderCreateIndex $orderCreateIndex
  * @param Address $deletedAddress
  * @param Customer $customer
  * @return void
  */
 public function processAssert(SalesOrderIndex $orderIndex, SalesOrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)
 {
     $orderIndex->open()->getPageActionsBlock()->addNew();
     $orderCreateIndex->getCustomerGrid()->selectCustomer($customer);
     $orderCreateIndex->getStoreBlock()->selectStoreView();
     \PHPUnit_Framework_Assert::assertNotContains($this->prepareAddress($deletedAddress), $orderCreateIndex->getCreateBlock()->getBillingAddressForm()->getExistingAddresses(), 'Deleted address is present on backend during order creation');
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertNotContains
PHPUnit_Framework_Assert