Файл: gapps/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php
Строк: 1038
<?php
/*
Copyright (c) 2009-2010 hamcrest.org
*/
// This file is generated from the static method @factory doctags.
if (!function_exists('assertThat')) {
/**
* Make an assertion and throw {@link Hamcrest_AssertionError} if it fails.
*
* Example:
* <pre>
* //With an identifier
* assertThat("assertion identifier", $apple->flavour(), equalTo("tasty"));
* //Without an identifier
* assertThat($apple->flavour(), equalTo("tasty"));
* //Evaluating a boolean expression
* assertThat("some error", $a > $b);
* </pre>
*/
function assertThat()
{
$args = func_get_args();
call_user_func_array(
array('HamcrestMatcherAssert', 'assertThat'),
$args
);
}
}
if (!function_exists('anArray')) { /**
* Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
*/
function anArray(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestArraysIsArray', 'anArray'), $args);
}
}
if (!function_exists('hasItemInArray')) { /**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link HamcrestMatcher} or a value.
*
* @return HamcrestArraysIsArrayContaining
*/
function hasItemInArray($item)
{
return HamcrestArraysIsArrayContaining::hasItemInArray($item);
}
}
if (!function_exists('hasValue')) { /**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link HamcrestMatcher} or a value.
*
* @return HamcrestArraysIsArrayContaining
*/
function hasValue($item)
{
return HamcrestArraysIsArrayContaining::hasItemInArray($item);
}
}
if (!function_exists('arrayContainingInAnyOrder')) { /**
* An array with elements that match the given matchers.
*/
function arrayContainingInAnyOrder(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestArraysIsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
}
if (!function_exists('containsInAnyOrder')) { /**
* An array with elements that match the given matchers.
*/
function containsInAnyOrder(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestArraysIsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
}
if (!function_exists('arrayContaining')) { /**
* An array with elements that match the given matchers in the same order.
*/
function arrayContaining(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestArraysIsArrayContainingInOrder', 'arrayContaining'), $args);
}
}
if (!function_exists('contains')) { /**
* An array with elements that match the given matchers in the same order.
*/
function contains(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestArraysIsArrayContainingInOrder', 'arrayContaining'), $args);
}
}
if (!function_exists('hasKeyInArray')) { /**
* Evaluates to true if any key in an array matches the given matcher.
*
* @param mixed $key as a {@link HamcrestMatcher} or a value.
*
* @return HamcrestArraysIsArrayContainingKey
*/
function hasKeyInArray($key)
{
return HamcrestArraysIsArrayContainingKey::hasKeyInArray($key);
}
}
if (!function_exists('hasKey')) { /**
* Evaluates to true if any key in an array matches the given matcher.
*
* @param mixed $key as a {@link HamcrestMatcher} or a value.
*
* @return HamcrestArraysIsArrayContainingKey
*/
function hasKey($key)
{
return HamcrestArraysIsArrayContainingKey::hasKeyInArray($key);
}
}
if (!function_exists('hasKeyValuePair')) { /**
* Test if an array has both an key and value in parity with each other.
*/
function hasKeyValuePair($key, $value)
{
return HamcrestArraysIsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
}
if (!function_exists('hasEntry')) { /**
* Test if an array has both an key and value in parity with each other.
*/
function hasEntry($key, $value)
{
return HamcrestArraysIsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
}
if (!function_exists('arrayWithSize')) { /**
* Does array size satisfy a given matcher?
*
* @param HamcrestMatcher|int $size as a {@link HamcrestMatcher} or a value.
*
* @return HamcrestArraysIsArrayWithSize
*/
function arrayWithSize($size)
{
return HamcrestArraysIsArrayWithSize::arrayWithSize($size);
}
}
if (!function_exists('emptyArray')) { /**
* Matches an empty array.
*/
function emptyArray()
{
return HamcrestArraysIsArrayWithSize::emptyArray();
}
}
if (!function_exists('nonEmptyArray')) { /**
* Matches an empty array.
*/
function nonEmptyArray()
{
return HamcrestArraysIsArrayWithSize::nonEmptyArray();
}
}
if (!function_exists('emptyTraversable')) { /**
* Returns true if traversable is empty.
*/
function emptyTraversable()
{
return HamcrestCollectionIsEmptyTraversable::emptyTraversable();
}
}
if (!function_exists('nonEmptyTraversable')) { /**
* Returns true if traversable is not empty.
*/
function nonEmptyTraversable()
{
return HamcrestCollectionIsEmptyTraversable::nonEmptyTraversable();
}
}
if (!function_exists('traversableWithSize')) { /**
* Does traversable size satisfy a given matcher?
*/
function traversableWithSize($size)
{
return HamcrestCollectionIsTraversableWithSize::traversableWithSize($size);
}
}
if (!function_exists('allOf')) { /**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*/
function allOf(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreAllOf', 'allOf'), $args);
}
}
if (!function_exists('anyOf')) { /**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*/
function anyOf(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreAnyOf', 'anyOf'), $args);
}
}
if (!function_exists('noneOf')) { /**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*/
function noneOf(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreAnyOf', 'noneOf'), $args);
}
}
if (!function_exists('both')) { /**
* This is useful for fluently combining matchers that must both pass.
* For example:
* <pre>
* assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
* </pre>
*/
function both(HamcrestMatcher $matcher)
{
return HamcrestCoreCombinableMatcher::both($matcher);
}
}
if (!function_exists('either')) { /**
* This is useful for fluently combining matchers where either may pass,
* for example:
* <pre>
* assertThat($string, either(containsString("a"))->orElse(containsString("b")));
* </pre>
*/
function either(HamcrestMatcher $matcher)
{
return HamcrestCoreCombinableMatcher::either($matcher);
}
}
if (!function_exists('describedAs')) { /**
* Wraps an existing matcher and overrides the description when it fails.
*/
function describedAs(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreDescribedAs', 'describedAs'), $args);
}
}
if (!function_exists('everyItem')) { /**
* @param Matcher $itemMatcher
* A matcher to apply to every element in an array.
*
* @return HamcrestCoreEvery
* Evaluates to TRUE for a collection in which every item matches $itemMatcher
*/
function everyItem(HamcrestMatcher $itemMatcher)
{
return HamcrestCoreEvery::everyItem($itemMatcher);
}
}
if (!function_exists('hasToString')) { /**
* Does array size satisfy a given matcher?
*/
function hasToString($matcher)
{
return HamcrestCoreHasToString::hasToString($matcher);
}
}
if (!function_exists('is')) { /**
* Decorates another Matcher, retaining the behavior but allowing tests
* to be slightly more expressive.
*
* For example: assertThat($cheese, equalTo($smelly))
* vs. assertThat($cheese, is(equalTo($smelly)))
*/
function is($value)
{
return HamcrestCoreIs::is($value);
}
}
if (!function_exists('anything')) { /**
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
*
* @return HamcrestCoreIsAnything
*/
function anything($description = 'ANYTHING')
{
return HamcrestCoreIsAnything::anything($description);
}
}
if (!function_exists('hasItem')) { /**
* Test if the value is an array containing this matcher.
*
* Example:
* <pre>
* assertThat(array('a', 'b'), hasItem(equalTo('b')));
* //Convenience defaults to equalTo()
* assertThat(array('a', 'b'), hasItem('b'));
* </pre>
*/
function hasItem(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreIsCollectionContaining', 'hasItem'), $args);
}
}
if (!function_exists('hasItems')) { /**
* Test if the value is an array containing elements that match all of these
* matchers.
*
* Example:
* <pre>
* assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
* </pre>
*/
function hasItems(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestCoreIsCollectionContaining', 'hasItems'), $args);
}
}
if (!function_exists('equalTo')) { /**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
*/
function equalTo($item)
{
return HamcrestCoreIsEqual::equalTo($item);
}
}
if (!function_exists('identicalTo')) { /**
* Tests of the value is identical to $value as tested by the "===" operator.
*/
function identicalTo($value)
{
return HamcrestCoreIsIdentical::identicalTo($value);
}
}
if (!function_exists('anInstanceOf')) { /**
* Is the value an instance of a particular type?
* This version assumes no relationship between the required type and
* the signature of the method that sets it up, for example in
* <code>assertThat($anObject, anInstanceOf('Thing'));</code>
*/
function anInstanceOf($theClass)
{
return HamcrestCoreIsInstanceOf::anInstanceOf($theClass);
}
}
if (!function_exists('any')) { /**
* Is the value an instance of a particular type?
* This version assumes no relationship between the required type and
* the signature of the method that sets it up, for example in
* <code>assertThat($anObject, anInstanceOf('Thing'));</code>
*/
function any($theClass)
{
return HamcrestCoreIsInstanceOf::anInstanceOf($theClass);
}
}
if (!function_exists('not')) { /**
* Matches if value does not match $value.
*/
function not($value)
{
return HamcrestCoreIsNot::not($value);
}
}
if (!function_exists('nullValue')) { /**
* Matches if value is null.
*/
function nullValue()
{
return HamcrestCoreIsNull::nullValue();
}
}
if (!function_exists('notNullValue')) { /**
* Matches if value is not null.
*/
function notNullValue()
{
return HamcrestCoreIsNull::notNullValue();
}
}
if (!function_exists('sameInstance')) { /**
* Creates a new instance of IsSame.
*
* @param mixed $object
* The predicate evaluates to true only when the argument is
* this object.
*
* @return HamcrestCoreIsSame
*/
function sameInstance($object)
{
return HamcrestCoreIsSame::sameInstance($object);
}
}
if (!function_exists('typeOf')) { /**
* Is the value a particular built-in type?
*/
function typeOf($theType)
{
return HamcrestCoreIsTypeOf::typeOf($theType);
}
}
if (!function_exists('set')) { /**
* Matches if value (class, object, or array) has named $property.
*/
function set($property)
{
return HamcrestCoreSet::set($property);
}
}
if (!function_exists('notSet')) { /**
* Matches if value (class, object, or array) does not have named $property.
*/
function notSet($property)
{
return HamcrestCoreSet::notSet($property);
}
}
if (!function_exists('closeTo')) { /**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
*/
function closeTo($value, $delta)
{
return HamcrestNumberIsCloseTo::closeTo($value, $delta);
}
}
if (!function_exists('comparesEqualTo')) { /**
* The value is not > $value, nor < $value.
*/
function comparesEqualTo($value)
{
return HamcrestNumberOrderingComparison::comparesEqualTo($value);
}
}
if (!function_exists('greaterThan')) { /**
* The value is > $value.
*/
function greaterThan($value)
{
return HamcrestNumberOrderingComparison::greaterThan($value);
}
}
if (!function_exists('greaterThanOrEqualTo')) { /**
* The value is >= $value.
*/
function greaterThanOrEqualTo($value)
{
return HamcrestNumberOrderingComparison::greaterThanOrEqualTo($value);
}
}
if (!function_exists('atLeast')) { /**
* The value is >= $value.
*/
function atLeast($value)
{
return HamcrestNumberOrderingComparison::greaterThanOrEqualTo($value);
}
}
if (!function_exists('lessThan')) { /**
* The value is < $value.
*/
function lessThan($value)
{
return HamcrestNumberOrderingComparison::lessThan($value);
}
}
if (!function_exists('lessThanOrEqualTo')) { /**
* The value is <= $value.
*/
function lessThanOrEqualTo($value)
{
return HamcrestNumberOrderingComparison::lessThanOrEqualTo($value);
}
}
if (!function_exists('atMost')) { /**
* The value is <= $value.
*/
function atMost($value)
{
return HamcrestNumberOrderingComparison::lessThanOrEqualTo($value);
}
}
if (!function_exists('isEmptyString')) { /**
* Matches if value is a zero-length string.
*/
function isEmptyString()
{
return HamcrestTextIsEmptyString::isEmptyString();
}
}
if (!function_exists('emptyString')) { /**
* Matches if value is a zero-length string.
*/
function emptyString()
{
return HamcrestTextIsEmptyString::isEmptyString();
}
}
if (!function_exists('isEmptyOrNullString')) { /**
* Matches if value is null or a zero-length string.
*/
function isEmptyOrNullString()
{
return HamcrestTextIsEmptyString::isEmptyOrNullString();
}
}
if (!function_exists('nullOrEmptyString')) { /**
* Matches if value is null or a zero-length string.
*/
function nullOrEmptyString()
{
return HamcrestTextIsEmptyString::isEmptyOrNullString();
}
}
if (!function_exists('isNonEmptyString')) { /**
* Matches if value is a non-zero-length string.
*/
function isNonEmptyString()
{
return HamcrestTextIsEmptyString::isNonEmptyString();
}
}
if (!function_exists('nonEmptyString')) { /**
* Matches if value is a non-zero-length string.
*/
function nonEmptyString()
{
return HamcrestTextIsEmptyString::isNonEmptyString();
}
}
if (!function_exists('equalToIgnoringCase')) { /**
* Matches if value is a string equal to $string, regardless of the case.
*/
function equalToIgnoringCase($string)
{
return HamcrestTextIsEqualIgnoringCase::equalToIgnoringCase($string);
}
}
if (!function_exists('equalToIgnoringWhiteSpace')) { /**
* Matches if value is a string equal to $string, regardless of whitespace.
*/
function equalToIgnoringWhiteSpace($string)
{
return HamcrestTextIsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
}
}
if (!function_exists('matchesPattern')) { /**
* Matches if value is a string that matches regular expression $pattern.
*/
function matchesPattern($pattern)
{
return HamcrestTextMatchesPattern::matchesPattern($pattern);
}
}
if (!function_exists('containsString')) { /**
* Matches if value is a string that contains $substring.
*/
function containsString($substring)
{
return HamcrestTextStringContains::containsString($substring);
}
}
if (!function_exists('containsStringIgnoringCase')) { /**
* Matches if value is a string that contains $substring regardless of the case.
*/
function containsStringIgnoringCase($substring)
{
return HamcrestTextStringContainsIgnoringCase::containsStringIgnoringCase($substring);
}
}
if (!function_exists('stringContainsInOrder')) { /**
* Matches if value contains $substrings in a constrained order.
*/
function stringContainsInOrder(/* args... */)
{
$args = func_get_args();
return call_user_func_array(array('HamcrestTextStringContainsInOrder', 'stringContainsInOrder'), $args);
}
}
if (!function_exists('endsWith')) { /**
* Matches if value is a string that ends with $substring.
*/
function endsWith($substring)
{
return HamcrestTextStringEndsWith::endsWith($substring);
}
}
if (!function_exists('startsWith')) { /**
* Matches if value is a string that starts with $substring.
*/
function startsWith($substring)
{
return HamcrestTextStringStartsWith::startsWith($substring);
}
}
if (!function_exists('arrayValue')) { /**
* Is the value an array?
*/
function arrayValue()
{
return HamcrestTypeIsArray::arrayValue();
}
}
if (!function_exists('booleanValue')) { /**
* Is the value a boolean?
*/
function booleanValue()
{
return HamcrestTypeIsBoolean::booleanValue();
}
}
if (!function_exists('boolValue')) { /**
* Is the value a boolean?
*/
function boolValue()
{
return HamcrestTypeIsBoolean::booleanValue();
}
}
if (!function_exists('callableValue')) { /**
* Is the value callable?
*/
function callableValue()
{
return HamcrestTypeIsCallable::callableValue();
}
}
if (!function_exists('doubleValue')) { /**
* Is the value a float/double?
*/
function doubleValue()
{
return HamcrestTypeIsDouble::doubleValue();
}
}
if (!function_exists('floatValue')) { /**
* Is the value a float/double?
*/
function floatValue()
{
return HamcrestTypeIsDouble::doubleValue();
}
}
if (!function_exists('integerValue')) { /**
* Is the value an integer?
*/
function integerValue()
{
return HamcrestTypeIsInteger::integerValue();
}
}
if (!function_exists('intValue')) { /**
* Is the value an integer?
*/
function intValue()
{
return HamcrestTypeIsInteger::integerValue();
}
}
if (!function_exists('numericValue')) { /**
* Is the value a numeric?
*/
function numericValue()
{
return HamcrestTypeIsNumeric::numericValue();
}
}
if (!function_exists('objectValue')) { /**
* Is the value an object?
*/
function objectValue()
{
return HamcrestTypeIsObject::objectValue();
}
}
if (!function_exists('anObject')) { /**
* Is the value an object?
*/
function anObject()
{
return HamcrestTypeIsObject::objectValue();
}
}
if (!function_exists('resourceValue')) { /**
* Is the value a resource?
*/
function resourceValue()
{
return HamcrestTypeIsResource::resourceValue();
}
}
if (!function_exists('scalarValue')) { /**
* Is the value a scalar (boolean, integer, double, or string)?
*/
function scalarValue()
{
return HamcrestTypeIsScalar::scalarValue();
}
}
if (!function_exists('stringValue')) { /**
* Is the value a string?
*/
function stringValue()
{
return HamcrestTypeIsString::stringValue();
}
}
if (!function_exists('hasXPath')) { /**
* Wraps <code>$matcher</code> with {@link HamcrestCoreIsEqual)
* if it's not a matcher and the XPath in <code>count()</code>
* if it's an integer.
*/
function hasXPath($xpath, $matcher = null)
{
return HamcrestXmlHasXPath::hasXPath($xpath, $matcher);
}
}