lithium\test\Unit::assertNotContainsOnly()

public method

Assert that $haystack hasn't any items of given type.

$this->assertNotContainsOnly('integer', ['foo', 'bar', 'baz']); // succeeds
$this->assertNotContainsOnly('integer', [1,2,3]); // fails

Parameters

  • string $type
  • array|object $haystack

    Array or iterable object.

  • string|boolean $message

Returns

boolean

true if the assertion succeeded, false otherwise.

Source

	public function assertNotContainsOnly($type, $haystack, $message = '{:message}') {
		$method = static::$_internalTypes[$type];
		foreach ($haystack as $key => $value) {
			if (!$method($value)) {
				return $this->assert(true, $message, [
					'expected' => $type,
					'result' => $haystack
				]);
			}
		}
		return $this->assert(false, $message, [
			'expected' => $type,
			'result' => $haystack
		]);
	}