Вход Регистрация
Файл: gapps/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php
Строк: 788
<?php

/*
 Copyright (c) 2009-2010 hamcrest.org
 */

// This file is generated from the static method @factory doctags.

namespace Hamcrest;

/**
 * A series of static factories for all hamcrest matchers.
 */
class Matchers
{

    
/**
     * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
     */
    
public static function anArray(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestArraysIsArray''anArray'), $args);
    }

    
/**
     * 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
     */
    
public static function hasItemInArray($item)
    {
        return 
HamcrestArraysIsArrayContaining::hasItemInArray($item);
    }

    
/**
     * 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
     */
    
public static function hasValue($item)
    {
        return 
HamcrestArraysIsArrayContaining::hasItemInArray($item);
    }

    
/**
     * An array with elements that match the given matchers.
     */
    
public static function arrayContainingInAnyOrder(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestArraysIsArrayContainingInAnyOrder''arrayContainingInAnyOrder'), $args);
    }

    
/**
     * An array with elements that match the given matchers.
     */
    
public static function containsInAnyOrder(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestArraysIsArrayContainingInAnyOrder''arrayContainingInAnyOrder'), $args);
    }

    
/**
     * An array with elements that match the given matchers in the same order.
     */
    
public static function arrayContaining(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestArraysIsArrayContainingInOrder''arrayContaining'), $args);
    }

    
/**
     * An array with elements that match the given matchers in the same order.
     */
    
public static function contains(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestArraysIsArrayContainingInOrder''arrayContaining'), $args);
    }

    
/**
     * 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
     */
    
public static function hasKeyInArray($key)
    {
        return 
HamcrestArraysIsArrayContainingKey::hasKeyInArray($key);
    }

    
/**
     * 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
     */
    
public static function hasKey($key)
    {
        return 
HamcrestArraysIsArrayContainingKey::hasKeyInArray($key);
    }

    
/**
     * Test if an array has both an key and value in parity with each other.
     */
    
public static function hasKeyValuePair($key$value)
    {
        return 
HamcrestArraysIsArrayContainingKeyValuePair::hasKeyValuePair($key$value);
    }

    
/**
     * Test if an array has both an key and value in parity with each other.
     */
    
public static function hasEntry($key$value)
    {
        return 
HamcrestArraysIsArrayContainingKeyValuePair::hasKeyValuePair($key$value);
    }

    
/**
     * Does array size satisfy a given matcher?
     *
     * @param HamcrestMatcher|int $size as a {@link HamcrestMatcher} or a value.
     *
     * @return HamcrestArraysIsArrayWithSize
     */
    
public static function arrayWithSize($size)
    {
        return 
HamcrestArraysIsArrayWithSize::arrayWithSize($size);
    }

    
/**
     * Matches an empty array.
     */
    
public static function emptyArray()
    {
        return 
HamcrestArraysIsArrayWithSize::emptyArray();
    }

    
/**
     * Matches an empty array.
     */
    
public static function nonEmptyArray()
    {
        return 
HamcrestArraysIsArrayWithSize::nonEmptyArray();
    }

    
/**
     * Returns true if traversable is empty.
     */
    
public static function emptyTraversable()
    {
        return 
HamcrestCollectionIsEmptyTraversable::emptyTraversable();
    }

    
/**
     * Returns true if traversable is not empty.
     */
    
public static function nonEmptyTraversable()
    {
        return 
HamcrestCollectionIsEmptyTraversable::nonEmptyTraversable();
    }

    
/**
     * Does traversable size satisfy a given matcher?
     */
    
public static function traversableWithSize($size)
    {
        return 
HamcrestCollectionIsTraversableWithSize::traversableWithSize($size);
    }

    
/**
     * Evaluates to true only if ALL of the passed in matchers evaluate to true.
     */
    
public static function allOf(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreAllOf''allOf'), $args);
    }

    
/**
     * Evaluates to true if ANY of the passed in matchers evaluate to true.
     */
    
public static function anyOf(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreAnyOf''anyOf'), $args);
    }

    
/**
     * Evaluates to false if ANY of the passed in matchers evaluate to true.
     */
    
public static function noneOf(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreAnyOf''noneOf'), $args);
    }

    
/**
     * This is useful for fluently combining matchers that must both pass.
     * For example:
     * <pre>
     *   assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
     * </pre>
     */
    
public static function both(HamcrestMatcher $matcher)
    {
        return 
HamcrestCoreCombinableMatcher::both($matcher);
    }

    
/**
     * This is useful for fluently combining matchers where either may pass,
     * for example:
     * <pre>
     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
     * </pre>
     */
    
public static function either(HamcrestMatcher $matcher)
    {
        return 
HamcrestCoreCombinableMatcher::either($matcher);
    }

    
/**
     * Wraps an existing matcher and overrides the description when it fails.
     */
    
public static function describedAs(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreDescribedAs''describedAs'), $args);
    }

    
/**
     * @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
     */
    
public static function everyItem(HamcrestMatcher $itemMatcher)
    {
        return 
HamcrestCoreEvery::everyItem($itemMatcher);
    }

    
/**
     * Does array size satisfy a given matcher?
     */
    
public static function hasToString($matcher)
    {
        return 
HamcrestCoreHasToString::hasToString($matcher);
    }

    
/**
     * 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)))
     */
    
public static function is($value)
    {
        return 
HamcrestCoreIs::is($value);
    }

    
/**
     * This matcher always evaluates to true.
     *
     * @param string $description A meaningful string used when describing itself.
     *
     * @return HamcrestCoreIsAnything
     */
    
public static function anything($description 'ANYTHING')
    {
        return 
HamcrestCoreIsAnything::anything($description);
    }

    
/**
     * 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>
     */
    
public static function hasItem(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreIsCollectionContaining''hasItem'), $args);
    }

    
/**
     * 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>
     */
    
public static function hasItems(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestCoreIsCollectionContaining''hasItems'), $args);
    }

    
/**
     * Is the value equal to another value, as tested by the use of the "=="
     * comparison operator?
     */
    
public static function equalTo($item)
    {
        return 
HamcrestCoreIsEqual::equalTo($item);
    }

    
/**
     * Tests of the value is identical to $value as tested by the "===" operator.
     */
    
public static function identicalTo($value)
    {
        return 
HamcrestCoreIsIdentical::identicalTo($value);
    }

    
/**
     * 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>
     */
    
public static function anInstanceOf($theClass)
    {
        return 
HamcrestCoreIsInstanceOf::anInstanceOf($theClass);
    }

    
/**
     * 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>
     */
    
public static function any($theClass)
    {
        return 
HamcrestCoreIsInstanceOf::anInstanceOf($theClass);
    }

    
/**
     * Matches if value does not match $value.
     */
    
public static function not($value)
    {
        return 
HamcrestCoreIsNot::not($value);
    }

    
/**
     * Matches if value is null.
     */
    
public static function nullValue()
    {
        return 
HamcrestCoreIsNull::nullValue();
    }

    
/**
     * Matches if value is not null.
     */
    
public static function notNullValue()
    {
        return 
HamcrestCoreIsNull::notNullValue();
    }

    
/**
     * Creates a new instance of IsSame.
     *
     * @param mixed $object
     *   The predicate evaluates to true only when the argument is
     *   this object.
     *
     * @return HamcrestCoreIsSame
     */
    
public static function sameInstance($object)
    {
        return 
HamcrestCoreIsSame::sameInstance($object);
    }

    
/**
     * Is the value a particular built-in type?
     */
    
public static function typeOf($theType)
    {
        return 
HamcrestCoreIsTypeOf::typeOf($theType);
    }

    
/**
     * Matches if value (class, object, or array) has named $property.
     */
    
public static function set($property)
    {
        return 
HamcrestCoreSet::set($property);
    }

    
/**
     * Matches if value (class, object, or array) does not have named $property.
     */
    
public static function notSet($property)
    {
        return 
HamcrestCoreSet::notSet($property);
    }

    
/**
     * Matches if value is a number equal to $value within some range of
     * acceptable error $delta.
     */
    
public static function closeTo($value$delta)
    {
        return 
HamcrestNumberIsCloseTo::closeTo($value$delta);
    }

    
/**
     * The value is not > $value, nor < $value.
     */
    
public static function comparesEqualTo($value)
    {
        return 
HamcrestNumberOrderingComparison::comparesEqualTo($value);
    }

    
/**
     * The value is > $value.
     */
    
public static function greaterThan($value)
    {
        return 
HamcrestNumberOrderingComparison::greaterThan($value);
    }

    
/**
     * The value is >= $value.
     */
    
public static function greaterThanOrEqualTo($value)
    {
        return 
HamcrestNumberOrderingComparison::greaterThanOrEqualTo($value);
    }

    
/**
     * The value is >= $value.
     */
    
public static function atLeast($value)
    {
        return 
HamcrestNumberOrderingComparison::greaterThanOrEqualTo($value);
    }

    
/**
     * The value is < $value.
     */
    
public static function lessThan($value)
    {
        return 
HamcrestNumberOrderingComparison::lessThan($value);
    }

    
/**
     * The value is <= $value.
     */
    
public static function lessThanOrEqualTo($value)
    {
        return 
HamcrestNumberOrderingComparison::lessThanOrEqualTo($value);
    }

    
/**
     * The value is <= $value.
     */
    
public static function atMost($value)
    {
        return 
HamcrestNumberOrderingComparison::lessThanOrEqualTo($value);
    }

    
/**
     * Matches if value is a zero-length string.
     */
    
public static function isEmptyString()
    {
        return 
HamcrestTextIsEmptyString::isEmptyString();
    }

    
/**
     * Matches if value is a zero-length string.
     */
    
public static function emptyString()
    {
        return 
HamcrestTextIsEmptyString::isEmptyString();
    }

    
/**
     * Matches if value is null or a zero-length string.
     */
    
public static function isEmptyOrNullString()
    {
        return 
HamcrestTextIsEmptyString::isEmptyOrNullString();
    }

    
/**
     * Matches if value is null or a zero-length string.
     */
    
public static function nullOrEmptyString()
    {
        return 
HamcrestTextIsEmptyString::isEmptyOrNullString();
    }

    
/**
     * Matches if value is a non-zero-length string.
     */
    
public static function isNonEmptyString()
    {
        return 
HamcrestTextIsEmptyString::isNonEmptyString();
    }

    
/**
     * Matches if value is a non-zero-length string.
     */
    
public static function nonEmptyString()
    {
        return 
HamcrestTextIsEmptyString::isNonEmptyString();
    }

    
/**
     * Matches if value is a string equal to $string, regardless of the case.
     */
    
public static function equalToIgnoringCase($string)
    {
        return 
HamcrestTextIsEqualIgnoringCase::equalToIgnoringCase($string);
    }

    
/**
     * Matches if value is a string equal to $string, regardless of whitespace.
     */
    
public static function equalToIgnoringWhiteSpace($string)
    {
        return 
HamcrestTextIsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
    }

    
/**
     * Matches if value is a string that matches regular expression $pattern.
     */
    
public static function matchesPattern($pattern)
    {
        return 
HamcrestTextMatchesPattern::matchesPattern($pattern);
    }

    
/**
     * Matches if value is a string that contains $substring.
     */
    
public static function containsString($substring)
    {
        return 
HamcrestTextStringContains::containsString($substring);
    }

    
/**
     * Matches if value is a string that contains $substring regardless of the case.
     */
    
public static function containsStringIgnoringCase($substring)
    {
        return 
HamcrestTextStringContainsIgnoringCase::containsStringIgnoringCase($substring);
    }

    
/**
     * Matches if value contains $substrings in a constrained order.
     */
    
public static function stringContainsInOrder(/* args... */)
    {
        
$args func_get_args();
        return 
call_user_func_array(array('HamcrestTextStringContainsInOrder''stringContainsInOrder'), $args);
    }

    
/**
     * Matches if value is a string that ends with $substring.
     */
    
public static function endsWith($substring)
    {
        return 
HamcrestTextStringEndsWith::endsWith($substring);
    }

    
/**
     * Matches if value is a string that starts with $substring.
     */
    
public static function startsWith($substring)
    {
        return 
HamcrestTextStringStartsWith::startsWith($substring);
    }

    
/**
     * Is the value an array?
     */
    
public static function arrayValue()
    {
        return 
HamcrestTypeIsArray::arrayValue();
    }

    
/**
     * Is the value a boolean?
     */
    
public static function booleanValue()
    {
        return 
HamcrestTypeIsBoolean::booleanValue();
    }

    
/**
     * Is the value a boolean?
     */
    
public static function boolValue()
    {
        return 
HamcrestTypeIsBoolean::booleanValue();
    }

    
/**
     * Is the value callable?
     */
    
public static function callableValue()
    {
        return 
HamcrestTypeIsCallable::callableValue();
    }

    
/**
     * Is the value a float/double?
     */
    
public static function doubleValue()
    {
        return 
HamcrestTypeIsDouble::doubleValue();
    }

    
/**
     * Is the value a float/double?
     */
    
public static function floatValue()
    {
        return 
HamcrestTypeIsDouble::doubleValue();
    }

    
/**
     * Is the value an integer?
     */
    
public static function integerValue()
    {
        return 
HamcrestTypeIsInteger::integerValue();
    }

    
/**
     * Is the value an integer?
     */
    
public static function intValue()
    {
        return 
HamcrestTypeIsInteger::integerValue();
    }

    
/**
     * Is the value a numeric?
     */
    
public static function numericValue()
    {
        return 
HamcrestTypeIsNumeric::numericValue();
    }

    
/**
     * Is the value an object?
     */
    
public static function objectValue()
    {
        return 
HamcrestTypeIsObject::objectValue();
    }

    
/**
     * Is the value an object?
     */
    
public static function anObject()
    {
        return 
HamcrestTypeIsObject::objectValue();
    }

    
/**
     * Is the value a resource?
     */
    
public static function resourceValue()
    {
        return 
HamcrestTypeIsResource::resourceValue();
    }

    
/**
     * Is the value a scalar (boolean, integer, double, or string)?
     */
    
public static function scalarValue()
    {
        return 
HamcrestTypeIsScalar::scalarValue();
    }

    
/**
     * Is the value a string?
     */
    
public static function stringValue()
    {
        return 
HamcrestTypeIsString::stringValue();
    }

    
/**
     * 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.
     */
    
public static function hasXPath($xpath$matcher null)
    {
        return 
HamcrestXmlHasXPath::hasXPath($xpath$matcher);
    }
}
Онлайн: 3
Реклама