Showing preview only (321K chars total). Download the full file or copy to clipboard to get everything.
Repository: hamcrest/hamcrest-php
Branch: master
Commit: b61cd040da1a
Files: 156
Total size: 285.8 KB
Directory structure:
gitextract_xa2uv0c7/
├── .coveralls.yml
├── .gitattributes
├── .github/
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .gush.yml
├── CHANGES.txt
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── composer.json
├── generator/
│ ├── FactoryCall.php
│ ├── FactoryClass.php
│ ├── FactoryFile.php
│ ├── FactoryGenerator.php
│ ├── FactoryMethod.php
│ ├── FactoryParameter.php
│ ├── GlobalFunctionFile.php
│ ├── StaticMethodFile.php
│ ├── parts/
│ │ ├── file_header.txt
│ │ ├── functions_footer.txt
│ │ ├── functions_header.txt
│ │ ├── functions_imports.txt
│ │ ├── matchers_footer.txt
│ │ ├── matchers_header.txt
│ │ └── matchers_imports.txt
│ └── run.php
├── hamcrest/
│ ├── Hamcrest/
│ │ ├── Arrays/
│ │ │ ├── IsArray.php
│ │ │ ├── IsArrayContaining.php
│ │ │ ├── IsArrayContainingInAnyOrder.php
│ │ │ ├── IsArrayContainingInOrder.php
│ │ │ ├── IsArrayContainingKey.php
│ │ │ ├── IsArrayContainingKeyValuePair.php
│ │ │ ├── IsArrayWithSize.php
│ │ │ ├── MatchingOnce.php
│ │ │ └── SeriesMatchingOnce.php
│ │ ├── AssertionError.php
│ │ ├── BaseDescription.php
│ │ ├── BaseMatcher.php
│ │ ├── Collection/
│ │ │ ├── IsEmptyTraversable.php
│ │ │ └── IsTraversableWithSize.php
│ │ ├── Core/
│ │ │ ├── AllOf.php
│ │ │ ├── AnyOf.php
│ │ │ ├── CombinableMatcher.php
│ │ │ ├── DescribedAs.php
│ │ │ ├── Every.php
│ │ │ ├── HasToString.php
│ │ │ ├── Is.php
│ │ │ ├── IsAnything.php
│ │ │ ├── IsCollectionContaining.php
│ │ │ ├── IsEqual.php
│ │ │ ├── IsIdentical.php
│ │ │ ├── IsInstanceOf.php
│ │ │ ├── IsNot.php
│ │ │ ├── IsNull.php
│ │ │ ├── IsSame.php
│ │ │ ├── IsTypeOf.php
│ │ │ ├── Set.php
│ │ │ └── ShortcutCombination.php
│ │ ├── Description.php
│ │ ├── DiagnosingMatcher.php
│ │ ├── FeatureMatcher.php
│ │ ├── Internal/
│ │ │ └── SelfDescribingValue.php
│ │ ├── Matcher.php
│ │ ├── MatcherAssert.php
│ │ ├── Matchers.php
│ │ ├── NullDescription.php
│ │ ├── Number/
│ │ │ ├── IsCloseTo.php
│ │ │ └── OrderingComparison.php
│ │ ├── SelfDescribing.php
│ │ ├── StringDescription.php
│ │ ├── Text/
│ │ │ ├── IsEmptyString.php
│ │ │ ├── IsEqualIgnoringCase.php
│ │ │ ├── IsEqualIgnoringWhiteSpace.php
│ │ │ ├── MatchesPattern.php
│ │ │ ├── StringContains.php
│ │ │ ├── StringContainsIgnoringCase.php
│ │ │ ├── StringContainsInOrder.php
│ │ │ ├── StringEndsWith.php
│ │ │ ├── StringStartsWith.php
│ │ │ └── SubstringMatcher.php
│ │ ├── Type/
│ │ │ ├── IsArray.php
│ │ │ ├── IsBoolean.php
│ │ │ ├── IsCallable.php
│ │ │ ├── IsDouble.php
│ │ │ ├── IsInteger.php
│ │ │ ├── IsNumeric.php
│ │ │ ├── IsObject.php
│ │ │ ├── IsResource.php
│ │ │ ├── IsScalar.php
│ │ │ └── IsString.php
│ │ ├── TypeSafeDiagnosingMatcher.php
│ │ ├── TypeSafeMatcher.php
│ │ ├── Util.php
│ │ └── Xml/
│ │ └── HasXPath.php
│ └── Hamcrest.php
├── phpstan.neon
└── tests/
├── Hamcrest/
│ ├── AbstractMatcherTest.php
│ ├── Array/
│ │ ├── IsArrayContainingInAnyOrderTest.php
│ │ ├── IsArrayContainingInOrderTest.php
│ │ ├── IsArrayContainingKeyTest.php
│ │ ├── IsArrayContainingKeyValuePairTest.php
│ │ ├── IsArrayContainingTest.php
│ │ ├── IsArrayTest.php
│ │ └── IsArrayWithSizeTest.php
│ ├── BaseMatcherTest.php
│ ├── Collection/
│ │ ├── IsEmptyTraversableTest.php
│ │ └── IsTraversableWithSizeTest.php
│ ├── Core/
│ │ ├── AllOfTest.php
│ │ ├── AnyOfTest.php
│ │ ├── CombinableMatcherTest.php
│ │ ├── DescribedAsTest.php
│ │ ├── EveryTest.php
│ │ ├── HasToStringTest.php
│ │ ├── IsAnythingTest.php
│ │ ├── IsCollectionContainingTest.php
│ │ ├── IsEqualTest.php
│ │ ├── IsIdenticalTest.php
│ │ ├── IsInstanceOfTest.php
│ │ ├── IsNotTest.php
│ │ ├── IsNullTest.php
│ │ ├── IsSameTest.php
│ │ ├── IsTest.php
│ │ ├── IsTypeOfTest.php
│ │ ├── SampleBaseClass.php
│ │ ├── SampleSubClass.php
│ │ └── SetTest.php
│ ├── FeatureMatcherTest.php
│ ├── InvokedMatcherTest.php
│ ├── MatcherAssertTest.php
│ ├── Number/
│ │ ├── IsCloseToTest.php
│ │ └── OrderingComparisonTest.php
│ ├── StringDescriptionTest.php
│ ├── Text/
│ │ ├── IsEmptyStringTest.php
│ │ ├── IsEqualIgnoringCaseTest.php
│ │ ├── IsEqualIgnoringWhiteSpaceTest.php
│ │ ├── MatchesPatternTest.php
│ │ ├── StringContainsIgnoringCaseTest.php
│ │ ├── StringContainsInOrderTest.php
│ │ ├── StringContainsTest.php
│ │ ├── StringEndsWithTest.php
│ │ └── StringStartsWithTest.php
│ ├── Type/
│ │ ├── IsArrayTest.php
│ │ ├── IsBooleanTest.php
│ │ ├── IsCallableTest.php
│ │ ├── IsDoubleTest.php
│ │ ├── IsIntegerTest.php
│ │ ├── IsNumericTest.php
│ │ ├── IsObjectTest.php
│ │ ├── IsResourceTest.php
│ │ ├── IsScalarTest.php
│ │ └── IsStringTest.php
│ ├── UtilTest.php
│ └── Xml/
│ └── HasXPathTest.php
├── bootstrap.php
├── phpstan-baseline.neon
└── phpunit.xml.dist
================================================
FILE CONTENTS
================================================
================================================
FILE: .coveralls.yml
================================================
src_dir: hamcrest
================================================
FILE: .gitattributes
================================================
/.coveralls.yml export-ignore
/.gush.yml export-ignore
/.travis.yml export-ignore
/.github export-ignore
/tests export-ignore
================================================
FILE: .github/workflows/ci.yml
================================================
name: ci
on:
push:
pull_request:
jobs:
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: curl
tools: composer:v2
coverage: none
- name: Install PHP dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Run PHPStan
run: vendor/bin/phpstan analyze
tests:
name: Tests ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl
tools: composer:v2
coverage: none
- name: Install PHP dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit -c tests/phpunit.xml.dist
================================================
FILE: .gitignore
================================================
composer.lock
tests/.phpunit.result.cache
tests/phpunit.xml
vendor
================================================
FILE: .gush.yml
================================================
adapter: github
issue_tracker: github
meta-header: "Copyright (c) 2009-2015 hamcrest.org"
table-pr:
fixed_tickets: ['Fixed Tickets', '']
license: ['License', MIT]
base: master
================================================
FILE: CHANGES.txt
================================================
== Version 2.1.1: Released Apr 30 2025 ==
* Fix implicitly nullable via default value null for PHP 8.4 (#85)
== Version 2.1.0: Released Apr 29 2025 ==
* Dropped support for PHP <=7.3
== Version 2.0.1: Released Jul 09 2020 ==
* Added support for PHP 8
== Version 2.0: Released Feb 26 2016 ==
* Removed automatic loading of global functions
== Version 1.1.0: Released Feb 2 2012 ==
Issues Fixed: 121, 138, 147
* Added non-empty matchers to complement the emptiness-matching forms.
- nonEmptyString()
- nonEmptyArray()
- nonEmptyTraversable()
* Added ability to pass variable arguments to several array-based matcher
factory methods so they work like allOf() et al.
- anArray()
- arrayContainingInAnyOrder(), containsInAnyOrder()
- arrayContaining(), contains()
- stringContainsInOrder()
* Matchers that accept an array of matchers now also accept variable arguments.
Any non-matcher arguments are wrapped by IsEqual.
* Added noneOf() as a shortcut for not(anyOf()).
== Version 1.0.0: Released Jan 20 2012 ==
Issues Fixed: 119, 136, 139, 141, 148, 149, 172
* Moved hamcrest.php into Hamcrest folder and renamed to Hamcrest.php.
This is more in line with PEAR packaging standards.
* Renamed callable() to callableValue() for compatibility with PHP 5.4.
* Added Hamcrest_Text_StringContainsIgnoringCase to assert using stripos().
assertThat('fOObAr', containsStringIgnoringCase('oba'));
assertThat('fOObAr', containsString('oba')->ignoringCase());
* Fixed Hamcrest_Core_IsInstanceOf to return false for native types.
* Moved string-based matchers to Hamcrest_Text package.
StringContains, StringEndsWith, StringStartsWith, and SubstringMatcher
* Hamcrest.php and Hamcrest_Matchers.php are now built from @factory doctags.
Added @factory doctag to every static factory method.
* Hamcrest_Matchers and Hamcrest.php now import each matcher as-needed
and Hamcrest.php calls the matchers directly instead of Hamcrest_Matchers.
== Version 0.3.0: Released Jul 26 2010 ==
* Added running count to Hamcrest_MatcherAssert with methods to get and reset it.
This can be used by unit testing frameworks for reporting.
* Added Hamcrest_Core_HasToString to assert return value of toString() or __toString().
assertThat($anObject, hasToString('foo'));
* Added Hamcrest_Type_IsScalar to assert is_scalar().
Matches values of type bool, int, float, double, and string.
assertThat($count, scalarValue());
assertThat('foo', scalarValue());
* Added Hamcrest_Collection package.
- IsEmptyTraversable
- IsTraversableWithSize
assertThat($iterator, emptyTraversable());
assertThat($iterator, traversableWithSize(5));
* Added Hamcrest_Xml_HasXPath to assert XPath expressions or the content of nodes in an XML/HTML DOM.
assertThat($dom, hasXPath('books/book/title'));
assertThat($dom, hasXPath('books/book[contains(title, "Alice")]', 3));
assertThat($dom, hasXPath('books/book/title', 'Alice in Wonderland'));
assertThat($dom, hasXPath('count(books/book)', greaterThan(10)));
* Added aliases to match the Java API.
hasEntry() -> hasKeyValuePair()
hasValue() -> hasItemInArray()
contains() -> arrayContaining()
containsInAnyOrder() -> arrayContainingInAnyOrder()
* Added optional subtype to Hamcrest_TypeSafeMatcher to enforce object class or resource type.
* Hamcrest_TypeSafeDiagnosingMatcher now extends Hamcrest_TypeSafeMatcher.
== Version 0.2.0: Released Jul 14 2010 ==
Issues Fixed: 109, 111, 114, 115
* Description::appendValues() and appendValueList() accept Iterator and IteratorAggregate. [111]
BaseDescription::appendValue() handles IteratorAggregate.
* assertThat() accepts a single boolean parameter and
wraps any non-Matcher third parameter with equalTo().
* Removed null return value from assertThat(). [114]
* Fixed wrong variable name in contains(). [109]
* Added Hamcrest_Core_IsSet to assert isset().
assertThat(array('foo' => 'bar'), set('foo'));
assertThat(array('foo' => 'bar'), notSet('bar'));
* Added Hamcrest_Core_IsTypeOf to assert built-in types with gettype(). [115]
Types: array, boolean, double, integer, null, object, resource, and string.
Note that gettype() returns "double" for float values.
assertThat($count, typeOf('integer'));
assertThat(3.14159, typeOf('double'));
assertThat(array('foo', 'bar'), typeOf('array'));
assertThat(new stdClass(), typeOf('object'));
* Added type-specific matchers in new Hamcrest_Type package.
- IsArray
- IsBoolean
- IsDouble (includes float values)
- IsInteger
- IsObject
- IsResource
- IsString
assertThat($count, integerValue());
assertThat(3.14159, floatValue());
assertThat('foo', stringValue());
* Added Hamcrest_Type_IsNumeric to assert is_numeric().
Matches values of type int and float/double or strings that are formatted as numbers.
assertThat(5, numericValue());
assertThat('-5e+3', numericValue());
* Added Hamcrest_Type_IsCallable to assert is_callable().
assertThat('preg_match', callable());
assertThat(array('SomeClass', 'SomeMethod'), callable());
assertThat(array($object, 'SomeMethod'), callable());
assertThat($object, callable());
assertThat(function ($x, $y) { return $x + $y; }, callable());
* Added Hamcrest_Text_MatchesPattern for regex matching with preg_match().
assertThat('foobar', matchesPattern('/o+b/'));
* Added aliases:
- atLeast() for greaterThanOrEqualTo()
- atMost() for lessThanOrEqualTo()
== Version 0.1.0: Released Jul 7 2010 ==
* Created PEAR package
* Core matchers
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
hamcrest-php is an open source, community-driven project. If you'd like to contribute, feel free to do this, but remember to follow these few simple rules:
## Asking Questions
Feel free to ask any questions and share your experiences in the [Issue tracking system](https://github.com/hamcrest/hamcrest-php/issues/) and help to improve the documentation.
## Submitting an issues
- A reproducible example is required for every bug report, otherwise it will most probably be __closed without warning__.
- If you are going to make a big, substantial change, let's discuss it first.
## Working with Pull Requests
1. Create your feature addition or a bug fix branch based on __`master`__ branch in your repository's fork.
2. Make necessary changes, but __don't mix__ code reformatting with code changes on topic.
3. Add tests for those changes (please look into `tests/` folder for some examples). This is important so we don't break it in a future version unintentionally.
4. Check your code using "Coding Standard" (see below).
5. Commit your code.
6. Squash your commits by topic to preserve a clean and readable log.
7. Create Pull Request.
## Running the Tests
### Installation/Configuration
1. Using `git clone https://github.com/hamcrest/hamcrest-php` to clone this repository.
2. Using the `composer update` to update the dependencies to support your development environment.
3. Using `vendor/bin/phpunit -c tests/phpunit.xml.dist` command to do unit test works.
## Contributor Code of Conduct
Please note that this project is released with a [Contributor Code of
Conduct](http://contributor-covenant.org/). By participating in this project
you agree to abide by its terms. See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file.
================================================
FILE: LICENSE.txt
================================================
BSD License
Copyright (c) 2000-2025, www.hamcrest.org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
Neither the name of Hamcrest nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
================================================
FILE: README.md
================================================
This is the PHP port of Hamcrest Matchers
=========================================
[](https://github.com/hamcrest/hamcrest-php/actions/workflows/ci.yml)
Hamcrest is a matching library originally written for Java, but
subsequently ported to many other languages. hamcrest-php is the
official PHP port of Hamcrest and essentially follows a literal
translation of the original Java API for Hamcrest, with a few
Exceptions, mostly down to PHP language barriers:
1. `instanceOf($theClass)` is actually `anInstanceOf($theClass)`
2. `both(containsString('a'))->and(containsString('b'))`
is actually `both(containsString('a'))->andAlso(containsString('b'))`
3. `either(containsString('a'))->or(containsString('b'))`
is actually `either(containsString('a'))->orElse(containsString('b'))`
4. Unless it would be non-semantic for a matcher to do so, hamcrest-php
allows dynamic typing for it's input, in "the PHP way". Exception are
where semantics surrounding the type itself would suggest otherwise,
such as stringContains() and greaterThan().
5. Several official matchers have not been ported because they don't
make sense or don't apply in PHP:
- `typeCompatibleWith($theClass)`
- `eventFrom($source)`
- `hasProperty($name)` **
- `samePropertyValuesAs($obj)` **
6. When most of the collections matchers are finally ported, PHP-specific
aliases will probably be created due to a difference in naming
conventions between Java's Arrays, Collections, Sets and Maps compared
with PHP's Arrays.
---
** [Unless we consider POPO's (Plain Old PHP Objects) akin to JavaBeans]
- The POPO thing is a joke. Java devs coin the term POJO's (Plain Old
Java Objects).
Usage
-----
Hamcrest matchers are easy to use as:
```php
\Hamcrest\MatcherAssert::assertThat('a', \Hamcrest\Matchers::equalToIgnoringCase('A'));
```
Alternatively, you can use the global proxy-functions:
```php
$result = true;
// with an identifier
assertThat("result should be true", $result, equalTo(true));
// without an identifier
assertThat($result, equalTo(true));
// evaluate a boolean expression
assertThat($result === true);
// with syntactic sugar is()
assertThat(true, is(true));
```
> [!NOTE]
> To prevent tests from being marked as Risky (the `This test did not perform any assertions` message)
> add this code to your test case `tearDown` method:
>
> ```php
> $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount());
> \Hamcrest\MatcherAssert::resetCount();
> ```
> [!WARNING]
> the global proxy-functions aren't autoloaded by default, so you will need to load them first:
>
> ```php
> \Hamcrest\Util::registerGlobalFunctions();
> ```
For brevity, all of the examples below use the proxy-functions.
Documentation
-------------
A tutorial can be found on the [Hamcrest site](https://code.google.com/archive/p/hamcrest/wikis/TutorialPHP.wiki).
Available Matchers
------------------
* [Array](../master/README.md#array)
* [Collection](../master/README.md#collection)
* [Object](../master/README.md#object)
* [Numbers](../master/README.md#numbers)
* [Type checking](../master/README.md#type-checking)
* [XML](../master/README.md#xml)
### Array
* `anArray` - evaluates an array
```php
assertThat([], anArray());
```
* `hasItemInArray` - check if item exists in array
```php
$list = range(2, 7, 2);
$item = 4;
assertThat($list, hasItemInArray($item));
```
* `hasValue` - alias of hasItemInArray
* `arrayContainingInAnyOrder` - check if array contains elements in any order
```php
assertThat([2, 4, 6], arrayContainingInAnyOrder([6, 4, 2]));
assertThat([2, 4, 6], arrayContainingInAnyOrder([4, 2, 6]));
```
* `containsInAnyOrder` - alias of arrayContainingInAnyOrder
* `arrayContaining` - An array with elements that match the given matchers in the same order.
```php
assertThat([2, 4, 6], arrayContaining([2, 4, 6]));
assertthat([2, 4, 6], not(arrayContaining([6, 4, 2])));
```
* `contains` - check array in same order
```php
assertThat([2, 4, 6], contains([2, 4, 6]));
```
* `hasKeyInArray` - check if array has given key
```php
assertThat(['name'=> 'foobar'], hasKeyInArray('name'));
```
* `hasKey` - alias of hasKeyInArray
* `hasKeyValuePair` - check if array has given key, value pair
```php
assertThat(['name'=> 'foobar'], hasKeyValuePair('name', 'foobar'));
```
* `hasEntry` - same as hasKeyValuePair
* `arrayWithSize` - check array has given size
```php
assertthat([2, 4, 6], arrayWithSize(3));
```
* `emptyArray` - check if array is empty
```php
assertThat([], emptyArray());
```
* `nonEmptyArray`
```php
assertThat([1], nonEmptyArray());
```
### Collection
* `emptyTraversable` - check if traversable is empty
```php
$empty_it = new EmptyIterator;
assertThat($empty_it, emptyTraversable());
```
* `nonEmptyTraversable` - check if traversable isn't empty
```php
$non_empty_it = new ArrayIterator(range(1, 10));
assertThat($non_empty_it, nonEmptyTraversable());
a
```
* `traversableWithSize`
```php
$non_empty_it = new ArrayIterator(range(1, 10));
assertThat($non_empty_it, traversableWithSize(count(range(1, 10))));
`
```
### Core
* `allOf` - Evaluates to true only if ALL of the passed in matchers evaluate to true.
```php
assertThat([2,4,6], allOf(hasValue(2), arrayWithSize(3)));
```
* `anyOf` - Evaluates to true if ANY of the passed in matchers evaluate to true.
```php
assertThat([2, 4, 6], anyOf(hasValue(8), hasValue(2)));
```
* `noneOf` - Evaluates to false if ANY of the passed in matchers evaluate to true.
```php
assertThat([2, 4, 6], noneOf(hasValue(1), hasValue(3)));
```
* `both` + `andAlso` - This is useful for fluently combining matchers that must both pass.
```php
assertThat([2, 4, 6], both(hasValue(2))->andAlso(hasValue(4)));
```
* `either` + `orElse` - This is useful for fluently combining matchers where either may pass,
```php
assertThat([2, 4, 6], either(hasValue(2))->orElse(hasValue(4)));
```
* `describedAs` - Wraps an existing matcher and overrides the description when it fails.
```php
$expected = "Dog";
$found = null;
// this assertion would result error message as Expected: is not null but: was null
//assertThat("Expected {$expected}, got {$found}", $found, is(notNullValue()));
// and this assertion would result error message as Expected: Dog but: was null
//assertThat($found, describedAs($expected, notNullValue()));
```
* `everyItem` - A matcher to apply to every element in an array.
```php
assertThat([2, 4, 6], everyItem(notNullValue()));
```
* `hasItem` - check array has given item, it can take a matcher argument
```php
assertThat([2, 4, 6], hasItem(equalTo(2)));
```
* `hasItems` - check array has given items, it can take multiple matcher as arguments
```php
assertThat([1, 3, 5], hasItems(equalTo(1), equalTo(3)));
```
### Object
* `hasToString` - check `__toString` or `toString` method
```php
class Foo {
public $name = null;
public function __toString() {
return "[Foo]Instance";
}
}
$foo = new Foo;
assertThat($foo, hasToString(equalTo("[Foo]Instance")));
```
* `equalTo` - compares two instances using comparison operator '=='
```php
$foo = new Foo;
$foo2 = new Foo;
assertThat($foo, equalTo($foo2));
```
* `identicalTo` - compares two instances using identity operator '==='
```php
assertThat($foo, is(not(identicalTo($foo2))));
```
* `anInstanceOf` - check instance is an instance|sub-class of given class
```php
assertThat($foo, anInstanceOf(Foo::class));
```
* `any` - alias of `anInstanceOf`
* `nullValue` check null
```php
assertThat(null, is(nullValue()));
```
* `notNullValue` check not null
```php
assertThat("", notNullValue());
```
* `sameInstance` - check for same instance
```php
assertThat($foo, is(not(sameInstance($foo2))));
assertThat($foo, is(sameInstance($foo)));
```
* `typeOf`- check type
```php
assertThat(1, typeOf("integer"));
```
* `notSet` - check if instance property is not set
```php
assertThat($foo, notSet("name"));
```
* `set` - check if instance property is set
```php
$foo->name = "bar";
assertThat($foo, set("name"));
```
### Numbers
* `closeTo` - check value close to a range
```php
assertThat(3, closeTo(3, 0.5));
```
* `comparesEqualTo` - check with '=='
```php
assertThat(2, comparesEqualTo(2));
```
* `greaterThan` - check '>'
```
assertThat(2, greaterThan(1));
```
* `greaterThanOrEqualTo`
```php
assertThat(2, greaterThanOrEqualTo(2));
```
* `atLeast` - The value is >= given value
```php
assertThat(3, atLeast(2));
```
* `lessThan`
```php
assertThat(2, lessThan(3));
```
* `lessThanOrEqualTo`
```php
assertThat(2, lessThanOrEqualTo(3));
```
* `atMost` - The value is <= given value
```php
assertThat(2, atMost(3));
```
### String
* `emptyString` - check for empty string
```php
assertThat("", emptyString());
```
* `isEmptyOrNullString`
```php
assertThat(null, isEmptyOrNullString());
```
* `nullOrEmptyString`
```php
assertThat("", nullOrEmptyString());
```
* `isNonEmptyString`
```php
assertThat("foo", isNonEmptyString());
```
* `nonEmptyString`
```php
assertThat("foo", nonEmptyString());
```
* `equalToIgnoringCase`
```php
assertThat("Foo", equalToIgnoringCase("foo"));
```
* `equalToIgnoringWhiteSpace`
```php
assertThat(" Foo ", equalToIgnoringWhiteSpace("Foo"));
```
* `matchesPattern` - matches with regex pattern
```php
assertThat("foobarbaz", matchesPattern('/(foo)(bar)(baz)/'));
```
* `containsString` - check for substring
```php
assertThat("foobar", containsString("foo"));
```
* `containsStringIgnoringCase`
```php
assertThat("fooBar", containsStringIgnoringCase("bar"));
```
* `stringContainsInOrder`
```php
assertThat("foo", stringContainsInOrder("foo"));
```
* `endsWith` - check string that ends with given value
```php
assertThat("foo", endsWith("oo"));
```
* `startsWith` - check string that starts with given value
```php
assertThat("bar", startsWith("ba"));
```
### Type-checking
* `arrayValue` - check array type
```php
assertThat([], arrayValue());
```
* `booleanValue`
```php
assertThat(true, booleanValue());
```
* `boolValue` - alias of booleanValue
* `callableValue` - check if value is callable
```php
$func = function () {};
assertThat($func, callableValue());
```
* `doubleValue`
```php
assertThat(3.14, doubleValue());
```
* `floatValue`
```php
assertThat(3.14, floatValue());
```
* `integerValue`
```php
assertThat(1, integerValue());
```
* `intValue` - alias of `integerValue`
* `numericValue` - check if value is numeric
```php
assertThat("123", numericValue());
```
* `objectValue` - check for object
```php
$obj = new stdClass;
assertThat($obj, objectValue());
```
* `anObject`
```php
assertThat($obj, anObject());
```
* `resourceValue` - check resource type
```php
$fp = fopen("/tmp/foo", "w+");
assertThat($fp, resourceValue());
```
* `scalarValue` - check for scalar value
```php
assertThat(1, scalarValue());
```
* `stringValue`
```php
assertThat("", stringValue());
```
### XML
* `hasXPath` - check xml with a xpath
```php
$xml = <<<XML
<books>
<book>
<isbn>1</isbn>
</book>
<book>
<isbn>2</isbn>
</book>
</books>
XML;
$doc = new DOMDocument;
$doc->loadXML($xml);
assertThat($doc, hasXPath("book", 2));
```
================================================
FILE: composer.json
================================================
{
"name": "hamcrest/hamcrest-php",
"type": "library",
"description": "This is the PHP port of Hamcrest Matchers",
"keywords": ["test"],
"license": "BSD-3-Clause",
"authors": [
],
"autoload": {
"classmap": ["hamcrest"]
},
"autoload-dev": {
"classmap": ["tests", "generator"]
},
"require": {
"php": "^7.4|^8.0",
"ext-ctype": "*",
"ext-dom": "*"
},
"require-dev": {
"phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0",
"phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0"
},
"replace": {
"kodova/hamcrest-php": "*",
"davedevelopment/hamcrest-php": "*",
"cordoval/hamcrest-php": "*"
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}
================================================
FILE: generator/FactoryCall.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
class FactoryCall
{
/**
* Hamcrest standard is two spaces for each level of indentation.
*
* @var string
*/
const INDENT = ' ';
/**
* @var FactoryMethod
*/
private $method;
/**
* @var string
*/
private $name;
public function __construct(FactoryMethod $method, $name)
{
$this->method = $method;
$this->name = $name;
}
public function getMethod()
{
return $this->method;
}
public function getName()
{
return $this->name;
}
}
================================================
FILE: generator/FactoryClass.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
class FactoryClass
{
/**
* @var string
*/
private $file;
/**
* @var ReflectionClass
*/
private $reflector;
/**
* @var array
*/
private $methods;
public function __construct($file, ReflectionClass $class)
{
$this->file = $file;
$this->reflector = $class;
$this->extractFactoryMethods();
}
public function extractFactoryMethods()
{
$this->methods = array();
foreach ($this->getPublicStaticMethods() as $method) {
if ($method->isFactory()) {
$this->methods[] = $method;
}
}
}
public function getPublicStaticMethods()
{
$methods = array();
foreach ($this->reflector->getMethods(ReflectionMethod::IS_STATIC) as $method) {
if ($method->isPublic() && $method->getDeclaringClass() == $this->reflector) {
$methods[] = new FactoryMethod($this, $method);
}
}
return $methods;
}
public function getFile()
{
return $this->file;
}
public function getName()
{
return $this->reflector->name;
}
public function isFactory()
{
return !empty($this->methods);
}
public function getMethods()
{
return $this->methods;
}
}
================================================
FILE: generator/FactoryFile.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
abstract class FactoryFile
{
/**
* Hamcrest standard is two spaces for each level of indentation.
*
* @var string
*/
const INDENT = ' ';
private $indent;
private $file;
private $code;
public function __construct($file, $indent)
{
$this->file = $file;
$this->indent = $indent;
}
abstract public function addCall(FactoryCall $call);
abstract public function build();
public function addFileHeader()
{
$this->code = '';
$this->addPart('file_header');
}
public function addPart($name)
{
$this->addCode($this->readPart($name));
}
public function addCode($code)
{
$this->code .= $code;
}
public function readPart($name)
{
return file_get_contents(__DIR__ . "/parts/$name.txt");
}
public function generateFactoryCall(FactoryCall $call)
{
$method = $call->getMethod();
$code = $method->getComment($this->indent) . "\n";
$code .= $this->generateDeclaration($call->getName(), $method);
$code .= $this->generateCall($method);
$code .= $this->generateClosing();
return $code;
}
public function generateDeclaration($name, FactoryMethod $method)
{
$code = $this->indent . $this->getDeclarationModifiers()
. 'function ' . $name . '('
. $this->generateDeclarationArguments($method)
. '): ' . $this->generateReturnType($method) . "\n" . $this->indent . '{' . "\n";
return $code;
}
public function getDeclarationModifiers()
{
return '';
}
public function generateDeclarationArguments(FactoryMethod $method)
{
if ($method->acceptsVariableArguments()) {
return '/* args... */';
} else {
return $method->getParameterDeclarations();
}
}
public function generateReturnType(FactoryMethod $method): string
{
$call = $method->getCalls()[0];
if (!$call instanceof FactoryCall) {
throw new Exception('The first call in the FactoryMethod cannot be used to determine the return type. Method: '.$method->getName());
}
$returnType = $call->getMethod()->getReturnType();
if (!$returnType) {
throw new \Exception('The first calls FactoryMethod cannot be used to determine the return type. Method: '.$method->getName());
}
return sprintf('\\%s', $returnType);
}
public function generateImport(FactoryMethod $method)
{
return $this->indent . self::INDENT . "require_once '" . $method->getClass()->getFile() . "';" . "\n";
}
public function generateCall(FactoryMethod $method)
{
$code = '';
if ($method->acceptsVariableArguments()) {
$code .= $this->indent . self::INDENT . '$args = func_get_args();' . "\n";
}
$code .= $this->indent . self::INDENT . 'return ';
if ($method->acceptsVariableArguments()) {
$code .= 'call_user_func_array(array(\''
. '\\' . $method->getClassName() . '\', \''
. $method->getName() . '\'), $args);' . "\n";
} else {
$code .= '\\' . $method->getClassName() . '::'
. $method->getName() . '('
. $method->getParameterInvocations() . ');' . "\n";
}
return $code;
}
public function generateClosing()
{
return $this->indent . '}' . "\n";
}
public function write()
{
file_put_contents($this->file, $this->code);
}
}
================================================
FILE: generator/FactoryGenerator.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Controls the process of extracting @factory doctags
* and generating factory method files.
*
* Uses File_Iterator to scan for PHP files.
*/
class FactoryGenerator
{
/**
* Path to the Hamcrest PHP files to process.
*
* @var string
*/
private $path;
/**
* @var array of FactoryFile
*/
private $factoryFiles;
public function __construct($path)
{
$this->path = $path;
$this->factoryFiles = array();
}
public function addFactoryFile(FactoryFile $factoryFile)
{
$this->factoryFiles[] = $factoryFile;
}
public function generate()
{
$classes = $this->getClassesWithFactoryMethods();
foreach ($classes as $class) {
foreach ($class->getMethods() as $method) {
foreach ($method->getCalls() as $call) {
foreach ($this->factoryFiles as $file) {
$file->addCall($call);
}
}
}
}
}
public function write()
{
foreach ($this->factoryFiles as $file) {
$file->build();
$file->write();
}
}
public function getClassesWithFactoryMethods()
{
$classes = array();
$files = $this->getSortedFiles();
foreach ($files as $file) {
$class = $this->getFactoryClass($file);
if ($class !== null) {
$classes[] = $class;
}
}
return $classes;
}
public function getSortedFiles()
{
$iter = $this->getFileIterator();
$files = array();
foreach ($iter as $file) {
$files[] = $file;
}
sort($files, SORT_STRING);
return $files;
}
private function getFileIterator()
{
$factoryClass = class_exists('File_Iterator_Factory') ? 'File_Iterator_Factory' : 'SebastianBergmann\FileIterator\Factory';
$factory = new $factoryClass();
return $factory->getFileIterator($this->path, '.php');
}
public function getFactoryClass($file)
{
$name = $this->getFactoryClassName($file);
if ($name !== null) {
require_once $file;
if (class_exists($name)) {
$class = new FactoryClass(substr($file, strpos($file, 'Hamcrest/')), new ReflectionClass($name));
if ($class->isFactory()) {
return $class;
}
}
}
return null;
}
public function getFactoryClassName($file)
{
$content = file_get_contents($file);
if (preg_match('/namespace\s+(.+);/', $content, $namespace)
&& preg_match('/\n\s*class\s+(\w+)\s+extends\b/', $content, $className)
&& preg_match('/@factory\b/', $content)
) {
return $namespace[1] . '\\' . $className[1];
}
return null;
}
}
================================================
FILE: generator/FactoryMethod.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Represents a single static factory method from a {@link Matcher} class.
*
* @todo Search method in file contents for func_get_args() to replace factoryVarArgs.
*/
class FactoryMethod
{
/**
* @var FactoryClass
*/
private $class;
/**
* @var ReflectionMethod
*/
private $reflector;
/**
* @var array of string
*/
private $comment;
/**
* @var bool
*/
private $isVarArgs;
/**
* @var array of FactoryCall
*/
private $calls;
/**
* @var array FactoryParameter
*/
private $parameters;
public function __construct(FactoryClass $class, ReflectionMethod $reflector)
{
$this->class = $class;
$this->reflector = $reflector;
$this->extractCommentWithoutLeadingShashesAndStars();
$this->extractFactoryNamesFromComment();
$this->extractParameters();
}
public function extractCommentWithoutLeadingShashesAndStars()
{
$this->comment = explode("\n", $this->reflector->getDocComment());
foreach ($this->comment as &$line) {
$line = preg_replace('#^\s*(/\\*+|\\*+/|\\*)\s?#', '', $line);
}
$this->trimLeadingBlankLinesFromComment();
$this->trimTrailingBlankLinesFromComment();
}
public function trimLeadingBlankLinesFromComment()
{
while (count($this->comment) > 0) {
$line = array_shift($this->comment);
if (trim($line) != '') {
array_unshift($this->comment, $line);
break;
}
}
}
public function trimTrailingBlankLinesFromComment()
{
while (count($this->comment) > 0) {
$line = array_pop($this->comment);
if (trim($line) != '') {
array_push($this->comment, $line);
break;
}
}
}
public function extractFactoryNamesFromComment()
{
$this->calls = array();
for ($i = 0; $i < count($this->comment); $i++) {
if ($this->extractFactoryNamesFromLine($this->comment[$i])) {
unset($this->comment[$i]);
}
}
$this->trimTrailingBlankLinesFromComment();
}
public function extractFactoryNamesFromLine($line)
{
if (preg_match('/^\s*@factory(\s+(.+))?$/', $line, $match)) {
$this->createCalls(
$this->extractFactoryNamesFromAnnotation(
isset($match[2]) ? trim($match[2]) : null
)
);
return true;
}
return false;
}
public function extractFactoryNamesFromAnnotation($value)
{
$primaryName = $this->reflector->getName();
if (empty($value)) {
return array($primaryName);
}
preg_match_all('/(\.{3}|-|[a-zA-Z_][a-zA-Z_0-9]*)/', $value, $match);
$names = $match[0];
if (in_array('...', $names)) {
$this->isVarArgs = true;
}
if (!in_array('-', $names) && !in_array($primaryName, $names)) {
array_unshift($names, $primaryName);
}
return $names;
}
public function createCalls(array $names)
{
$names = array_unique($names);
foreach ($names as $name) {
if ($name != '-' && $name != '...') {
$this->calls[] = new FactoryCall($this, $name);
}
}
}
public function extractParameters()
{
$this->parameters = array();
if (!$this->isVarArgs) {
foreach ($this->reflector->getParameters() as $parameter) {
$this->parameters[] = new FactoryParameter($this, $parameter);
}
}
}
public function getParameterDeclarations()
{
if ($this->isVarArgs || !$this->hasParameters()) {
return '';
}
$params = array();
foreach ($this->parameters as /** @var $parameter FactoryParameter */
$parameter) {
$params[] = $parameter->getDeclaration();
}
return implode(', ', $params);
}
public function getParameterInvocations()
{
if ($this->isVarArgs) {
return '';
}
$params = array();
foreach ($this->parameters as $parameter) {
$params[] = $parameter->getInvocation();
}
return implode(', ', $params);
}
public function getClass()
{
return $this->class;
}
public function getClassName()
{
return $this->class->getName();
}
public function getName()
{
return $this->reflector->name;
}
public function isFactory()
{
return count($this->calls) > 0;
}
public function getCalls()
{
return $this->calls;
}
public function acceptsVariableArguments()
{
return $this->isVarArgs;
}
public function hasParameters()
{
return !empty($this->parameters);
}
public function getParameters()
{
return $this->parameters;
}
public function getFullName()
{
return $this->getClassName() . '::' . $this->getName();
}
public function getReturnType(): ?string
{
if (!$this->reflector->hasReturnType()) {
return null;
}
$returnType = $this->reflector->getReturnType()->getName();
if ($returnType === 'self') {
return $this->reflector->getDeclaringClass()->getName();
}
return $returnType;
}
public function getCommentText()
{
return implode("\n", $this->comment);
}
public function getComment($indent = '')
{
$comment = $indent . '/**';
foreach ($this->comment as $line) {
$comment .= "\n" . rtrim($indent . ' * ' . $line);
}
$comment .= "\n" . $indent . ' */';
return $comment;
}
}
================================================
FILE: generator/FactoryParameter.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
class FactoryParameter
{
/**
* @var FactoryMethod
*/
private $method;
/**
* @var ReflectionParameter
*/
private $reflector;
public function __construct(FactoryMethod $method, ReflectionParameter $reflector)
{
$this->method = $method;
$this->reflector = $reflector;
}
/**
* Compute the declaration code.
*
* @return string
*/
public function getDeclaration()
{
$code = $this->getTypeCode() . $this->getInvocation();
if ($this->reflector->isOptional()) {
$default = $this->reflector->getDefaultValue();
if (is_null($default)) {
$default = 'null';
} elseif (is_bool($default)) {
$default = $default ? 'true' : 'false';
} elseif (is_string($default)) {
$default = "'" . $default . "'";
} elseif (is_numeric($default)) {
$default = strval($default);
} elseif (is_array($default)) {
$default = 'array()';
} else {
echo 'Warning: unknown default type for ' . $this->getMethod()->getFullName() . "\n";
var_dump($default);
$default = 'null';
}
$code .= ' = ' . $default;
}
return $code;
}
/**
* Compute the type code for the parameter.
*
* @return string
*/
private function getTypeCode()
{
// Handle PHP 5 separately
if (PHP_VERSION_ID < 70000) {
if ($this->reflector->isArray()) {
return 'array';
}
$class = $this->reflector->getClass();
return $class ? sprintf('\\%s ', $class->getName()) : '';
}
if (!$this->reflector->hasType()) {
return '';
}
$type = $this->reflector->getType();
$name = self::getQualifiedName($type);
// PHP 7.1+ supports nullable types via a leading question mark
return (PHP_VERSION_ID >= 70100 && $type->allowsNull()) ? sprintf('?%s ', $name) : sprintf('%s ', $name);
}
/**
* Compute qualified name for the given type.
*
* This function knows how to prefix class names with a leading slash and
* also how to handle PHP 8's union types.
*
* @param ReflectionType $type
*
* @return string
*/
private static function getQualifiedName(ReflectionType $type)
{
// PHP 8 union types can be recursively processed
if ($type instanceof ReflectionUnionType) {
return implode('|', array_map(function (ReflectionType $type) {
// The "self::" call within a Closure is fine here because this
// code will only ever be executed on PHP 7.0+
return self::getQualifiedName($type);
}, $type->getTypes()));
}
// PHP 7.0 doesn't have named types, but 7.1+ does
$name = $type instanceof ReflectionNamedType ? $type->getName() : (string) $type;
return $type->isBuiltin() ? $name : sprintf('\\%s', $name);
}
/**
* Compute the invocation code.
*
* @return string
*/
public function getInvocation()
{
return sprintf('$%s', $this->reflector->getName());
}
/**
* Compute the method name.
*
* @return string
*/
public function getMethod()
{
return $this->method;
}
}
================================================
FILE: generator/GlobalFunctionFile.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
class GlobalFunctionFile extends FactoryFile
{
/**
* @var string containing function definitions
*/
private $functions;
public function __construct($file)
{
parent::__construct($file, ' ');
$this->functions = '';
}
public function addCall(FactoryCall $call)
{
$this->functions .= "\n" . $this->generateFactoryCall($call);
}
public function build()
{
$this->addFileHeader();
$this->addPart('functions_imports');
$this->addPart('functions_header');
$this->addCode($this->functions);
$this->addPart('functions_footer');
}
public function generateFactoryCall(FactoryCall $call)
{
$code = "if (!function_exists('{$call->getName()}')) {\n";
$code.= parent::generateFactoryCall($call);
$code.= "}\n";
return $code;
}
}
================================================
FILE: generator/StaticMethodFile.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
class StaticMethodFile extends FactoryFile
{
/**
* @var string containing method definitions
*/
private $methods;
public function __construct($file)
{
parent::__construct($file, ' ');
$this->methods = '';
}
public function addCall(FactoryCall $call)
{
$this->methods .= PHP_EOL . $this->generateFactoryCall($call);
}
public function getDeclarationModifiers()
{
return 'public static ';
}
public function build()
{
$this->addFileHeader();
$this->addPart('matchers_imports');
$this->addPart('matchers_header');
$this->addCode($this->methods);
$this->addPart('matchers_footer');
}
}
================================================
FILE: generator/parts/file_header.txt
================================================
<?php
/*
Copyright (c) 2009-2010 hamcrest.org
*/
// This file is generated from the static method @factory doctags.
================================================
FILE: generator/parts/functions_footer.txt
================================================
================================================
FILE: generator/parts/functions_header.txt
================================================
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(): void
{
$args = func_get_args();
call_user_func_array(
array('Hamcrest\MatcherAssert', 'assertThat'),
$args
);
}
}
================================================
FILE: generator/parts/functions_imports.txt
================================================
================================================
FILE: generator/parts/matchers_footer.txt
================================================
}
================================================
FILE: generator/parts/matchers_header.txt
================================================
/**
* A series of static factories for all hamcrest matchers.
*/
class Matchers
{
================================================
FILE: generator/parts/matchers_imports.txt
================================================
namespace Hamcrest;
================================================
FILE: generator/run.php
================================================
<?php
/*
Copyright (c) 2009 hamcrest.org
*/
require __DIR__ . '/../vendor/autoload.php';
/*
* Generates the Hamcrest\Matchers factory class and factory functions
* from the @factory doctags in the various matchers.
*/
define('GENERATOR_BASE', __DIR__);
define('HAMCREST_BASE', realpath(dirname(GENERATOR_BASE) . DIRECTORY_SEPARATOR . 'hamcrest'));
define('GLOBAL_FUNCTIONS_FILE', HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest.php');
define('STATIC_MATCHERS_FILE', HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest' . DIRECTORY_SEPARATOR . 'Matchers.php');
set_include_path(
implode(
PATH_SEPARATOR,
array(
GENERATOR_BASE,
HAMCREST_BASE,
get_include_path()
)
)
);
@unlink(GLOBAL_FUNCTIONS_FILE);
@unlink(STATIC_MATCHERS_FILE);
$generator = new FactoryGenerator(HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest');
$generator->addFactoryFile(new StaticMethodFile(STATIC_MATCHERS_FILE));
$generator->addFactoryFile(new GlobalFunctionFile(GLOBAL_FUNCTIONS_FILE));
$generator->generate();
$generator->write();
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArray.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
// NOTE: This class is not exactly a direct port of Java's since Java handles
// arrays quite differently than PHP
// TODO: Allow this to take matchers or values within the array
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* Matcher for array whose elements satisfy a sequence of matchers.
* The array size must equal the number of element matchers.
*/
class IsArray extends TypeSafeMatcher
{
/**
* @var array<Matcher>
*/
private array $_elementMatchers;
/**
* @param array<Matcher> $elementMatchers
*/
public function __construct(array $elementMatchers)
{
parent::__construct(self::TYPE_ARRAY);
Util::checkAllAreMatchers($elementMatchers);
$this->_elementMatchers = $elementMatchers;
}
protected function matchesSafely($array): bool
{
if (array_keys($array) != array_keys($this->_elementMatchers)) {
return false;
}
foreach ($this->_elementMatchers as $k => $matcher) {
if (!$matcher->matches($array[$k])) {
return false;
}
}
return true;
}
protected function describeMismatchSafely($actual, Description $mismatchDescription): void
{
if (count($actual) != count($this->_elementMatchers)) {
$mismatchDescription->appendText('array length was ' . count($actual));
return;
} elseif (array_keys($actual) != array_keys($this->_elementMatchers)) {
$mismatchDescription->appendText('array keys were ')
->appendValueList(
$this->descriptionStart(),
$this->descriptionSeparator(),
$this->descriptionEnd(),
array_keys($actual)
)
;
return;
}
foreach ($this->_elementMatchers as $k => $matcher) {
if (!$matcher->matches($actual[$k])) {
$mismatchDescription->appendText('element ')->appendValue($k)
->appendText(' was ')->appendValue($actual[$k]);
return;
}
}
}
public function describeTo(Description $description): void
{
$description->appendList(
$this->descriptionStart(),
$this->descriptionSeparator(),
$this->descriptionEnd(),
$this->_elementMatchers
);
}
/**
* Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
*
* @factory ...
*/
public static function anArray(/* args... */): self
{
$args = func_get_args();
return new self(Util::createMatcherArray($args));
}
// -- Protected Methods
protected function descriptionStart(): string
{
return '[';
}
protected function descriptionSeparator(): string
{
return ', ';
}
protected function descriptionEnd(): string
{
return ']';
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayContaining.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* Matches if an array contains an item satisfying a nested matcher.
*/
class IsArrayContaining extends TypeSafeMatcher
{
private Matcher $_elementMatcher;
public function __construct(Matcher $elementMatcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_elementMatcher = $elementMatcher;
}
protected function matchesSafely($array): bool
{
foreach ($array as $element) {
if ($this->_elementMatcher->matches($element)) {
return true;
}
}
return false;
}
protected function describeMismatchSafely($array, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendValue($array);
}
public function describeTo(Description $description): void
{
$description
->appendText('an array containing ')
->appendDescriptionOf($this->_elementMatcher)
;
}
/**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
* @factory hasValue
*/
public static function hasItemInArray($item): self
{
return new self(Util::wrapValueWithIsEqual($item));
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeDiagnosingMatcher;
use Hamcrest\Util;
/**
* Matches if an array contains a set of items satisfying nested matchers.
*/
class IsArrayContainingInAnyOrder extends TypeSafeDiagnosingMatcher
{
/**
* @var array<Matcher>
*/
private array $_elementMatchers;
/**
* @param array<Matcher> $elementMatchers
*/
public function __construct(array $elementMatchers)
{
parent::__construct(self::TYPE_ARRAY);
Util::checkAllAreMatchers($elementMatchers);
$this->_elementMatchers = $elementMatchers;
}
protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription): bool
{
$matching = new MatchingOnce($this->_elementMatchers, $mismatchDescription);
foreach ($array as $element) {
if (!$matching->matches($element)) {
return false;
}
}
return $matching->isFinished($array);
}
public function describeTo(Description $description): void
{
$description->appendList('[', ', ', ']', $this->_elementMatchers)
->appendText(' in any order')
;
}
/**
* An array with elements that match the given matchers.
*
* @factory containsInAnyOrder ...
*/
public static function arrayContainingInAnyOrder(/* args... */): self
{
$args = func_get_args();
return new self(Util::createMatcherArray($args));
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeDiagnosingMatcher;
use Hamcrest\Util;
/**
* Matches if an array contains a set of items satisfying nested matchers.
*/
class IsArrayContainingInOrder extends TypeSafeDiagnosingMatcher
{
/**
* @var array<Matcher>
*/
private array $_elementMatchers;
/**
* @param array<Matcher> $elementMatchers
*/
public function __construct(array $elementMatchers)
{
parent::__construct(self::TYPE_ARRAY);
Util::checkAllAreMatchers($elementMatchers);
$this->_elementMatchers = $elementMatchers;
}
protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription): bool
{
$series = new SeriesMatchingOnce($this->_elementMatchers, $mismatchDescription);
foreach ($array as $element) {
if (!$series->matches($element)) {
return false;
}
}
return $series->isFinished();
}
public function describeTo(Description $description): void
{
$description->appendList('[', ', ', ']', $this->_elementMatchers);
}
/**
* An array with elements that match the given matchers in the same order.
*
* @factory contains ...
*/
public static function arrayContaining(/* args... */): self
{
$args = func_get_args();
return new self(Util::createMatcherArray($args));
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* Matches if an array contains the specified key.
*/
class IsArrayContainingKey extends TypeSafeMatcher
{
private Matcher $_keyMatcher;
public function __construct(Matcher $keyMatcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_keyMatcher = $keyMatcher;
}
protected function matchesSafely($array): bool
{
foreach ($array as $key => $element) {
if ($this->_keyMatcher->matches($key)) {
return true;
}
}
return false;
}
protected function describeMismatchSafely($array, Description $mismatchDescription): void
{
//Not using appendValueList() so that keys can be shown
$mismatchDescription->appendText('array was ')
->appendText('[')
;
$loop = false;
foreach ($array as $key => $value) {
if ($loop) {
$mismatchDescription->appendText(', ');
}
$mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value);
$loop = true;
}
$mismatchDescription->appendText(']');
}
public function describeTo(Description $description): void
{
$description
->appendText('array with key ')
->appendDescriptionOf($this->_keyMatcher)
;
}
/**
* Evaluates to true if any key in an array matches the given matcher.
*
* @param mixed $key as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
* @factory hasKey
*/
public static function hasKeyInArray($key): self
{
return new self(Util::wrapValueWithIsEqual($key));
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php
================================================
<?php
namespace Hamcrest\Arrays;
/**
* Tests for the presence of both a key and value inside an array.
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* @namespace
*/
class IsArrayContainingKeyValuePair extends TypeSafeMatcher
{
private Matcher $_keyMatcher;
private Matcher $_valueMatcher;
public function __construct(Matcher $keyMatcher, Matcher $valueMatcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_keyMatcher = $keyMatcher;
$this->_valueMatcher = $valueMatcher;
}
protected function matchesSafely($array): bool
{
foreach ($array as $key => $value) {
if ($this->_keyMatcher->matches($key) && $this->_valueMatcher->matches($value)) {
return true;
}
}
return false;
}
protected function describeMismatchSafely($array, Description $mismatchDescription): void
{
//Not using appendValueList() so that keys can be shown
$mismatchDescription->appendText('array was ')
->appendText('[')
;
$loop = false;
foreach ($array as $key => $value) {
if ($loop) {
$mismatchDescription->appendText(', ');
}
$mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value);
$loop = true;
}
$mismatchDescription->appendText(']');
}
public function describeTo(Description $description): void
{
$description->appendText('array containing [')
->appendDescriptionOf($this->_keyMatcher)
->appendText(' => ')
->appendDescriptionOf($this->_valueMatcher)
->appendText(']')
;
}
/**
* Test if an array has both an key and value in parity with each other.
*
* @factory hasEntry
* @param mixed $key
* @param mixed $value
*/
public static function hasKeyValuePair($key, $value): self
{
return new self(
Util::wrapValueWithIsEqual($key),
Util::wrapValueWithIsEqual($value)
);
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/IsArrayWithSize.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Core\DescribedAs;
use Hamcrest\Core\IsNot;
use Hamcrest\FeatureMatcher;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* Matches if array size satisfies a nested matcher.
*/
class IsArrayWithSize extends FeatureMatcher
{
public function __construct(Matcher $sizeMatcher)
{
parent::__construct(
self::TYPE_ARRAY,
null,
$sizeMatcher,
'an array with size',
'array size'
);
}
protected function featureValueOf($array)
{
return count($array);
}
/**
* Does array size satisfy a given matcher?
*
* @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayWithSize
* @factory
*/
public static function arrayWithSize($size): self
{
return new self(Util::wrapValueWithIsEqual($size));
}
/**
* Matches an empty array.
*
* @factory
*/
public static function emptyArray(): DescribedAs
{
return DescribedAs::describedAs(
'an empty array',
self::arrayWithSize(0)
);
}
/**
* Matches an empty array.
*
* @factory
*/
public static function nonEmptyArray(): DescribedAs
{
return DescribedAs::describedAs(
'a non-empty array',
self::arrayWithSize(IsNot::not(0))
);
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/MatchingOnce.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
class MatchingOnce
{
/**
* @var array<Matcher>
*/
private array $_elementMatchers;
private Description $_mismatchDescription;
/**
* @param array<Matcher> $elementMatchers
*/
public function __construct(array $elementMatchers, Description $mismatchDescription)
{
$this->_elementMatchers = $elementMatchers;
$this->_mismatchDescription = $mismatchDescription;
}
/**
* @param mixed $item
*/
public function matches($item): bool
{
return $this->_isNotSurplus($item) && $this->_isMatched($item);
}
/**
* @param mixed $items
*/
public function isFinished($items): bool
{
if (empty($this->_elementMatchers)) {
return true;
}
$this->_mismatchDescription
->appendText('No item matches: ')->appendList('', ', ', '', $this->_elementMatchers)
->appendText(' in ')->appendValueList('[', ', ', ']', $items)
;
return false;
}
// -- Private Methods
/**
* @param mixed $item
*/
private function _isNotSurplus($item): bool
{
if (empty($this->_elementMatchers)) {
$this->_mismatchDescription->appendText('Not matched: ')->appendValue($item);
return false;
}
return true;
}
/**
* @param mixed $item
*/
private function _isMatched($item): bool
{
foreach ($this->_elementMatchers as $i => $matcher) {
if ($matcher->matches($item)) {
unset($this->_elementMatchers[$i]);
return true;
}
}
$this->_mismatchDescription->appendText('Not matched: ')->appendValue($item);
return false;
}
}
================================================
FILE: hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php
================================================
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
class SeriesMatchingOnce
{
/**
* @var array<Matcher>
*/
private array $_elementMatchers;
/**
* @var list<int|string>
*/
private array $_keys;
private Description $_mismatchDescription;
/**
* @var int|string|null
*/
private $_nextMatchKey;
/**
* @param array<Matcher> $elementMatchers
*/
public function __construct(array $elementMatchers, Description $mismatchDescription)
{
$this->_elementMatchers = $elementMatchers;
$this->_keys = array_keys($elementMatchers);
$this->_mismatchDescription = $mismatchDescription;
}
/**
* @param mixed $item
*/
public function matches($item): bool
{
return $this->_isNotSurplus($item) && $this->_isMatched($item);
}
public function isFinished(): bool
{
if (!empty($this->_elementMatchers)) {
$nextMatcher = current($this->_elementMatchers);
$this->_mismatchDescription->appendText('No item matched: ')->appendDescriptionOf($nextMatcher);
return false;
}
return true;
}
// -- Private Methods
/**
* @param mixed $item
*/
private function _isNotSurplus($item): bool
{
if (empty($this->_elementMatchers)) {
$this->_mismatchDescription->appendText('Not matched: ')->appendValue($item);
return false;
}
return true;
}
/**
* @param mixed $item
*/
private function _isMatched($item): bool
{
$this->_nextMatchKey = array_shift($this->_keys);
$nextMatcher = array_shift($this->_elementMatchers);
if (!$nextMatcher->matches($item)) {
$this->_describeMismatch($nextMatcher, $item);
return false;
}
return true;
}
/**
* @param mixed $item
*/
private function _describeMismatch(Matcher $matcher, $item): void
{
$this->_mismatchDescription->appendText('item with key ' . $this->_nextMatchKey . ': ');
$matcher->describeMismatch($item, $this->_mismatchDescription);
}
}
================================================
FILE: hamcrest/Hamcrest/AssertionError.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
class AssertionError extends \RuntimeException
{
}
================================================
FILE: hamcrest/Hamcrest/BaseDescription.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Internal\SelfDescribingValue;
/**
* A {@link Hamcrest\Description} that is stored as a string.
*/
abstract class BaseDescription implements Description
{
public function appendText(string $text): self
{
$this->append($text);
return $this;
}
public function appendDescriptionOf(SelfDescribing $value)
{
$value->describeTo($this);
return $this;
}
public function appendValue($value): self
{
if (is_null($value)) {
$this->append('null');
} elseif (is_string($value)) {
$this->_toPhpSyntax($value);
} elseif (is_float($value)) {
$this->append('<');
$this->append($value);
$this->append('F>');
} elseif (is_bool($value)) {
$this->append('<');
$this->append($value ? 'true' : 'false');
$this->append('>');
} elseif (is_array($value) || $value instanceof \Iterator || $value instanceof \IteratorAggregate) {
$this->appendValueList('[', ', ', ']', $value);
} elseif (is_object($value) && !method_exists($value, '__toString')) {
$this->append('<');
$this->append(get_class($value));
$this->append('>');
} else {
$this->append('<');
$this->append($value);
$this->append('>');
}
return $this;
}
public function appendValueList(string $start, string $separator, string $end, iterable $values): self
{
$list = array();
foreach ($values as $v) {
$list[] = new SelfDescribingValue($v);
}
$this->appendList($start, $separator, $end, $list);
return $this;
}
public function appendList(string $start, string $separator, string $end, iterable $values): self
{
$this->append($start);
$separate = false;
foreach ($values as $value) {
/*if (!($value instanceof Hamcrest\SelfDescribing)) {
$value = new Hamcrest\Internal\SelfDescribingValue($value);
}*/
if ($separate) {
$this->append($separator);
}
$this->appendDescriptionOf($value);
$separate = true;
}
$this->append($end);
return $this;
}
// -- Protected Methods
/**
* Append the String <var>$str</var> to the description.
* @param mixed $str
*/
abstract protected function append($str): void;
// -- Private Methods
private function _toPhpSyntax(string $value): void
{
$str = '"';
for ($i = 0, $len = strlen($value); $i < $len; ++$i) {
switch ($value[$i]) {
case '"':
$str .= '\\"';
break;
case "\t":
$str .= '\\t';
break;
case "\r":
$str .= '\\r';
break;
case "\n":
$str .= '\\n';
break;
default:
$str .= $value[$i];
}
}
$str .= '"';
$this->append($str);
}
}
================================================
FILE: hamcrest/Hamcrest/BaseMatcher.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* BaseClass for all Matcher implementations.
*
* @see Hamcrest\Matcher
*/
abstract class BaseMatcher implements Matcher
{
/**
* @param mixed $item
*/
public function describeMismatch($item, Description $description): void
{
$description->appendText('was ')->appendValue($item);
}
public function __toString(): string
{
return StringDescription::toString($this);
}
public function __invoke(): bool
{
return call_user_func_array(array($this, 'matches'), func_get_args());
}
}
================================================
FILE: hamcrest/Hamcrest/Collection/IsEmptyTraversable.php
================================================
<?php
namespace Hamcrest\Collection;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Matches if traversable is empty or non-empty.
*/
class IsEmptyTraversable extends BaseMatcher
{
private static ?self $_INSTANCE = null;
private static ?self $_NOT_INSTANCE = null;
private bool $_empty;
public function __construct(bool $empty = true)
{
$this->_empty = $empty;
}
public function matches($item): bool
{
if (!$item instanceof \Traversable) {
return false;
}
foreach ($item as $value) {
return !$this->_empty;
}
return $this->_empty;
}
public function describeTo(Description $description): void
{
$description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable');
}
/**
* Returns true if traversable is empty.
*
* @factory
*/
public static function emptyTraversable(): self
{
if (!self::$_INSTANCE) {
self::$_INSTANCE = new self;
}
return self::$_INSTANCE;
}
/**
* Returns true if traversable is not empty.
*
* @factory
*/
public static function nonEmptyTraversable(): self
{
if (!self::$_NOT_INSTANCE) {
self::$_NOT_INSTANCE = new self(false);
}
return self::$_NOT_INSTANCE;
}
}
================================================
FILE: hamcrest/Hamcrest/Collection/IsTraversableWithSize.php
================================================
<?php
namespace Hamcrest\Collection;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\FeatureMatcher;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* Matches if traversable size satisfies a nested matcher.
*/
class IsTraversableWithSize extends FeatureMatcher
{
public function __construct(Matcher $sizeMatcher)
{
parent::__construct(
self::TYPE_OBJECT,
'Traversable',
$sizeMatcher,
'a traversable with size',
'traversable size'
);
}
protected function featureValueOf($actual)
{
$size = 0;
foreach ($actual as $value) {
$size++;
}
return $size;
}
/**
* Does traversable size satisfy a given matcher?
*
* @factory
* @param mixed $size
*/
public static function traversableWithSize($size): self
{
return new self(Util::wrapValueWithIsEqual($size));
}
}
================================================
FILE: hamcrest/Hamcrest/Core/AllOf.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\DiagnosingMatcher;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* Calculates the logical conjunction of multiple matchers. Evaluation is
* shortcut, so subsequent matchers are not called if an earlier matcher
* returns <code>false</code>.
*/
class AllOf extends DiagnosingMatcher
{
/**
* @var array<Matcher>
*/
private array $_matchers;
/**
* @param array<Matcher> $matchers
*/
public function __construct(array $matchers)
{
Util::checkAllAreMatchers($matchers);
$this->_matchers = $matchers;
}
public function matchesWithDiagnosticDescription($item, Description $mismatchDescription): bool
{
foreach ($this->_matchers as $matcher) {
if (!$matcher->matches($item)) {
$mismatchDescription->appendDescriptionOf($matcher)->appendText(' ');
$matcher->describeMismatch($item, $mismatchDescription);
return false;
}
}
return true;
}
public function describeTo(Description $description): void
{
$description->appendList('(', ' and ', ')', $this->_matchers);
}
/**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*
* @factory ...
*/
public static function allOf(/* args... */): self
{
$args = func_get_args();
return new self(Util::createMatcherArray($args));
}
}
================================================
FILE: hamcrest/Hamcrest/Core/AnyOf.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* Calculates the logical disjunction of multiple matchers. Evaluation is
* shortcut, so subsequent matchers are not called if an earlier matcher
* returns <code>true</code>.
*/
class AnyOf extends ShortcutCombination
{
/**
* @param array<Matcher> $matchers
*/
public function __construct(array $matchers)
{
parent::__construct($matchers);
}
public function matches($item): bool
{
return $this->matchesWithShortcut($item, true);
}
public function describeTo(Description $description): void
{
$this->describeToWithOperator($description, 'or');
}
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*
* @factory ...
*/
public static function anyOf(/* args... */): self
{
$args = func_get_args();
return new self(Util::createMatcherArray($args));
}
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*
* @factory ...
*/
public static function noneOf(/* args... */): IsNot
{
$args = func_get_args();
return IsNot::not(
new self(Util::createMatcherArray($args))
);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/CombinableMatcher.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
use Hamcrest\Matcher;
class CombinableMatcher extends BaseMatcher
{
private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
$this->_matcher = $matcher;
}
public function matches($item): bool
{
return $this->_matcher->matches($item);
}
public function describeTo(Description $description): void
{
$description->appendDescriptionOf($this->_matcher);
}
/** Diversion from Hamcrest-Java... Logical "and" not permitted */
public function andAlso(Matcher $other): self
{
return new self(new AllOf($this->_templatedListWith($other)));
}
/** Diversion from Hamcrest-Java... Logical "or" not permitted */
public function orElse(Matcher $other): self
{
return new self(new AnyOf($this->_templatedListWith($other)));
}
/**
* This is useful for fluently combining matchers that must both pass.
* For example:
* <pre>
* assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
* </pre>
*
* @factory
*/
public static function both(Matcher $matcher): self
{
return new self($matcher);
}
/**
* This is useful for fluently combining matchers where either may pass,
* for example:
* <pre>
* assertThat($string, either(containsString("a"))->orElse(containsString("b")));
* </pre>
*
* @factory
*/
public static function either(Matcher $matcher): self
{
return new self($matcher);
}
// -- Private Methods
/**
* @return list<Matcher>
*/
private function _templatedListWith(Matcher $other): array
{
return array($this->_matcher, $other);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/DescribedAs.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
use Hamcrest\Matcher;
/**
* Provides a custom description to another matcher.
*/
class DescribedAs extends BaseMatcher
{
private string $_descriptionTemplate;
private Matcher $_matcher;
/**
* @var array<mixed>
*/
private array $_values;
private const ARG_PATTERN = '/%([0-9]+)/';
/**
* @param array<mixed> $values
*/
public function __construct(string $descriptionTemplate, Matcher $matcher, array $values)
{
$this->_descriptionTemplate = $descriptionTemplate;
$this->_matcher = $matcher;
$this->_values = $values;
}
public function matches($item): bool
{
return $this->_matcher->matches($item);
}
public function describeTo(Description $description): void
{
$textStart = 0;
while (preg_match(self::ARG_PATTERN, $this->_descriptionTemplate, $matches, PREG_OFFSET_CAPTURE, $textStart)) {
$text = $matches[0][0];
$index = $matches[1][0];
$offset = $matches[0][1];
$description->appendText(substr($this->_descriptionTemplate, $textStart, $offset - $textStart));
$description->appendValue($this->_values[$index]);
$textStart = $offset + strlen($text);
}
if ($textStart < strlen($this->_descriptionTemplate)) {
$description->appendText(substr($this->_descriptionTemplate, $textStart));
}
}
/**
* Wraps an existing matcher and overrides the description when it fails.
*
* @factory ...
*/
public static function describedAs(/* $description, Hamcrest\Matcher $matcher, $values... */): self
{
$args = func_get_args();
$description = array_shift($args);
$matcher = array_shift($args);
$values = $args;
return new self($description, $matcher, $values);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/Every.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeDiagnosingMatcher;
class Every extends TypeSafeDiagnosingMatcher
{
private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_matcher = $matcher;
}
protected function matchesSafelyWithDiagnosticDescription($items, Description $mismatchDescription): bool
{
foreach ($items as $item) {
if (!$this->_matcher->matches($item)) {
$mismatchDescription->appendText('an item ');
$this->_matcher->describeMismatch($item, $mismatchDescription);
return false;
}
}
return true;
}
public function describeTo(Description $description): void
{
$description->appendText('every item is ')->appendDescriptionOf($this->_matcher);
}
/**
* @param \Hamcrest\Matcher $itemMatcher
* A matcher to apply to every element in an array.
*
* @return \Hamcrest\Core\Every
* Evaluates to TRUE for a collection in which every item matches $itemMatcher
*
* @factory
*/
public static function everyItem(Matcher $itemMatcher): self
{
return new self($itemMatcher);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/HasToString.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\FeatureMatcher;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* A Matcher that checks the output of the <code>toString()</code> or <code>__toString()</code> method.
*/
class HasToString extends FeatureMatcher
{
public function __construct(Matcher $toStringMatcher)
{
parent::__construct(
self::TYPE_OBJECT,
null,
$toStringMatcher,
'an object with toString()',
'toString()'
);
}
public function matchesSafelyWithDiagnosticDescription($actual, Description $mismatchDescription): bool
{
if (method_exists($actual, 'toString') || method_exists($actual, '__toString')) {
return parent::matchesSafelyWithDiagnosticDescription($actual, $mismatchDescription);
}
return false;
}
protected function featureValueOf($actual)
{
if (method_exists($actual, 'toString')) {
return $actual->toString();
}
return (string) $actual;
}
/**
* Creates a matcher that matches any examined object whose <code>toString</code> or
* <code>__toString()</code> method returns a value equalTo the specified string.
*
* @factory
* @param mixed $matcher
*/
public static function hasToString($matcher): self
{
return new self(Util::wrapValueWithIsEqual($matcher));
}
}
================================================
FILE: hamcrest/Hamcrest/Core/Is.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* 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)))
*/
class Is extends BaseMatcher
{
private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
$this->_matcher = $matcher;
}
public function matches($arg): bool
{
return $this->_matcher->matches($arg);
}
public function describeTo(Description $description): void
{
$description->appendText('is ')->appendDescriptionOf($this->_matcher);
}
public function describeMismatch($item, Description $mismatchDescription): void
{
$this->_matcher->describeMismatch($item, $mismatchDescription);
}
/**
* 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)))
*
* @factory
* @param mixed $value
*/
public static function is($value): self
{
return new self(Util::wrapValueWithIsEqual($value));
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsAnything.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* A matcher that always returns <code>true</code>.
*/
class IsAnything extends BaseMatcher
{
private string $_message;
public function __construct(string $message = 'ANYTHING')
{
$this->_message = $message;
}
public function matches($item): bool
{
return true;
}
public function describeTo(Description $description): void
{
$description->appendText($this->_message);
}
/**
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
*
* @factory
*/
public static function anything(string $description = 'ANYTHING'): self
{
return new self($description);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsCollectionContaining.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* Tests if an array contains values that match one or more Matchers.
*/
class IsCollectionContaining extends TypeSafeMatcher
{
private Matcher $_elementMatcher;
public function __construct(Matcher $elementMatcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_elementMatcher = $elementMatcher;
}
protected function matchesSafely($items): bool
{
foreach ($items as $item) {
if ($this->_elementMatcher->matches($item)) {
return true;
}
}
return false;
}
protected function describeMismatchSafely($items, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendValue($items);
}
public function describeTo(Description $description): void
{
$description
->appendText('a collection containing ')
->appendDescriptionOf($this->_elementMatcher)
;
}
/**
* 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>
*
* @factory ...
*/
public static function hasItem(): self
{
$args = func_get_args();
$firstArg = array_shift($args);
return new self(Util::wrapValueWithIsEqual($firstArg));
}
/**
* 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>
*
* @factory ...
*/
public static function hasItems(/* args... */): AllOf
{
$args = func_get_args();
$matchers = array();
foreach ($args as $arg) {
$matchers[] = self::hasItem($arg);
}
return AllOf::allOf($matchers);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsEqual.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
*/
class IsEqual extends BaseMatcher
{
/**
* @var mixed
*/
private $_item;
/**
* @param mixed $item
*/
public function __construct($item)
{
$this->_item = $item;
}
public function matches($arg): bool
{
return (($arg == $this->_item) && ($this->_item == $arg));
}
public function describeTo(Description $description): void
{
$description->appendValue($this->_item);
}
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
*
* @factory
* @param mixed $item
*/
public static function equalTo($item): self
{
return new self($item);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsIdentical.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
/**
* The same as {@link Hamcrest\Core\IsSame} but with slightly different
* semantics.
*/
class IsIdentical extends IsSame
{
/**
* @var mixed $_value
*/
private $_value;
/**
* @param mixed $value
*/
public function __construct($value)
{
parent::__construct($value);
$this->_value = $value;
}
public function describeTo(Description $description): void
{
$description->appendValue($this->_value);
}
/**
* Tests of the value is identical to $value as tested by the "===" operator.
*
* @factory
* @param mixed $value
*/
public static function identicalTo($value): self
{
return new self($value);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsInstanceOf.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\DiagnosingMatcher;
/**
* Tests whether the value is an instance of a class.
*/
class IsInstanceOf extends DiagnosingMatcher
{
private string $_theClass;
/**
* Creates a new instance of IsInstanceOf
*
* @param string $theClass
* The predicate evaluates to true for instances of this class
* or one of its subclasses.
*/
public function __construct(string $theClass)
{
$this->_theClass = $theClass;
}
protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription): bool
{
if (!is_object($item)) {
$mismatchDescription->appendText('was ')->appendValue($item);
return false;
}
if (!($item instanceof $this->_theClass)) {
$mismatchDescription->appendText('[' . get_class($item) . '] ')
->appendValue($item);
return false;
}
return true;
}
public function describeTo(Description $description): void
{
$description->appendText('an instance of ')
->appendText($this->_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>
*
* @factory any
*/
public static function anInstanceOf(string $theClass): self
{
return new self($theClass);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsNot.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\Util;
/**
* Calculates the logical negation of a matcher.
*/
class IsNot extends BaseMatcher
{
private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
$this->_matcher = $matcher;
}
public function matches($arg): bool
{
return !$this->_matcher->matches($arg);
}
public function describeTo(Description $description): void
{
$description->appendText('not ')->appendDescriptionOf($this->_matcher);
}
/**
* Matches if value does not match $value.
*
* @factory
* @param mixed $value
*/
public static function not($value): self
{
return new self(Util::wrapValueWithIsEqual($value));
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsNull.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Is the value null?
*/
class IsNull extends BaseMatcher
{
private static ?self $_INSTANCE = null;
private static ?IsNot $_NOT_INSTANCE = null;
public function matches($item): bool
{
return is_null($item);
}
public function describeTo(Description $description): void
{
$description->appendText('null');
}
/**
* Matches if value is null.
*
* @factory
*/
public static function nullValue(): self
{
if (!self::$_INSTANCE) {
self::$_INSTANCE = new self();
}
return self::$_INSTANCE;
}
/**
* Matches if value is not null.
*
* @factory
*/
public static function notNullValue(): IsNot
{
if (!self::$_NOT_INSTANCE) {
self::$_NOT_INSTANCE = IsNot::not(self::nullValue());
}
return self::$_NOT_INSTANCE;
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsSame.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Is the value the same object as another value?
* In PHP terms, does $a === $b?
*/
class IsSame extends BaseMatcher
{
/**
* @var mixed object
*/
private $_object;
/**
* @param mixed $object
*/
public function __construct($object)
{
$this->_object = $object;
}
public function matches($object): bool
{
return ($object === $this->_object) && ($this->_object === $object);
}
public function describeTo(Description $description): void
{
$description->appendText('sameInstance(')
->appendValue($this->_object)
->appendText(')')
;
}
/**
* Creates a new instance of IsSame.
*
* @param mixed $object
* The predicate evaluates to true only when the argument is
* this object.
*
* @return \Hamcrest\Core\IsSame
* @factory
*/
public static function sameInstance($object): self
{
return new self($object);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/IsTypeOf.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Tests whether the value has a built-in type.
*/
class IsTypeOf extends BaseMatcher
{
private string $_theType;
/**
* Creates a new instance of IsTypeOf
*
* @param string $theType
* The predicate evaluates to true for values with this built-in type.
*/
public function __construct(string $theType)
{
$this->_theType = strtolower($theType);
}
public function matches($item): bool
{
return strtolower(gettype($item)) == $this->_theType;
}
public function describeTo(Description $description): void
{
$description->appendText(self::getTypeDescription($this->_theType));
}
public function describeMismatch($item, Description $description): void
{
if ($item === null) {
$description->appendText('was null');
} else {
$description->appendText('was ')
->appendText(self::getTypeDescription(strtolower(gettype($item))))
->appendText(' ')
->appendValue($item)
;
}
}
public static function getTypeDescription(string $type): string
{
if ($type == 'null') {
return 'null';
}
return (strpos('aeiou', substr($type, 0, 1)) === false ? 'a ' : 'an ')
. $type;
}
/**
* Is the value a particular built-in type?
*
* @factory
* @param string $theType
*/
public static function typeOf(string $theType): self
{
return new self($theType);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/Set.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
/**
* Tests if a value (class, object, or array) has a named property.
*
* For example:
* <pre>
* assertThat(array('a', 'b'), set('b'));
* assertThat($foo, set('bar'));
* assertThat('Server', notSet('defaultPort'));
* </pre>
*
* @todo Replace $property with a matcher and iterate all property names.
*/
class Set extends BaseMatcher
{
/**
* @var mixed $_property
*/
private $_property;
private bool $_not;
/**
* @param mixed $property
*/
public function __construct($property, bool $not = false)
{
$this->_property = $property;
$this->_not = $not;
}
public function matches($item): bool
{
if ($item === null) {
return false;
}
$property = $this->_property;
if (is_array($item)) {
$result = isset($item[$property]);
} elseif (is_object($item)) {
$result = isset($item->$property);
} elseif (is_string($item)) {
$result = isset($item::$$property);
} else {
throw new \InvalidArgumentException('Must pass an object, array, or class name');
}
return $this->_not ? !$result : $result;
}
public function describeTo(Description $description): void
{
$description->appendText($this->_not ? 'unset property ' : 'set property ')->appendText($this->_property);
}
public function describeMismatch($item, Description $description): void
{
$value = '';
if (!$this->_not) {
$description->appendText('was not set');
} else {
$property = $this->_property;
if (is_array($item)) {
$value = $item[$property];
} elseif (is_object($item)) {
$value = $item->$property;
} elseif (is_string($item)) {
$value = $item::$$property;
}
parent::describeMismatch($value, $description);
}
}
/**
* Matches if value (class, object, or array) has named $property.
*
* @factory
* @param mixed $property
*/
public static function set($property): self
{
return new self($property);
}
/**
* Matches if value (class, object, or array) does not have named $property.
*
* @factory
* @param mixed $property
*/
public static function notSet($property): self
{
return new self($property, true);
}
}
================================================
FILE: hamcrest/Hamcrest/Core/ShortcutCombination.php
================================================
<?php
namespace Hamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\Util;
abstract class ShortcutCombination extends BaseMatcher
{
/**
* @var array<Matcher>
*/
private $_matchers;
/**
* @param array<Matcher> $matchers
*/
public function __construct(array $matchers)
{
Util::checkAllAreMatchers($matchers);
$this->_matchers = $matchers;
}
/**
* @param mixed $item
*/
protected function matchesWithShortcut($item, bool $shortcut): bool
{
foreach ($this->_matchers as $matcher) {
if ($matcher->matches($item) == $shortcut) {
return $shortcut;
}
}
return !$shortcut;
}
public function describeToWithOperator(Description $description, string $operator): void
{
$description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers);
}
}
================================================
FILE: hamcrest/Hamcrest/Description.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* A description of a Matcher. A Matcher will describe itself to a description
* which can later be used for reporting.
*
* @see Hamcrest\Matcher::describeTo()
*/
interface Description
{
/**
* Appends some plain text to the description.
*
* @param string $text
*
* @return static
*/
public function appendText(string $text): self;
/**
* Appends the description of a {@link Hamcrest\SelfDescribing} value to
* this description.
*
* @param \Hamcrest\SelfDescribing $value
*
* @return static
*/
public function appendDescriptionOf(SelfDescribing $value);
/**
* Appends an arbitrary value to the description.
*
* @param mixed $value
*
* @return static
*/
public function appendValue($value): self;
/**
* Appends a list of values to the description.
*
* @param string $start
* @param string $separator
* @param string $end
* @param iterable<mixed> $values
*
* @return static
*/
public function appendValueList(string $start, string $separator, string $end, iterable $values): self;
/**
* Appends a list of {@link Hamcrest\SelfDescribing} objects to the
* description.
*
* @param string $start
* @param string $separator
* @param string $end
* @param iterable<SelfDescribing> $values
*
* @return static
*/
public function appendList(string $start, string $separator, string $end, iterable $values): self;
}
================================================
FILE: hamcrest/Hamcrest/DiagnosingMatcher.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Official documentation for this class is missing.
*/
abstract class DiagnosingMatcher extends BaseMatcher
{
final public function matches($item): bool
{
return $this->matchesWithDiagnosticDescription($item, new NullDescription());
}
public function describeMismatch($item, Description $mismatchDescription): void
{
$this->matchesWithDiagnosticDescription($item, $mismatchDescription);
}
/**
* @param mixed $item
*/
abstract protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription): bool;
}
================================================
FILE: hamcrest/Hamcrest/FeatureMatcher.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Supporting class for matching a feature of an object. Implement
* <code>featureValueOf()</code> in a subclass to pull out the feature to be
* matched against.
*/
abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher
{
private Matcher $_subMatcher;
private string $_featureDescription;
private string $_featureName;
/**
* Constructor.
*
* @param self::TYPE_* $type
* @param ?string $subtype
* @param \Hamcrest\Matcher $subMatcher The matcher to apply to the feature
* @param string $featureDescription Descriptive text to use in describeTo
* @param string $featureName Identifying text for mismatch message
*/
public function __construct(int $type, ?string $subtype, Matcher $subMatcher, string $featureDescription, string $featureName)
{
parent::__construct($type, $subtype);
$this->_subMatcher = $subMatcher;
$this->_featureDescription = $featureDescription;
$this->_featureName = $featureName;
}
/**
* Implement this to extract the interesting feature.
*
* @param mixed $actual the target object
*
* @return mixed the feature to be matched
*/
abstract protected function featureValueOf($actual);
public function matchesSafelyWithDiagnosticDescription($actual, Description $mismatchDescription): bool
{
$featureValue = $this->featureValueOf($actual);
if (!$this->_subMatcher->matches($featureValue)) {
$mismatchDescription->appendText($this->_featureName)
->appendText(' was ')->appendValue($featureValue);
return false;
}
return true;
}
final public function describeTo(Description $description): void
{
$description->appendText($this->_featureDescription)->appendText(' ')
->appendDescriptionOf($this->_subMatcher)
;
}
}
================================================
FILE: hamcrest/Hamcrest/Internal/SelfDescribingValue.php
================================================
<?php
namespace Hamcrest\Internal;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\SelfDescribing;
/**
* A wrapper around any value so that it describes itself.
*/
class SelfDescribingValue implements SelfDescribing
{
/**
* @var mixed
*/
private $_value;
/**
* @param mixed $value
*/
public function __construct($value)
{
$this->_value = $value;
}
public function describeTo(Description $description): void
{
$description->appendValue($this->_value);
}
}
================================================
FILE: hamcrest/Hamcrest/Matcher.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* A matcher over acceptable values.
* A matcher is able to describe itself to give feedback when it fails.
* <p/>
* Matcher implementations should <b>NOT directly implement this interface</b>.
* Instead, <b>extend</b> the {@link Hamcrest\BaseMatcher} abstract class,
* which will ensure that the Matcher API can grow to support
* new features and remain compatible with all Matcher implementations.
* <p/>
* For easy access to common Matcher implementations, use the static factory
* methods in {@link Hamcrest\CoreMatchers}.
*
* @see Hamcrest\CoreMatchers
* @see Hamcrest\BaseMatcher
*/
interface Matcher extends SelfDescribing
{
/**
* Evaluates the matcher for argument <var>$item</var>.
*
* @param mixed $item the object against which the matcher is evaluated.
*
* @return boolean <code>true</code> if <var>$item</var> matches,
* otherwise <code>false</code>.
*
* @see Hamcrest\BaseMatcher
*/
public function matches($item): bool;
/**
* Generate a description of why the matcher has not accepted the item.
* The description will be part of a larger description of why a matching
* failed, so it should be concise.
* This method assumes that <code>matches($item)</code> is false, but
* will not check this.
*
* @param mixed $item The item that the Matcher has rejected.
* @param Description $description
* @return void
*/
public function describeMismatch($item, Description $description): void;
}
================================================
FILE: hamcrest/Hamcrest/MatcherAssert.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
class MatcherAssert
{
/**
* Number of assertions performed.
*
* @var int
*/
private static int $_count = 0;
/**
* Make an assertion and throw {@link Hamcrest\AssertionError} if it fails.
*
* The first parameter may optionally be a string identifying the assertion
* to be included in the failure message.
*
* If the third parameter is not a matcher it is passed to
* {@link Hamcrest\Core\IsEqual#equalTo} to create one.
*
* Example:
* <pre>
* // With an identifier
* assertThat("apple flavour", $apple->flavour(), equalTo("tasty"));
* // Without an identifier
* assertThat($apple->flavour(), equalTo("tasty"));
* // Evaluating a boolean expression
* assertThat("some error", $a > $b);
* assertThat($a > $b);
* </pre>
*/
public static function assertThat(/* $args ... */): void
{
$args = func_get_args();
switch (count($args)) {
case 1:
self::$_count++;
if (!$args[0]) {
throw new AssertionError();
}
break;
case 2:
self::$_count++;
if ($args[1] instanceof Matcher) {
self::doAssert('', $args[0], $args[1]);
} elseif (!$args[1]) {
throw new AssertionError($args[0]);
}
break;
case 3:
self::$_count++;
self::doAssert(
$args[0],
$args[1],
Util::wrapValueWithIsEqual($args[2])
);
break;
default:
throw new \InvalidArgumentException('assertThat() requires one to three arguments');
}
}
/**
* Returns the number of assertions performed.
*
* @return int
*/
public static function getCount(): int
{
return self::$_count;
}
/**
* Resets the number of assertions performed to zero.
*/
public static function resetCount(): void
{
self::$_count = 0;
}
/**
* Performs the actual assertion logic.
*
* If <code>$matcher</code> doesn't match <code>$actual</code>,
* throws a {@link Hamcrest\AssertionError} with a description
* of the failure along with the optional <code>$identifier</code>.
*
* @param string $identifier added to the message upon failure
* @param mixed $actual value to compare against <code>$matcher</code>
* @param \Hamcrest\Matcher $matcher applied to <code>$actual</code>
* @throws AssertionError
*/
private static function doAssert($identifier, $actual, Matcher $matcher): void
{
if (!$matcher->matches($actual)) {
$description = new StringDescription();
if (!empty($identifier)) {
$description->appendText($identifier . PHP_EOL);
}
$description->appendText('Expected: ')
->appendDescriptionOf($matcher)
->appendText(PHP_EOL . ' but: ');
$matcher->describeMismatch($actual, $description);
throw new AssertionError((string) $description);
}
}
}
================================================
FILE: hamcrest/Hamcrest/Matchers.php
================================================
<?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... */): \Hamcrest\Arrays\IsArray
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args);
}
/**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
public static function hasItemInArray($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
}
/**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
public static function hasValue($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
}
/**
* An array with elements that match the given matchers.
*/
public static function arrayContainingInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
/**
* An array with elements that match the given matchers.
*/
public static function containsInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
/**
* An array with elements that match the given matchers in the same order.
*/
public static function arrayContaining(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
}
/**
* An array with elements that match the given matchers in the same order.
*/
public static function contains(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
}
/**
* Evaluates to true if any key in an array matches the given matcher.
*
* @param mixed $key as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
public static function hasKeyInArray($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
}
/**
* Evaluates to true if any key in an array matches the given matcher.
*
* @param mixed $key as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
public static function hasKey($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
}
/**
* Test if an array has both an key and value in parity with each other.
*
* @param mixed $key
* @param mixed $value
*/
public static function hasKeyValuePair($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
/**
* Test if an array has both an key and value in parity with each other.
*
* @param mixed $key
* @param mixed $value
*/
public static function hasEntry($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
/**
* Does array size satisfy a given matcher?
*
* @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayWithSize
*/
public static function arrayWithSize($size): \Hamcrest\Arrays\IsArrayWithSize
{
return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size);
}
/**
* Matches an empty array.
*/
public static function emptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::emptyArray();
}
/**
* Matches an empty array.
*/
public static function nonEmptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray();
}
/**
* Returns true if traversable is empty.
*/
public static function emptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable();
}
/**
* Returns true if traversable is not empty.
*/
public static function nonEmptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable();
}
/**
* Does traversable size satisfy a given matcher?
*
* @param mixed $size
*/
public static function traversableWithSize($size): \Hamcrest\Collection\IsTraversableWithSize
{
return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size);
}
/**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*/
public static function allOf(/* args... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
}
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*/
public static function anyOf(/* args... */): \Hamcrest\Core\AnyOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
}
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*/
public static function noneOf(/* args... */): \Hamcrest\Core\IsNot
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', '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(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::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(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::either($matcher);
}
/**
* Wraps an existing matcher and overrides the description when it fails.
*/
public static function describedAs(/* args... */): \Hamcrest\Core\DescribedAs
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
}
/**
* @param \Hamcrest\Matcher $itemMatcher
* A matcher to apply to every element in an array.
*
* @return \Hamcrest\Core\Every
* Evaluates to TRUE for a collection in which every item matches $itemMatcher
*/
public static function everyItem(\Hamcrest\Matcher $itemMatcher): \Hamcrest\Core\Every
{
return \Hamcrest\Core\Every::everyItem($itemMatcher);
}
/**
* Creates a matcher that matches any examined object whose <code>toString</code> or
* <code>__toString()</code> method returns a value equalTo the specified string.
*
* @param mixed $matcher
*/
public static function hasToString($matcher): \Hamcrest\Core\HasToString
{
return \Hamcrest\Core\HasToString::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)))
*
* @param mixed $value
*/
public static function is($value): \Hamcrest\Core\Is
{
return \Hamcrest\Core\Is::is($value);
}
/**
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
*/
public static function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
return \Hamcrest\Core\IsAnything::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... */): \Hamcrest\Core\IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', '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... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
}
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
*
* @param mixed $item
*/
public static function equalTo($item): \Hamcrest\Core\IsEqual
{
return \Hamcrest\Core\IsEqual::equalTo($item);
}
/**
* Tests of the value is identical to $value as tested by the "===" operator.
*
* @param mixed $value
*/
public static function identicalTo($value): \Hamcrest\Core\IsIdentical
{
return \Hamcrest\Core\IsIdentical::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(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::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(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
/**
* Matches if value does not match $value.
*
* @param mixed $value
*/
public static function not($value): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNot::not($value);
}
/**
* Matches if value is null.
*/
public static function nullValue(): \Hamcrest\Core\IsNull
{
return \Hamcrest\Core\IsNull::nullValue();
}
/**
* Matches if value is not null.
*/
public static function notNullValue(): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNull::notNullValue();
}
/**
* Creates a new instance of IsSame.
*
* @param mixed $object
* The predicate evaluates to true only when the argument is
* this object.
*
* @return \Hamcrest\Core\IsSame
*/
public static function sameInstance($object): \Hamcrest\Core\IsSame
{
return \Hamcrest\Core\IsSame::sameInstance($object);
}
/**
* Is the value a particular built-in type?
*
* @param string $theType
*/
public static function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
return \Hamcrest\Core\IsTypeOf::typeOf($theType);
}
/**
* Matches if value (class, object, or array) has named $property.
*
* @param mixed $property
*/
public static function set($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::set($property);
}
/**
* Matches if value (class, object, or array) does not have named $property.
*
* @param mixed $property
*/
public static function notSet($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::notSet($property);
}
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
*
* @param mixed $value
* @param mixed $delta
*/
public static function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
{
return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
}
/**
* The value is not > $value, nor < $value.
*
* @param mixed $value
*/
public static function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
}
/**
* The value is > $value.
*
* @param mixed $value
*/
public static function greaterThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThan($value);
}
/**
* The value is >= $value.
*
* @param mixed $value
*/
public static function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
/**
* The value is >= $value.
*
* @param mixed $value
*/
public static function atLeast($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
/**
* The value is < $value.
*
* @param mixed $value
*/
public static function lessThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThan($value);
}
/**
* The value is <= $value.
*
* @param mixed $value
*/
public static function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
/**
* The value is <= $value.
*
* @param mixed $value
*/
public static function atMost($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
/**
* Matches if value is a zero-length string.
*/
public static function isEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
/**
* Matches if value is a zero-length string.
*/
public static function emptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
/**
* Matches if value is null or a zero-length string.
*/
public static function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
/**
* Matches if value is null or a zero-length string.
*/
public static function nullOrEmptyString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
/**
* Matches if value is a non-zero-length string.
*/
public static function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
/**
* Matches if value is a non-zero-length string.
*/
public static function nonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
/**
* Matches if value is a string equal to $string, regardless of the case.
*
* @param mixed $string
*/
public static function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
{
return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
}
/**
* Matches if value is a string equal to $string, regardless of whitespace.
*
* @param mixed $string
*/
public static function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
{
return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
}
/**
* Matches if value is a string that matches regular expression $pattern.
*
* @param mixed $pattern
*/
public static function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
{
return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
}
/**
* Matches if value is a string that contains $substring.
*
* @param mixed $substring
*/
public static function containsString($substring): \Hamcrest\Text\StringContains
{
return \Hamcrest\Text\StringContains::containsString($substring);
}
/**
* Matches if value is a string that contains $substring regardless of the case.
*
* @param mixed $substring
*/
public static function containsStringIgnoringCase($substring): \Hamcrest\Text\StringContainsIgnoringCase
{
return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring);
}
/**
* Matches if value contains $substrings in a constrained order.
*/
public static function stringContainsInOrder(/* args... */): \Hamcrest\Text\StringContainsInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
}
/**
* Matches if value is a string that ends with $substring.
*
* @param mixed $substring
*/
public static function endsWith($substring): \Hamcrest\Text\StringEndsWith
{
return \Hamcrest\Text\StringEndsWith::endsWith($substring);
}
/**
* Matches if value is a string that starts with $substring.
*
* @param mixed $substring
*/
public static function startsWith($substring): \Hamcrest\Text\StringStartsWith
{
return \Hamcrest\Text\StringStartsWith::startsWith($substring);
}
/**
* Is the value an array?
*/
public static function arrayValue(): \Hamcrest\Type\IsArray
{
return \Hamcrest\Type\IsArray::arrayValue();
}
/**
* Is the value a boolean?
*/
public static function booleanValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
/**
* Is the value a boolean?
*/
public static function boolValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
/**
* Is the value callable?
*/
public static function callableValue(): \Hamcrest\Type\IsCallable
{
return \Hamcrest\Type\IsCallable::callableValue();
}
/**
* Is the value a float/double?
*/
public static function doubleValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
/**
* Is the value a float/double?
*/
public static function floatValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
/**
* Is the value an integer?
*/
public static function integerValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
/**
* Is the value an integer?
*/
public static function intValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
/**
* Is the value a numeric?
*/
public static function numericValue(): \Hamcrest\Type\IsNumeric
{
return \Hamcrest\Type\IsNumeric::numericValue();
}
/**
* Is the value an object?
*/
public static function objectValue(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
/**
* Is the value an object?
*/
public static function anObject(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
/**
* Is the value a resource?
*/
public static function resourceValue(): \Hamcrest\Type\IsResource
{
return \Hamcrest\Type\IsResource::resourceValue();
}
/**
* Is the value a scalar (boolean, integer, double, or string)?
*/
public static function scalarValue(): \Hamcrest\Type\IsScalar
{
return \Hamcrest\Type\IsScalar::scalarValue();
}
/**
* Is the value a string?
*/
public static function stringValue(): \Hamcrest\Type\IsString
{
return \Hamcrest\Type\IsString::stringValue();
}
/**
* Wraps <code>$matcher</code> with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in <code>count()</code>
* if it's an integer.
*
* @param string $xpath
* @param null|Matcher|int|mixed $matcher
*/
public static function hasXPath(string $xpath, $matcher = null): \Hamcrest\Xml\HasXPath
{
return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
}
}
================================================
FILE: hamcrest/Hamcrest/NullDescription.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Null implementation of {@link Hamcrest\Description}.
*/
class NullDescription implements Description
{
public function appendText(string $text): self
{
return $this;
}
public function appendDescriptionOf(SelfDescribing $value): self
{
return $this;
}
public function appendValue($value): self
{
return $this;
}
public function appendValueList(string $start, string $separator, string $end, $values): self
{
return $this;
}
public function appendList(string $start, string $separator, string $end, $values): self
{
return $this;
}
public function __toString()
{
return '';
}
}
================================================
FILE: hamcrest/Hamcrest/Number/IsCloseTo.php
================================================
<?php
namespace Hamcrest\Number;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
/**
* Is the value a number equal to a value within some range of
* acceptable error?
*/
class IsCloseTo extends TypeSafeMatcher
{
/**
* @var mixed
*/
private $_value;
/**
* @var mixed
*/
private $_delta;
/**
* @param mixed $value
* @param mixed $delta
*/
public function __construct($value, $delta)
{
parent::__construct(self::TYPE_NUMERIC);
$this->_value = $value;
$this->_delta = $delta;
}
protected function matchesSafely($item): bool
{
return $this->_actualDelta($item) <= 0.0;
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendValue($item)
->appendText(' differed by ')
->appendValue($this->_actualDelta($item))
;
}
public function describeTo(Description $description): void
{
$description->appendText('a numeric value within ')
->appendValue($this->_delta)
->appendText(' of ')
->appendValue($this->_value)
;
}
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
*
* @factory
* @param mixed $value
* @param mixed $delta
*/
public static function closeTo($value, $delta): self
{
return new self($value, $delta);
}
// -- Private Methods
/**
* @param mixed $item
* @return int|float
*/
private function _actualDelta($item)
{
return (abs(($item - $this->_value)) - $this->_delta);
}
}
================================================
FILE: hamcrest/Hamcrest/Number/OrderingComparison.php
================================================
<?php
namespace Hamcrest\Number;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
class OrderingComparison extends TypeSafeMatcher
{
/**
* @var mixed
*/
private $_value;
/**
* @var mixed
*/
private $_minCompare;
/**
* @var mixed
*/
private $_maxCompare;
/**
* @param mixed $value
* @param mixed $maxCompare
* @param mixed $minCompare
*/
public function __construct($value, $minCompare, $maxCompare)
{
parent::__construct(self::TYPE_NUMERIC);
$this->_value = $value;
$this->_minCompare = $minCompare;
$this->_maxCompare = $maxCompare;
}
protected function matchesSafely($other): bool
{
$compare = $this->_compare($this->_value, $other);
return ($this->_minCompare <= $compare) && ($compare <= $this->_maxCompare);
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription
->appendValue($item)->appendText(' was ')
->appendText($this->_comparison($this->_compare($this->_value, $item)))
->appendText(' ')->appendValue($this->_value)
;
}
public function describeTo(Description $description): void
{
$description->appendText('a value ')
->appendText($this->_comparison($this->_minCompare))
;
if ($this->_minCompare != $this->_maxCompare) {
$description->appendText(' or ')
->appendText($this->_comparison($this->_maxCompare))
;
}
$description->appendText(' ')->appendValue($this->_value);
}
/**
* The value is not > $value, nor < $value.
*
* @factory
* @param mixed $value
*/
public static function comparesEqualTo($value): self
{
return new self($value, 0, 0);
}
/**
* The value is > $value.
*
* @factory
* @param mixed $value
*/
public static function greaterThan($value): self
{
return new self($value, -1, -1);
}
/**
* The value is >= $value.
*
* @factory atLeast
* @param mixed $value
*/
public static function greaterThanOrEqualTo($value): self
{
return new self($value, -1, 0);
}
/**
* The value is < $value.
*
* @factory
* @param mixed $value
*/
public static function lessThan($value): self
{
return new self($value, 1, 1);
}
/**
* The value is <= $value.
*
* @factory atMost
* @param mixed $value
*/
public static function lessThanOrEqualTo($value): self
{
return new self($value, 0, 1);
}
// -- Private Methods
/**
* @param mixed $left
* @param mixed $right
*/
private function _compare($left, $right): int
{
$a = $left;
$b = $right;
if ($a < $b) {
return -1;
} elseif ($a == $b) {
return 0;
} else {
return 1;
}
}
/**
* @param mixed $compare
*/
private function _comparison($compare): string
{
if ($compare > 0) {
return 'less than';
} elseif ($compare == 0) {
return 'equal to';
} else {
return 'greater than';
}
}
}
================================================
FILE: hamcrest/Hamcrest/SelfDescribing.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* The ability of an object to describe itself.
*/
interface SelfDescribing
{
/**
* Generates a description of the object. The description may be part
* of a description of a larger object of which this is just a component,
* so it should be worded appropriately.
*
* @param \Hamcrest\Description $description
* The description to be built or appended to.
*/
public function describeTo(Description $description): void;
}
================================================
FILE: hamcrest/Hamcrest/StringDescription.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* A {@link Hamcrest\Description} that is stored as a string.
*/
class StringDescription extends BaseDescription
{
private string $_out;
/**
* @param mixed $out
*/
public function __construct($out = '')
{
$this->_out = (string) $out;
}
public function __toString()
{
return $this->_out;
}
/**
* Return the description of a {@link Hamcrest\SelfDescribing} object as a
* String.
*
* @param \Hamcrest\SelfDescribing $selfDescribing
* The object to be described.
*
* @return string
* The description of the object.
*/
public static function toString(SelfDescribing $selfDescribing): string
{
$self = new self();
return (string) $self->appendDescriptionOf($selfDescribing);
}
/**
* Alias for {@link toString()}.
*/
public static function asString(SelfDescribing $selfDescribing): string
{
return self::toString($selfDescribing);
}
// -- Protected Methods
protected function append($str): void
{
$this->_out .= $str;
}
}
================================================
FILE: hamcrest/Hamcrest/Text/IsEmptyString.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\BaseMatcher;
use Hamcrest\Core\AnyOf;
use Hamcrest\Core\IsNull;
use Hamcrest\Description;
/**
* Matches empty Strings (and null).
*/
class IsEmptyString extends BaseMatcher
{
private static ?self $_INSTANCE = null;
private static ?AnyOf $_NULL_OR_EMPTY_INSTANCE = null;
private static ?self $_NOT_INSTANCE = null;
private bool $_empty;
public function __construct(bool $empty = true)
{
$this->_empty = $empty;
}
public function matches($item): bool
{
return $this->_empty
? ($item === '')
: is_string($item) && $item !== '';
}
public function describeTo(Description $description): void
{
$description->appendText($this->_empty ? 'an empty string' : 'a non-empty string');
}
/**
* Matches if value is a zero-length string.
*
* @factory emptyString
*/
public static function isEmptyString(): self
{
if (!self::$_INSTANCE) {
self::$_INSTANCE = new self(true);
}
return self::$_INSTANCE;
}
/**
* Matches if value is null or a zero-length string.
*
* @factory nullOrEmptyString
*/
public static function isEmptyOrNullString(): AnyOf
{
if (!self::$_NULL_OR_EMPTY_INSTANCE) {
self::$_NULL_OR_EMPTY_INSTANCE = AnyOf::anyOf(
IsNull::nullvalue(),
self::isEmptyString()
);
}
return self::$_NULL_OR_EMPTY_INSTANCE;
}
/**
* Matches if value is a non-zero-length string.
*
* @factory nonEmptyString
*/
public static function isNonEmptyString(): self
{
if (!self::$_NOT_INSTANCE) {
self::$_NOT_INSTANCE = new self(false);
}
return self::$_NOT_INSTANCE;
}
}
================================================
FILE: hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
/**
* Tests if a string is equal to another string, regardless of the case.
*/
class IsEqualIgnoringCase extends TypeSafeMatcher
{
/**
* @var mixed
*/
private $_string;
/**
* @param mixed $string
*/
public function __construct($string)
{
parent::__construct(self::TYPE_STRING);
$this->_string = $string;
}
protected function matchesSafely($item): bool
{
return strtolower($this->_string) === strtolower($item);
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendText($item);
}
public function describeTo(Description $description): void
{
$description->appendText('equalToIgnoringCase(')
->appendValue($this->_string)
->appendText(')')
;
}
/**
* Matches if value is a string equal to $string, regardless of the case.
*
* @factory
* @param mixed $string
*/
public static function equalToIgnoringCase($string): self
{
return new self($string);
}
}
================================================
FILE: hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
/**
* Tests if a string is equal to another string, ignoring any changes in
* whitespace.
*/
class IsEqualIgnoringWhiteSpace extends TypeSafeMatcher
{
/**
* @var mixed
*/
private $_string;
/**
* @param mixed $string
*/
public function __construct($string)
{
parent::__construct(self::TYPE_STRING);
$this->_string = $string;
}
protected function matchesSafely($item): bool
{
return (strtolower($this->_stripSpace($item))
=== strtolower($this->_stripSpace($this->_string)));
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendText($item);
}
public function describeTo(Description $description): void
{
$description->appendText('equalToIgnoringWhiteSpace(')
->appendValue($this->_string)
->appendText(')')
;
}
/**
* Matches if value is a string equal to $string, regardless of whitespace.
*
* @factory
* @param mixed $string
*/
public static function equalToIgnoringWhiteSpace($string): self
{
return new self($string);
}
// -- Private Methods
private function _stripSpace(string $string): string
{
$parts = preg_split("/[\r\n\t ]+/", $string);
foreach ($parts as $i => $part) {
$parts[$i] = trim($part, " \r\n\t");
}
return trim(implode(' ', $parts), " \r\n\t");
}
}
================================================
FILE: hamcrest/Hamcrest/Text/MatchesPattern.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2010 hamcrest.org
*/
/**
* Tests if the argument is a string that matches a regular expression.
*/
class MatchesPattern extends SubstringMatcher
{
/**
* @param mixed $pattern
*/
public function __construct($pattern)
{
parent::__construct($pattern);
}
/**
* Matches if value is a string that matches regular expression $pattern.
*
* @factory
* @param mixed $pattern
*/
public static function matchesPattern($pattern): self
{
return new self($pattern);
}
// -- Protected Methods
protected function evalSubstringOf(string $item): bool
{
return preg_match($this->_substring, (string) $item) >= 1;
}
protected function relationship(): string
{
return 'matching';
}
}
================================================
FILE: hamcrest/Hamcrest/Text/StringContains.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Tests if the argument is a string that contains a substring.
*/
class StringContains extends SubstringMatcher
{
/**
* @param mixed $substring
*/
public function __construct($substring)
{
parent::__construct($substring);
}
public function ignoringCase(): StringContainsIgnoringCase
{
return new StringContainsIgnoringCase($this->_substring);
}
/**
* Matches if value is a string that contains $substring.
*
* @factory
* @param mixed $substring
*/
public static function containsString($substring): self
{
return new self($substring);
}
// -- Protected Methods
protected function evalSubstringOf(string $item): bool
{
return (false !== strpos((string) $item, $this->_substring));
}
protected function relationship(): string
{
return 'containing';
}
}
================================================
FILE: hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2010 hamcrest.org
*/
/**
* Tests if the argument is a string that contains a substring ignoring case.
*/
class StringContainsIgnoringCase extends SubstringMatcher
{
/**
* @param mixed $substring
*/
public function __construct($substring)
{
parent::__construct($substring);
}
/**
* Matches if value is a string that contains $substring regardless of the case.
*
* @factory
* @param mixed $substring
*/
public static function containsStringIgnoringCase($substring): self
{
return new self($substring);
}
// -- Protected Methods
protected function evalSubstringOf(string $item): bool
{
return (false !== stripos((string) $item, $this->_substring));
}
protected function relationship(): string
{
return 'containing in any case';
}
}
================================================
FILE: hamcrest/Hamcrest/Text/StringContainsInOrder.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
/**
* Tests if the value contains a series of substrings in a constrained order.
*/
class StringContainsInOrder extends TypeSafeMatcher
{
/**
* @var array<string>
*/
private array $_substrings;
/**
* @param array<string> $substrings
*/
public function __construct(array $substrings)
{
parent::__construct(self::TYPE_STRING);
$this->_substrings = $substrings;
}
protected function matchesSafely($item): bool
{
$fromIndex = 0;
foreach ($this->_substrings as $substring) {
if (false === $fromIndex = strpos($item, $substring, $fromIndex)) {
return false;
}
}
return true;
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendText($item);
}
public function describeTo(Description $description): void
{
$description->appendText('a string containing ')
->appendValueList('', ', ', '', $this->_substrings)
->appendText(' in order')
;
}
/**
* Matches if value contains $substrings in a constrained order.
*
* @factory ...
*/
public static function stringContainsInOrder(/* args... */): self
{
$args = func_get_args();
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
}
return new self($args);
}
}
================================================
FILE: hamcrest/Hamcrest/Text/StringEndsWith.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Tests if the argument is a string that ends with a substring.
*/
class StringEndsWith extends SubstringMatcher
{
/**
* @param mixed $substring
*/
public function __construct($substring)
{
parent::__construct($substring);
}
/**
* Matches if value is a string that ends with $substring.
*
* @factory
* @param mixed $substring
*/
public static function endsWith($substring): self
{
return new self($substring);
}
// -- Protected Methods
protected function evalSubstringOf(string $string): bool
{
return (substr($string, (-1 * strlen($this->_substring))) === $this->_substring);
}
protected function relationship(): string
{
return 'ending with';
}
}
================================================
FILE: hamcrest/Hamcrest/Text/StringStartsWith.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
/**
* Tests if the argument is a string that contains a substring.
*/
class StringStartsWith extends SubstringMatcher
{
/**
* @param mixed $substring
*/
public function __construct($substring)
{
parent::__construct($substring);
}
/**
* Matches if value is a string that starts with $substring.
*
* @factory
* @param mixed $substring
*/
public static function startsWith($substring): self
{
return new self($substring);
}
// -- Protected Methods
protected function evalSubstringOf(string $string): bool
{
return (substr($string, 0, strlen($this->_substring)) === $this->_substring);
}
protected function relationship(): string
{
return 'starting with';
}
}
================================================
FILE: hamcrest/Hamcrest/Text/SubstringMatcher.php
================================================
<?php
namespace Hamcrest\Text;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;
abstract class SubstringMatcher extends TypeSafeMatcher
{
/**
* @var mixed
*/
protected $_substring;
/**
* @param mixed $substring
*/
public function __construct($substring)
{
parent::__construct(self::TYPE_STRING);
$this->_substring = $substring;
}
protected function matchesSafely($item): bool
{
return $this->evalSubstringOf($item);
}
protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was "')->appendText($item)->appendText('"');
}
public function describeTo(Description $description): void
{
$description->appendText('a string ')
->appendText($this->relationship())
->appendText(' ')
->appendValue($this->_substring)
;
}
abstract protected function evalSubstringOf(string $string): bool;
abstract protected function relationship(): string;
}
================================================
FILE: hamcrest/Hamcrest/Type/IsArray.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is an array.
*/
class IsArray extends IsTypeOf
{
/**
* Creates a new instance of IsArray
*/
public function __construct()
{
parent::__construct('array');
}
/**
* Is the value an array?
*
* @factory
*/
public static function arrayValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsBoolean.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is a boolean.
*/
class IsBoolean extends IsTypeOf
{
/**
* Creates a new instance of IsBoolean
*/
public function __construct()
{
parent::__construct('boolean');
}
/**
* Is the value a boolean?
*
* @factory boolValue
*/
public static function booleanValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsCallable.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is callable.
*/
class IsCallable extends IsTypeOf
{
/**
* Creates a new instance of IsCallable
*/
public function __construct()
{
parent::__construct('callable');
}
public function matches($item): bool
{
return is_callable($item);
}
/**
* Is the value callable?
*
* @factory
*/
public static function callableValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsDouble.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is a float/double.
*
* PHP returns "double" for values of type "float".
*/
class IsDouble extends IsTypeOf
{
/**
* Creates a new instance of IsDouble
*/
public function __construct()
{
parent::__construct('double');
}
/**
* Is the value a float/double?
*
* @factory floatValue
*/
public static function doubleValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsInteger.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is an integer.
*/
class IsInteger extends IsTypeOf
{
/**
* Creates a new instance of IsInteger
*/
public function __construct()
{
parent::__construct('integer');
}
/**
* Is the value an integer?
*
* @factory intValue
*/
public static function integerValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsNumeric.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is numeric.
*/
class IsNumeric extends IsTypeOf
{
public function __construct()
{
parent::__construct('number');
}
public function matches($item): bool
{
if ($this->isHexadecimal($item)) {
return true;
}
return is_numeric($item);
}
/**
* Return if the string passed is a valid hexadecimal number.
* This check is necessary because PHP 7 doesn't recognize hexadecimal string as numeric anymore.
*
* @param mixed $item
* @return boolean
*/
private function isHexadecimal($item)
{
if (is_string($item) && preg_match('/^0x(.*)$/', $item, $matches)) {
return ctype_xdigit($matches[1]);
}
return false;
}
/**
* Is the value a numeric?
*
* @factory
*/
public static function numericValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsObject.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is an object.
*/
class IsObject extends IsTypeOf
{
/**
* Creates a new instance of IsObject
*/
public function __construct()
{
parent::__construct('object');
}
/**
* Is the value an object?
*
* @factory anObject
*/
public static function objectValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsResource.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is a resource.
*/
class IsResource extends IsTypeOf
{
/**
* Creates a new instance of IsResource
*/
public function __construct()
{
parent::__construct('resource');
}
/**
* Is the value a resource?
*
* @factory
*/
public static function resourceValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsScalar.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is a scalar (boolean, integer, double, or string).
*/
class IsScalar extends IsTypeOf
{
public function __construct()
{
parent::__construct('scalar');
}
public function matches($item): bool
{
return is_scalar($item);
}
/**
* Is the value a scalar (boolean, integer, double, or string)?
*
* @factory
*/
public static function scalarValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/Type/IsString.php
================================================
<?php
namespace Hamcrest\Type;
/*
Copyright (c) 2010 hamcrest.org
*/
use Hamcrest\Core\IsTypeOf;
/**
* Tests whether the value is a string.
*/
class IsString extends IsTypeOf
{
/**
* Creates a new instance of IsString
*/
public function __construct()
{
parent::__construct('string');
}
/**
* Is the value a string?
*
* @factory
*/
public static function stringValue(): self
{
return new self;
}
}
================================================
FILE: hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php
================================================
<?php
namespace Hamcrest;
/**
* Convenient base class for Matchers that require a value of a specific type.
* This simply checks the type and then casts.
*/
abstract class TypeSafeDiagnosingMatcher extends TypeSafeMatcher
{
final public function matchesSafely($actual): bool
{
return $this->matchesSafelyWithDiagnosticDescription($actual, new NullDescription());
}
final public function describeMismatchSafely($actual, Description $mismatchDescription): void
{
$this->matchesSafelyWithDiagnosticDescription($actual, $mismatchDescription);
}
// -- Protected Methods
/**
* Subclasses should implement these. The item will already have been checked for
* the specific type.
* @param mixed $actual
*/
abstract protected function matchesSafelyWithDiagnosticDescription($actual, Description $mismatchDescription): bool;
}
================================================
FILE: hamcrest/Hamcrest/TypeSafeMatcher.php
================================================
<?php
namespace Hamcrest;
/**
* Convenient base class for Matchers that require a value of a specific type.
* This simply checks the type.
*
* While it may seem a useless exercise to have this in PHP, objects cannot
* be cast to certain data types such as numerics (or even strings if
* __toString() has not be defined).
*/
abstract class TypeSafeMatcher extends BaseMatcher
{
/* Types that PHP can compare against */
protected const TYPE_ANY = 0;
protected const TYPE_STRING = 1;
protected const TYPE_NUMERIC = 2;
protected const TYPE_ARRAY = 3;
protected const TYPE_OBJECT = 4;
protected const TYPE_RESOURCE = 5;
protected const TYPE_BOOLEAN = 6;
/**
* The type that is required for a safe comparison
*
* @var int
*/
private int $_expectedType;
/**
* The subtype (e.g. class for objects) that is required
*
* @var string
*/
private ?string $_expectedSubtype;
/**
* @param self::TYPE_* $expectedType
* @param string|null $expectedSubtype
*/
public function __construct(int $expectedType, ?string $expectedSubtype = null)
{
$this->_expectedType = $expectedType;
$this->_expectedSubtype = $expectedSubtype;
}
final public function matches($item): bool
{
return $this->_isSafeType($item) && $this->matchesSafely($item);
}
final public function describeMismatch($item, Description $mismatchDescription): void
{
if (!$this->_isSafeType($item)) {
parent::describeMismatch($item, $mismatchDescription);
} else {
$this->describeMismatchSafely($item, $mismatchDescription);
}
}
// -- Protected Methods
/**
* The item will already have been checked for the specific type and subtype.
* @param mixed $item
*/
abstract protected function matchesSafely($item): bool;
/**
* The item will already have been checked for the specific type and subtype.
* @param mixed $item
*/
abstract protected function describeMismatchSafely($item, Description $mismatchDescription): void;
// -- Private Methods
/**
* @param mixed $value
*/
private function _isSafeType($value): bool
{
switch ($this->_expectedType) {
case self::TYPE_ANY:
return true;
case self::TYPE_STRING:
return is_string($value) || is_numeric($value);
case self::TYPE_NUMERIC:
return is_numeric($value) || is_string($value);
case self::TYPE_ARRAY:
return is_array($value);
case self::TYPE_OBJECT:
return is_object($value)
&& ($this->_expectedSubtype === null
|| $value instanceof $this->_expectedSubtype);
case self::TYPE_RESOURCE:
return is_resource($value)
&& ($this->_expectedSubtype === null
|| get_resource_type($value) == $this->_expectedSubtype);
case self::TYPE_BOOLEAN:
return true;
default:
return true;
}
}
}
================================================
FILE: hamcrest/Hamcrest/Util.php
================================================
<?php
namespace Hamcrest;
/*
Copyright (c) 2012 hamcrest.org
*/
/**
* Contains utility methods for handling Hamcrest matchers.
*
* @see Hamcrest\Matcher
*/
class Util
{
public static function registerGlobalFunctions(): void
{
require_once __DIR__.'/../Hamcrest.php';
}
/**
* Wraps the item with an IsEqual matcher if it isn't a matcher already.
*
* @param mixed $item matcher or any value
* @return \Hamcrest\Matcher
*/
public static function wrapValueWithIsEqual($item)
{
return ($item instanceof Matcher)
? $item
: Core\IsEqual::equalTo($item)
;
}
/**
* Throws an exception if any item in $matchers is not a Hamcrest\Matcher.
*
* @param array<mixed> $matchers expected to contain only matchers
* @throws \InvalidArgumentException if any item is not a matcher
*/
public static function checkAllAreMatchers(array $matchers): void
{
foreach ($matchers as $m) {
if (!($m instanceof Matcher)) {
throw new \InvalidArgumentException(
'Each argument or element must be a Hamcrest matcher'
);
}
}
}
/**
* Returns a copy of $items where each non-Matcher item is replaced by
* a Hamcrest\Core\IsEqual matcher for the item. If the first and only item
* is an array, it is used as the $items array to support the old style
* of passing an array as the sole argument to a matcher.
*
* @param array<mixed> $items contains items and matchers
* @return array<Matcher> all items are
*/
public static function createMatcherArray(array $items)
{
//Extract single array item
if (count($items) == 1 && is_array($items[0])) {
$items = $items[0];
}
//Replace non-matchers
foreach ($items as &$item) {
if (!($item instanceof Matcher)) {
$item = Core\IsEqual::equalTo($item);
}
}
return $items;
}
}
================================================
FILE: hamcrest/Hamcrest/Xml/HasXPath.php
================================================
<?php
namespace Hamcrest\Xml;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Core\IsEqual;
use Hamcrest\Description;
use Hamcrest\DiagnosingMatcher;
use Hamcrest\Matcher;
/**
* Matches if XPath applied to XML/HTML/XHTML document either
* evaluates to result matching the matcher or returns at least
* one node, matching the matcher if present.
*/
class HasXPath extends DiagnosingMatcher
{
/**
* XPath to apply to the DOM.
*
* @var string
*/
private string $_xpath;
/**
* Optional matcher to apply to the XPath expression result
* or the content of the returned nodes.
*
* @var ?Matcher
*/
private ?Matcher $_matcher;
/**
* @param string $xpath
*/
public function __construct(string $xpath, ?Matcher $matcher = null)
{
$this->_xpath = $xpath;
$this->_matcher = $matcher;
}
/**
* Matches if the XPath matches against the DOM node and the matcher.
*
* @param string|\DOMNode $actual
* @param Description $mismatchDescription
* @return bool
*/
protected function matchesWithDiagnosticDescription($actual, Description $mismatchDescription): bool
{
if (is_string($actual)) {
$actual = $this->createDocument($actual);
} elseif (!$actual instanceof \DOMNode) { // @phpstan-ignore instanceof.alwaysTrue (unless actual is a native union type, we want to check this)
$mismatchDescription->appendText('was ')->appendValue($actual);
return false;
}
$result = $this->evaluate($actual);
if ($result instanceof \DOMNodeList) {
return $this->matchesContent($result, $mismatchDescription);
} else {
return $this->matchesExpression($result, $mismatchDescription);
}
}
/**
* Creates and returns a <code>DOMDocument</code> from the given
* XML or HTML string.
*
* @param string $text
* @return \DOMDocument built from <code>$text</code>
* @throws \InvalidArgumentException if the document is not valid
*/
protected function createDocument($text)
{
$document = new \DOMDocument();
if (preg_match('/^\s*<\?xml/', $text)) {
if (!@$document->loadXML($text)) {
throw new \InvalidArgumentException('Must pass a valid XML document');
}
} else {
if (!@$document->loadHTML($text)) {
throw new \InvalidArgumentException('Must pass a valid HTML or XHTML document');
}
}
return $document;
}
/**
* Applies the configured XPath to the DOM node and returns either
* the result if it's an expression or the node list if it's a query.
*
* @param \DOMNode $node context from which to issue query
* @return mixed result of expression or DOMNodeList from query
*/
protected function evaluate(\DOMNode $node)
{
if ($node instanceof \DOMDocument) {
$xpathDocument = new \DOMXPath($node);
return $xpathDocument->evaluate($this->_xpath);
} else {
$xpathDocument = new \DOMXPath($node->ownerDocument);
return $xpathDocument->evaluate($this->_xpath, $node);
}
}
/**
* Matches if the list of nodes is not empty and the content of at least
* one node matches the configured matcher, if supplied.
*
* @param \DOMNodeList $nodes selected by the XPath query
* @param Description $mismatchDescription
* @return bool
*/
protected function matchesContent(\DOMNodeList $nodes, Description $mismatchDescription): bool
{
if ($nodes->length == 0) {
$mismatchDescription->appendText('XPath returned no results');
} elseif ($this->_matcher === null) {
return true;
} else {
foreach ($nodes as $node) {
if ($this->_matcher->matches($node->textContent)) {
return true;
}
}
$content = array();
foreach ($nodes as $node) {
$content[] = $node->textContent;
}
$mismatchDescription->appendText('XPath returned ')
->appendValue($content);
}
return false;
}
/**
* Matches if the result of the XPath expression matches the configured
* matcher or evaluates to <code>true</code> if there is none.
*
* @param mixed $result result of the XPath expression
* @param Description $mismatchDescription
* @return bool
*/
protected function matchesExpression($result, Description $mismatchDescription): bool
{
if ($this->_matcher === null) {
if ($result) {
return true;
}
$mismatchDescription->appendText('XPath expression result was ')
->appendValue($result);
} else {
if ($this->_matcher->matches($result)) {
return true;
}
$mismatchDescription->appendText('XPath expression result ');
$this->_matcher->describeMismatch($result, $mismatchDescription);
}
return false;
}
public function describeTo(Description $description): void
{
$description->appendText('XML or HTML document with XPath "')
->appendText($this->_xpath)
->appendText('"');
if ($this->_matcher !== null) {
$description->appendText(' ');
$this->_matcher->describeTo($description);
}
}
/**
* Wraps <code>$matcher</code> with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in <code>count()</code>
* if it's an integer.
*
* @factory
* @param string $xpath
* @param null|Matcher|int|mixed $matcher
*/
public static function hasXPath(string $xpath, $matcher = null): self
{
if ($matcher === null || $matcher instanceof Matcher) {
return new self($xpath, $matcher);
} elseif (is_int($matcher) && strpos($xpath, 'count(') !== 0) {
$xpath = 'count(' . $xpath . ')';
}
return new self($xpath, IsEqual::equalTo($matcher));
}
}
================================================
FILE: hamcrest/Hamcrest.php
================================================
<?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(): void
{
$args = func_get_args();
call_user_func_array(
array('Hamcrest\MatcherAssert', 'assertThat'),
$args
);
}
}
if (!function_exists('anArray')) {
/**
* Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
*/
function anArray(/* args... */): \Hamcrest\Arrays\IsArray
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArray', '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 Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
function hasItemInArray($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::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 Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
function hasValue($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
}
}
if (!function_exists('arrayContainingInAnyOrder')) {
/**
* An array with elements that match the given matchers.
*/
function arrayContainingInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
}
if (!function_exists('containsInAnyOrder')) {
/**
* An array with elements that match the given matchers.
*/
function containsInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
}
}
if (!function_exists('arrayContaining')) {
/**
* An array with elements that match the given matchers in the same order.
*/
function arrayContaining(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
}
}
if (!function_exists('contains')) {
/**
* An array with elements that match the given matchers in the same order.
*/
function contains(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', '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 Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
function hasKeyInArray($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::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 Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
function hasKey($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
}
}
if (!function_exists('hasKeyValuePair')) {
/**
* Test if an array has both an key and value in parity with each other.
*
* @param mixed $key
* @param mixed $value
*/
function hasKeyValuePair($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
}
if (!function_exists('hasEntry')) {
/**
* Test if an array has both an key and value in parity with each other.
*
* @param mixed $key
* @param mixed $value
*/
function hasEntry($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
}
if (!function_exists('arrayWithSize')) {
/**
* Does array size satisfy a given matcher?
*
* @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayWithSize
*/
function arrayWithSize($size): \Hamcrest\Arrays\IsArrayWithSize
{
return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size);
}
}
if (!function_exists('emptyArray')) {
/**
* Matches an empty array.
*/
function emptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::emptyArray();
}
}
if (!function_exists('nonEmptyArray')) {
/**
* Matches an empty array.
*/
function nonEmptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray();
}
}
if (!function_exists('emptyTraversable')) {
/**
* Returns true if traversable is empty.
*/
function emptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable();
}
}
if (!function_exists('nonEmptyTraversable')) {
/**
* Returns true if traversable is not empty.
*/
function nonEmptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable();
}
}
if (!function_exists('traversableWithSize')) {
/**
* Does traversable size satisfy a given matcher?
*
* @param mixed $size
*/
function traversableWithSize($size): \Hamcrest\Collection\IsTraversableWithSize
{
return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size);
}
}
if (!function_exists('allOf')) {
/**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*/
function allOf(/* args... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
}
}
if (!function_exists('anyOf')) {
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*/
function anyOf(/* args... */): \Hamcrest\Core\AnyOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
}
}
if (!function_exists('noneOf')) {
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*/
function noneOf(/* args... */): \Hamcrest\Core\IsNot
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', '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(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::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(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::either($matcher);
}
}
if (!function_exists('describedAs')) {
/**
* Wraps an existing matcher and overrides the description when it fails.
*/
function describedAs(/* args... */): \Hamcrest\Core\DescribedAs
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
}
}
if (!function_exists('everyItem')) {
/**
* @param \Hamcrest\Matcher $itemMatcher
* A matcher to apply to every element in an array.
*
* @return \Hamcrest\Core\Every
* Evaluates to TRUE for a collection in which every item matches $itemMatcher
*/
function everyItem(\Hamcrest\Matcher $itemMatcher): \Hamcrest\Core\Every
{
return \Hamcrest\Core\Every::everyItem($itemMatcher);
}
}
if (!function_exists('hasToString')) {
/**
* Creates a matcher that matches any examined object whose <code>toString</code> or
* <code>__toString()</code> method returns a value equalTo the specified string.
*
* @param mixed $matcher
*/
function hasToString($matcher): \Hamcrest\Core\HasToString
{
return \Hamcrest\Core\HasToString::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)))
*
* @param mixed $value
*/
function is($value): \Hamcrest\Core\Is
{
return \Hamcrest\Core\Is::is($value);
}
}
if (!function_exists('anything')) {
/**
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
*/
function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
return \Hamcrest\Core\IsAnything::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... */): \Hamcrest\Core\IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', '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... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
}
}
if (!function_exists('equalTo')) {
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
*
* @param mixed $item
*/
function equalTo($item): \Hamcrest\Core\IsEqual
{
return \Hamcrest\Core\IsEqual::equalTo($item);
}
}
if (!function_exists('identicalTo')) {
/**
* Tests of the value is identical to $value as tested by the "===" operator.
*
* @param mixed $value
*/
function identicalTo($value): \Hamcrest\Core\IsIdentical
{
return \Hamcrest\Core\IsIdentical::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(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::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(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
}
if (!function_exists('not')) {
/**
* Matches if value does not match $value.
*
* @param mixed $value
*/
function not($value): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNot::not($value);
}
}
if (!function_exists('nullValue')) {
/**
* Matches if value is null.
*/
function nullValue(): \Hamcrest\Core\IsNull
{
return \Hamcrest\Core\IsNull::nullValue();
}
}
if (!function_exists('notNullValue')) {
/**
* Matches if value is not null.
*/
function notNullValue(): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNull::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 \Hamcrest\Core\IsSame
*/
function sameInstance($object): \Hamcrest\Core\IsSame
{
return \Hamcrest\Core\IsSame::sameInstance($object);
}
}
if (!function_exists('typeOf')) {
/**
* Is the value a particular built-in type?
*
* @param string $theType
*/
function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
return \Hamcrest\Core\IsTypeOf::typeOf($theType);
}
}
if (!function_exists('set')) {
/**
* Matches if value (class, object, or array) has named $property.
*
* @param mixed $property
*/
function set($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::set($property);
}
}
if (!function_exists('notSet')) {
/**
* Matches if value (class, object, or array) does not have named $property.
*
* @param mixed $property
*/
function notSet($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::notSet($property);
}
}
if (!function_exists('closeTo')) {
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
*
* @param mixed $value
* @param mixed $delta
*/
function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
{
return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
}
}
if (!function_exists('comparesEqualTo')) {
/**
* The value is not > $value, nor < $value.
*
* @param mixed $value
*/
function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
}
}
if (!function_exists('greaterThan')) {
/**
* The value is > $value.
*
* @param mixed $value
*/
function greaterThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThan($value);
}
}
if (!function_exists('greaterThanOrEqualTo')) {
/**
* The value is >= $value.
*
* @param mixed $value
*/
function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
}
if (!function_exists('atLeast')) {
/**
* The value is >= $value.
*
* @param mixed $value
*/
function atLeast($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
}
if (!function_exists('lessThan')) {
/**
* The value is < $value.
*
* @param mixed $value
*/
function lessThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThan($value);
}
}
if (!function_exists('lessThanOrEqualTo')) {
/**
* The value is <= $value.
*
* @param mixed $value
*/
function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
}
if (!function_exists('atMost')) {
/**
* The value is <= $value.
*
* @param mixed $value
*/
function atMost($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
}
if (!function_exists('isEmptyString')) {
/**
* Matches if value is a zero-length string.
*/
function isEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
}
if (!function_exists('emptyString')) {
/**
* Matches if value is a zero-length string.
*/
function emptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
}
if (!function_exists('isEmptyOrNullString')) {
/**
* Matches if value is null or a zero-length string.
*/
function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
}
if (!function_exists('nullOrEmptyString')) {
/**
* Matches if value is null or a zero-length string.
*/
function nullOrEmptyString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
}
if (!function_exists('isNonEmptyString')) {
/**
* Matches if value is a non-zero-length string.
*/
function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
}
if (!function_exists('nonEmptyString')) {
/**
* Matches if value is a non-zero-length string.
*/
function nonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
}
if (!function_exists('equalToIgnoringCase')) {
/**
* Matches if value is a string equal to $string, regardless of the case.
*
* @param mixed $string
*/
function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
{
return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
}
}
if (!function_exists('equalToIgnoringWhiteSpace')) {
/**
* Matches if value is a string equal to $string, regardless of whitespace.
*
* @param mixed $string
*/
function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
{
return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
}
}
if (!function_exists('matchesPattern')) {
/**
* Matches if value is a string that matches regular expression $pattern.
*
* @param mixed $pattern
*/
function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
{
return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
}
}
if (!function_exists('containsString')) {
/**
* Matches if value is a string that contains $substring.
*
* @param mixed $substring
*/
function containsString($substring): \Hamcrest\Text\StringCon
gitextract_xa2uv0c7/
├── .coveralls.yml
├── .gitattributes
├── .github/
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .gush.yml
├── CHANGES.txt
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── composer.json
├── generator/
│ ├── FactoryCall.php
│ ├── FactoryClass.php
│ ├── FactoryFile.php
│ ├── FactoryGenerator.php
│ ├── FactoryMethod.php
│ ├── FactoryParameter.php
│ ├── GlobalFunctionFile.php
│ ├── StaticMethodFile.php
│ ├── parts/
│ │ ├── file_header.txt
│ │ ├── functions_footer.txt
│ │ ├── functions_header.txt
│ │ ├── functions_imports.txt
│ │ ├── matchers_footer.txt
│ │ ├── matchers_header.txt
│ │ └── matchers_imports.txt
│ └── run.php
├── hamcrest/
│ ├── Hamcrest/
│ │ ├── Arrays/
│ │ │ ├── IsArray.php
│ │ │ ├── IsArrayContaining.php
│ │ │ ├── IsArrayContainingInAnyOrder.php
│ │ │ ├── IsArrayContainingInOrder.php
│ │ │ ├── IsArrayContainingKey.php
│ │ │ ├── IsArrayContainingKeyValuePair.php
│ │ │ ├── IsArrayWithSize.php
│ │ │ ├── MatchingOnce.php
│ │ │ └── SeriesMatchingOnce.php
│ │ ├── AssertionError.php
│ │ ├── BaseDescription.php
│ │ ├── BaseMatcher.php
│ │ ├── Collection/
│ │ │ ├── IsEmptyTraversable.php
│ │ │ └── IsTraversableWithSize.php
│ │ ├── Core/
│ │ │ ├── AllOf.php
│ │ │ ├── AnyOf.php
│ │ │ ├── CombinableMatcher.php
│ │ │ ├── DescribedAs.php
│ │ │ ├── Every.php
│ │ │ ├── HasToString.php
│ │ │ ├── Is.php
│ │ │ ├── IsAnything.php
│ │ │ ├── IsCollectionContaining.php
│ │ │ ├── IsEqual.php
│ │ │ ├── IsIdentical.php
│ │ │ ├── IsInstanceOf.php
│ │ │ ├── IsNot.php
│ │ │ ├── IsNull.php
│ │ │ ├── IsSame.php
│ │ │ ├── IsTypeOf.php
│ │ │ ├── Set.php
│ │ │ └── ShortcutCombination.php
│ │ ├── Description.php
│ │ ├── DiagnosingMatcher.php
│ │ ├── FeatureMatcher.php
│ │ ├── Internal/
│ │ │ └── SelfDescribingValue.php
│ │ ├── Matcher.php
│ │ ├── MatcherAssert.php
│ │ ├── Matchers.php
│ │ ├── NullDescription.php
│ │ ├── Number/
│ │ │ ├── IsCloseTo.php
│ │ │ └── OrderingComparison.php
│ │ ├── SelfDescribing.php
│ │ ├── StringDescription.php
│ │ ├── Text/
│ │ │ ├── IsEmptyString.php
│ │ │ ├── IsEqualIgnoringCase.php
│ │ │ ├── IsEqualIgnoringWhiteSpace.php
│ │ │ ├── MatchesPattern.php
│ │ │ ├── StringContains.php
│ │ │ ├── StringContainsIgnoringCase.php
│ │ │ ├── StringContainsInOrder.php
│ │ │ ├── StringEndsWith.php
│ │ │ ├── StringStartsWith.php
│ │ │ └── SubstringMatcher.php
│ │ ├── Type/
│ │ │ ├── IsArray.php
│ │ │ ├── IsBoolean.php
│ │ │ ├── IsCallable.php
│ │ │ ├── IsDouble.php
│ │ │ ├── IsInteger.php
│ │ │ ├── IsNumeric.php
│ │ │ ├── IsObject.php
│ │ │ ├── IsResource.php
│ │ │ ├── IsScalar.php
│ │ │ └── IsString.php
│ │ ├── TypeSafeDiagnosingMatcher.php
│ │ ├── TypeSafeMatcher.php
│ │ ├── Util.php
│ │ └── Xml/
│ │ └── HasXPath.php
│ └── Hamcrest.php
├── phpstan.neon
└── tests/
├── Hamcrest/
│ ├── AbstractMatcherTest.php
│ ├── Array/
│ │ ├── IsArrayContainingInAnyOrderTest.php
│ │ ├── IsArrayContainingInOrderTest.php
│ │ ├── IsArrayContainingKeyTest.php
│ │ ├── IsArrayContainingKeyValuePairTest.php
│ │ ├── IsArrayContainingTest.php
│ │ ├── IsArrayTest.php
│ │ └── IsArrayWithSizeTest.php
│ ├── BaseMatcherTest.php
│ ├── Collection/
│ │ ├── IsEmptyTraversableTest.php
│ │ └── IsTraversableWithSizeTest.php
│ ├── Core/
│ │ ├── AllOfTest.php
│ │ ├── AnyOfTest.php
│ │ ├── CombinableMatcherTest.php
│ │ ├── DescribedAsTest.php
│ │ ├── EveryTest.php
│ │ ├── HasToStringTest.php
│ │ ├── IsAnythingTest.php
│ │ ├── IsCollectionContainingTest.php
│ │ ├── IsEqualTest.php
│ │ ├── IsIdenticalTest.php
│ │ ├── IsInstanceOfTest.php
│ │ ├── IsNotTest.php
│ │ ├── IsNullTest.php
│ │ ├── IsSameTest.php
│ │ ├── IsTest.php
│ │ ├── IsTypeOfTest.php
│ │ ├── SampleBaseClass.php
│ │ ├── SampleSubClass.php
│ │ └── SetTest.php
│ ├── FeatureMatcherTest.php
│ ├── InvokedMatcherTest.php
│ ├── MatcherAssertTest.php
│ ├── Number/
│ │ ├── IsCloseToTest.php
│ │ └── OrderingComparisonTest.php
│ ├── StringDescriptionTest.php
│ ├── Text/
│ │ ├── IsEmptyStringTest.php
│ │ ├── IsEqualIgnoringCaseTest.php
│ │ ├── IsEqualIgnoringWhiteSpaceTest.php
│ │ ├── MatchesPatternTest.php
│ │ ├── StringContainsIgnoringCaseTest.php
│ │ ├── StringContainsInOrderTest.php
│ │ ├── StringContainsTest.php
│ │ ├── StringEndsWithTest.php
│ │ └── StringStartsWithTest.php
│ ├── Type/
│ │ ├── IsArrayTest.php
│ │ ├── IsBooleanTest.php
│ │ ├── IsCallableTest.php
│ │ ├── IsDoubleTest.php
│ │ ├── IsIntegerTest.php
│ │ ├── IsNumericTest.php
│ │ ├── IsObjectTest.php
│ │ ├── IsResourceTest.php
│ │ ├── IsScalarTest.php
│ │ └── IsStringTest.php
│ ├── UtilTest.php
│ └── Xml/
│ └── HasXPathTest.php
├── bootstrap.php
├── phpstan-baseline.neon
└── phpunit.xml.dist
SYMBOL INDEX (1038 symbols across 134 files)
FILE: generator/FactoryCall.php
class FactoryCall (line 7) | class FactoryCall
method __construct (line 26) | public function __construct(FactoryMethod $method, $name)
method getMethod (line 32) | public function getMethod()
method getName (line 37) | public function getName()
FILE: generator/FactoryClass.php
class FactoryClass (line 7) | class FactoryClass
method __construct (line 24) | public function __construct($file, ReflectionClass $class)
method extractFactoryMethods (line 31) | public function extractFactoryMethods()
method getPublicStaticMethods (line 41) | public function getPublicStaticMethods()
method getFile (line 52) | public function getFile()
method getName (line 57) | public function getName()
method isFactory (line 62) | public function isFactory()
method getMethods (line 67) | public function getMethods()
FILE: generator/FactoryFile.php
class FactoryFile (line 7) | abstract class FactoryFile
method __construct (line 22) | public function __construct($file, $indent)
method addCall (line 28) | abstract public function addCall(FactoryCall $call);
method build (line 30) | abstract public function build();
method addFileHeader (line 32) | public function addFileHeader()
method addPart (line 38) | public function addPart($name)
method addCode (line 43) | public function addCode($code)
method readPart (line 48) | public function readPart($name)
method generateFactoryCall (line 53) | public function generateFactoryCall(FactoryCall $call)
method generateDeclaration (line 63) | public function generateDeclaration($name, FactoryMethod $method)
method getDeclarationModifiers (line 72) | public function getDeclarationModifiers()
method generateDeclarationArguments (line 77) | public function generateDeclarationArguments(FactoryMethod $method)
method generateReturnType (line 86) | public function generateReturnType(FactoryMethod $method): string
method generateImport (line 102) | public function generateImport(FactoryMethod $method)
method generateCall (line 107) | public function generateCall(FactoryMethod $method)
method generateClosing (line 128) | public function generateClosing()
method write (line 133) | public function write()
FILE: generator/FactoryGenerator.php
class FactoryGenerator (line 13) | class FactoryGenerator
method __construct (line 27) | public function __construct($path)
method addFactoryFile (line 33) | public function addFactoryFile(FactoryFile $factoryFile)
method generate (line 38) | public function generate()
method write (line 52) | public function write()
method getClassesWithFactoryMethods (line 60) | public function getClassesWithFactoryMethods()
method getSortedFiles (line 74) | public function getSortedFiles()
method getFileIterator (line 86) | private function getFileIterator()
method getFactoryClass (line 95) | public function getFactoryClass($file)
method getFactoryClassName (line 112) | public function getFactoryClassName($file)
FILE: generator/FactoryMethod.php
class FactoryMethod (line 12) | class FactoryMethod
method __construct (line 44) | public function __construct(FactoryClass $class, ReflectionMethod $ref...
method extractCommentWithoutLeadingShashesAndStars (line 53) | public function extractCommentWithoutLeadingShashesAndStars()
method trimLeadingBlankLinesFromComment (line 63) | public function trimLeadingBlankLinesFromComment()
method trimTrailingBlankLinesFromComment (line 74) | public function trimTrailingBlankLinesFromComment()
method extractFactoryNamesFromComment (line 85) | public function extractFactoryNamesFromComment()
method extractFactoryNamesFromLine (line 96) | public function extractFactoryNamesFromLine($line)
method extractFactoryNamesFromAnnotation (line 109) | public function extractFactoryNamesFromAnnotation($value)
method createCalls (line 126) | public function createCalls(array $names)
method extractParameters (line 136) | public function extractParameters()
method getParameterDeclarations (line 146) | public function getParameterDeclarations()
method getParameterInvocations (line 159) | public function getParameterInvocations()
method getClass (line 172) | public function getClass()
method getClassName (line 177) | public function getClassName()
method getName (line 182) | public function getName()
method isFactory (line 187) | public function isFactory()
method getCalls (line 192) | public function getCalls()
method acceptsVariableArguments (line 197) | public function acceptsVariableArguments()
method hasParameters (line 202) | public function hasParameters()
method getParameters (line 207) | public function getParameters()
method getFullName (line 212) | public function getFullName()
method getReturnType (line 217) | public function getReturnType(): ?string
method getCommentText (line 232) | public function getCommentText()
method getComment (line 237) | public function getComment($indent = '')
FILE: generator/FactoryParameter.php
class FactoryParameter (line 7) | class FactoryParameter
method __construct (line 19) | public function __construct(FactoryMethod $method, ReflectionParameter...
method getDeclaration (line 30) | public function getDeclaration()
method getTypeCode (line 61) | private function getTypeCode()
method getQualifiedName (line 95) | private static function getQualifiedName(ReflectionType $type)
method getInvocation (line 117) | public function getInvocation()
method getMethod (line 127) | public function getMethod()
FILE: generator/GlobalFunctionFile.php
class GlobalFunctionFile (line 7) | class GlobalFunctionFile extends FactoryFile
method __construct (line 14) | public function __construct($file)
method addCall (line 20) | public function addCall(FactoryCall $call)
method build (line 25) | public function build()
method generateFactoryCall (line 34) | public function generateFactoryCall(FactoryCall $call)
FILE: generator/StaticMethodFile.php
class StaticMethodFile (line 7) | class StaticMethodFile extends FactoryFile
method __construct (line 14) | public function __construct($file)
method addCall (line 20) | public function addCall(FactoryCall $call)
method getDeclarationModifiers (line 25) | public function getDeclarationModifiers()
method build (line 30) | public function build()
FILE: hamcrest/Hamcrest.php
function assertThat (line 23) | function assertThat(): void
function anArray (line 37) | function anArray(/* args... */): \Hamcrest\Arrays\IsArray
function hasItemInArray (line 52) | function hasItemInArray($item): \Hamcrest\Arrays\IsArrayContaining
function hasValue (line 66) | function hasValue($item): \Hamcrest\Arrays\IsArrayContaining
function arrayContainingInAnyOrder (line 76) | function arrayContainingInAnyOrder(/* args... */): \Hamcrest\Arrays\IsAr...
function containsInAnyOrder (line 87) | function containsInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayCont...
function arrayContaining (line 98) | function arrayContaining(/* args... */): \Hamcrest\Arrays\IsArrayContain...
function contains (line 109) | function contains(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
function hasKeyInArray (line 124) | function hasKeyInArray($key): \Hamcrest\Arrays\IsArrayContainingKey
function hasKey (line 138) | function hasKey($key): \Hamcrest\Arrays\IsArrayContainingKey
function hasKeyValuePair (line 151) | function hasKeyValuePair($key, $value): \Hamcrest\Arrays\IsArrayContaini...
function hasEntry (line 164) | function hasEntry($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyVa...
function arrayWithSize (line 178) | function arrayWithSize($size): \Hamcrest\Arrays\IsArrayWithSize
function emptyArray (line 188) | function emptyArray(): \Hamcrest\Core\DescribedAs
function nonEmptyArray (line 198) | function nonEmptyArray(): \Hamcrest\Core\DescribedAs
function emptyTraversable (line 208) | function emptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
function nonEmptyTraversable (line 218) | function nonEmptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
function traversableWithSize (line 230) | function traversableWithSize($size): \Hamcrest\Collection\IsTraversableW...
function allOf (line 240) | function allOf(/* args... */): \Hamcrest\Core\AllOf
function anyOf (line 251) | function anyOf(/* args... */): \Hamcrest\Core\AnyOf
function noneOf (line 262) | function noneOf(/* args... */): \Hamcrest\Core\IsNot
function both (line 277) | function both(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
function either (line 291) | function either(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMa...
function describedAs (line 301) | function describedAs(/* args... */): \Hamcrest\Core\DescribedAs
function everyItem (line 316) | function everyItem(\Hamcrest\Matcher $itemMatcher): \Hamcrest\Core\Every
function hasToString (line 329) | function hasToString($matcher): \Hamcrest\Core\HasToString
function is (line 345) | function is($value): \Hamcrest\Core\Is
function anything (line 357) | function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAn...
function hasItem (line 374) | function hasItem(/* args... */): \Hamcrest\Core\IsCollectionContaining
function hasItems (line 391) | function hasItems(/* args... */): \Hamcrest\Core\AllOf
function equalTo (line 405) | function equalTo($item): \Hamcrest\Core\IsEqual
function identicalTo (line 417) | function identicalTo($value): \Hamcrest\Core\IsIdentical
function anInstanceOf (line 430) | function anInstanceOf(string $theClass): \Hamcrest\Core\IsInstanceOf
function any (line 443) | function any(string $theClass): \Hamcrest\Core\IsInstanceOf
function not (line 455) | function not($value): \Hamcrest\Core\IsNot
function nullValue (line 465) | function nullValue(): \Hamcrest\Core\IsNull
function notNullValue (line 475) | function notNullValue(): \Hamcrest\Core\IsNot
function sameInstance (line 491) | function sameInstance($object): \Hamcrest\Core\IsSame
function typeOf (line 503) | function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
function set (line 515) | function set($property): \Hamcrest\Core\Set
function notSet (line 527) | function notSet($property): \Hamcrest\Core\Set
function closeTo (line 541) | function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
function comparesEqualTo (line 553) | function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
function greaterThan (line 565) | function greaterThan($value): \Hamcrest\Number\OrderingComparison
function greaterThanOrEqualTo (line 577) | function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
function atLeast (line 589) | function atLeast($value): \Hamcrest\Number\OrderingComparison
function lessThan (line 601) | function lessThan($value): \Hamcrest\Number\OrderingComparison
function lessThanOrEqualTo (line 613) | function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
function atMost (line 625) | function atMost($value): \Hamcrest\Number\OrderingComparison
function isEmptyString (line 635) | function isEmptyString(): \Hamcrest\Text\IsEmptyString
function emptyString (line 645) | function emptyString(): \Hamcrest\Text\IsEmptyString
function isEmptyOrNullString (line 655) | function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
function nullOrEmptyString (line 665) | function nullOrEmptyString(): \Hamcrest\Core\AnyOf
function isNonEmptyString (line 675) | function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
function nonEmptyString (line 685) | function nonEmptyString(): \Hamcrest\Text\IsEmptyString
function equalToIgnoringCase (line 697) | function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
function equalToIgnoringWhiteSpace (line 709) | function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnor...
function matchesPattern (line 721) | function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
function containsString (line 733) | function containsString($substring): \Hamcrest\Text\StringContains
function containsStringIgnoringCase (line 745) | function containsStringIgnoringCase($substring): \Hamcrest\Text\StringCo...
function stringContainsInOrder (line 755) | function stringContainsInOrder(/* args... */): \Hamcrest\Text\StringCont...
function endsWith (line 768) | function endsWith($substring): \Hamcrest\Text\StringEndsWith
function startsWith (line 780) | function startsWith($substring): \Hamcrest\Text\StringStartsWith
function arrayValue (line 790) | function arrayValue(): \Hamcrest\Type\IsArray
function booleanValue (line 800) | function booleanValue(): \Hamcrest\Type\IsBoolean
function boolValue (line 810) | function boolValue(): \Hamcrest\Type\IsBoolean
function callableValue (line 820) | function callableValue(): \Hamcrest\Type\IsCallable
function doubleValue (line 830) | function doubleValue(): \Hamcrest\Type\IsDouble
function floatValue (line 840) | function floatValue(): \Hamcrest\Type\IsDouble
function integerValue (line 850) | function integerValue(): \Hamcrest\Type\IsInteger
function intValue (line 860) | function intValue(): \Hamcrest\Type\IsInteger
function numericValue (line 870) | function numericValue(): \Hamcrest\Type\IsNumeric
function objectValue (line 880) | function objectValue(): \Hamcrest\Type\IsObject
function anObject (line 890) | function anObject(): \Hamcrest\Type\IsObject
function resourceValue (line 900) | function resourceValue(): \Hamcrest\Type\IsResource
function scalarValue (line 910) | function scalarValue(): \Hamcrest\Type\IsScalar
function stringValue (line 920) | function stringValue(): \Hamcrest\Type\IsString
function hasXPath (line 935) | function hasXPath(string $xpath, $matcher = null): \Hamcrest\Xml\HasXPath
FILE: hamcrest/Hamcrest/Arrays/IsArray.php
class IsArray (line 21) | class IsArray extends TypeSafeMatcher
method __construct (line 32) | public function __construct(array $elementMatchers)
method matchesSafely (line 41) | protected function matchesSafely($array): bool
method describeMismatchSafely (line 56) | protected function describeMismatchSafely($actual, Description $mismat...
method describeTo (line 85) | public function describeTo(Description $description): void
method anArray (line 100) | public static function anArray(/* args... */): self
method descriptionStart (line 109) | protected function descriptionStart(): string
method descriptionSeparator (line 114) | protected function descriptionSeparator(): string
method descriptionEnd (line 119) | protected function descriptionEnd(): string
FILE: hamcrest/Hamcrest/Arrays/IsArrayContaining.php
class IsArrayContaining (line 15) | class IsArrayContaining extends TypeSafeMatcher
method __construct (line 20) | public function __construct(Matcher $elementMatcher)
method matchesSafely (line 27) | protected function matchesSafely($array): bool
method describeMismatchSafely (line 38) | protected function describeMismatchSafely($array, Description $mismatc...
method describeTo (line 43) | public function describeTo(Description $description): void
method hasItemInArray (line 59) | public static function hasItemInArray($item): self
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php
class IsArrayContainingInAnyOrder (line 15) | class IsArrayContainingInAnyOrder extends TypeSafeDiagnosingMatcher
method __construct (line 26) | public function __construct(array $elementMatchers)
method matchesSafelyWithDiagnosticDescription (line 35) | protected function matchesSafelyWithDiagnosticDescription($array, Desc...
method describeTo (line 48) | public function describeTo(Description $description): void
method arrayContainingInAnyOrder (line 60) | public static function arrayContainingInAnyOrder(/* args... */): self
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php
class IsArrayContainingInOrder (line 15) | class IsArrayContainingInOrder extends TypeSafeDiagnosingMatcher
method __construct (line 26) | public function __construct(array $elementMatchers)
method matchesSafelyWithDiagnosticDescription (line 35) | protected function matchesSafelyWithDiagnosticDescription($array, Desc...
method describeTo (line 48) | public function describeTo(Description $description): void
method arrayContaining (line 58) | public static function arrayContaining(/* args... */): self
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php
class IsArrayContainingKey (line 15) | class IsArrayContainingKey extends TypeSafeMatcher
method __construct (line 20) | public function __construct(Matcher $keyMatcher)
method matchesSafely (line 27) | protected function matchesSafely($array): bool
method describeMismatchSafely (line 38) | protected function describeMismatchSafely($array, Description $mismatc...
method describeTo (line 55) | public function describeTo(Description $description): void
method hasKeyInArray (line 71) | public static function hasKeyInArray($key): self
FILE: hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php
class IsArrayContainingKeyValuePair (line 16) | class IsArrayContainingKeyValuePair extends TypeSafeMatcher
method __construct (line 21) | public function __construct(Matcher $keyMatcher, Matcher $valueMatcher)
method matchesSafely (line 29) | protected function matchesSafely($array): bool
method describeMismatchSafely (line 40) | protected function describeMismatchSafely($array, Description $mismatc...
method describeTo (line 57) | public function describeTo(Description $description): void
method hasKeyValuePair (line 74) | public static function hasKeyValuePair($key, $value): self
FILE: hamcrest/Hamcrest/Arrays/IsArrayWithSize.php
class IsArrayWithSize (line 16) | class IsArrayWithSize extends FeatureMatcher
method __construct (line 19) | public function __construct(Matcher $sizeMatcher)
method featureValueOf (line 30) | protected function featureValueOf($array)
method arrayWithSize (line 43) | public static function arrayWithSize($size): self
method emptyArray (line 53) | public static function emptyArray(): DescribedAs
method nonEmptyArray (line 66) | public static function nonEmptyArray(): DescribedAs
FILE: hamcrest/Hamcrest/Arrays/MatchingOnce.php
class MatchingOnce (line 11) | class MatchingOnce
method __construct (line 23) | public function __construct(array $elementMatchers, Description $misma...
method matches (line 32) | public function matches($item): bool
method isFinished (line 40) | public function isFinished($items): bool
method _isNotSurplus (line 59) | private function _isNotSurplus($item): bool
method _isMatched (line 73) | private function _isMatched($item): bool
FILE: hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php
class SeriesMatchingOnce (line 11) | class SeriesMatchingOnce
method __construct (line 31) | public function __construct(array $elementMatchers, Description $misma...
method matches (line 41) | public function matches($item): bool
method isFinished (line 46) | public function isFinished(): bool
method _isNotSurplus (line 63) | private function _isNotSurplus($item): bool
method _isMatched (line 77) | private function _isMatched($item): bool
method _describeMismatch (line 94) | private function _describeMismatch(Matcher $matcher, $item): void
FILE: hamcrest/Hamcrest/AssertionError.php
class AssertionError (line 8) | class AssertionError extends \RuntimeException
FILE: hamcrest/Hamcrest/BaseDescription.php
class BaseDescription (line 12) | abstract class BaseDescription implements Description
method appendText (line 15) | public function appendText(string $text): self
method appendDescriptionOf (line 22) | public function appendDescriptionOf(SelfDescribing $value)
method appendValue (line 29) | public function appendValue($value): self
method appendValueList (line 58) | public function appendValueList(string $start, string $separator, stri...
method appendList (line 70) | public function appendList(string $start, string $separator, string $e...
method append (line 101) | abstract protected function append($str): void;
method _toPhpSyntax (line 105) | private function _toPhpSyntax(string $value): void
FILE: hamcrest/Hamcrest/BaseMatcher.php
class BaseMatcher (line 13) | abstract class BaseMatcher implements Matcher
method describeMismatch (line 18) | public function describeMismatch($item, Description $description): void
method __toString (line 23) | public function __toString(): string
method __invoke (line 28) | public function __invoke(): bool
FILE: hamcrest/Hamcrest/Collection/IsEmptyTraversable.php
class IsEmptyTraversable (line 13) | class IsEmptyTraversable extends BaseMatcher
method __construct (line 21) | public function __construct(bool $empty = true)
method matches (line 26) | public function matches($item): bool
method describeTo (line 39) | public function describeTo(Description $description): void
method emptyTraversable (line 49) | public static function emptyTraversable(): self
method nonEmptyTraversable (line 63) | public static function nonEmptyTraversable(): self
FILE: hamcrest/Hamcrest/Collection/IsTraversableWithSize.php
class IsTraversableWithSize (line 14) | class IsTraversableWithSize extends FeatureMatcher
method __construct (line 17) | public function __construct(Matcher $sizeMatcher)
method featureValueOf (line 28) | protected function featureValueOf($actual)
method traversableWithSize (line 44) | public static function traversableWithSize($size): self
FILE: hamcrest/Hamcrest/Core/AllOf.php
class AllOf (line 17) | class AllOf extends DiagnosingMatcher
method __construct (line 28) | public function __construct(array $matchers)
method matchesWithDiagnosticDescription (line 35) | public function matchesWithDiagnosticDescription($item, Description $m...
method describeTo (line 49) | public function describeTo(Description $description): void
method allOf (line 59) | public static function allOf(/* args... */): self
FILE: hamcrest/Hamcrest/Core/AnyOf.php
class AnyOf (line 16) | class AnyOf extends ShortcutCombination
method __construct (line 22) | public function __construct(array $matchers)
method matches (line 27) | public function matches($item): bool
method describeTo (line 32) | public function describeTo(Description $description): void
method anyOf (line 42) | public static function anyOf(/* args... */): self
method noneOf (line 54) | public static function noneOf(/* args... */): IsNot
FILE: hamcrest/Hamcrest/Core/CombinableMatcher.php
class CombinableMatcher (line 12) | class CombinableMatcher extends BaseMatcher
method __construct (line 17) | public function __construct(Matcher $matcher)
method matches (line 22) | public function matches($item): bool
method describeTo (line 27) | public function describeTo(Description $description): void
method andAlso (line 33) | public function andAlso(Matcher $other): self
method orElse (line 39) | public function orElse(Matcher $other): self
method both (line 53) | public static function both(Matcher $matcher): self
method either (line 67) | public static function either(Matcher $matcher): self
method _templatedListWith (line 77) | private function _templatedListWith(Matcher $other): array
FILE: hamcrest/Hamcrest/Core/DescribedAs.php
class DescribedAs (line 14) | class DescribedAs extends BaseMatcher
method __construct (line 29) | public function __construct(string $descriptionTemplate, Matcher $matc...
method matches (line 36) | public function matches($item): bool
method describeTo (line 41) | public function describeTo(Description $description): void
method describedAs (line 65) | public static function describedAs(/* $description, Hamcrest\Matcher $...
FILE: hamcrest/Hamcrest/Core/Every.php
class Every (line 12) | class Every extends TypeSafeDiagnosingMatcher
method __construct (line 17) | public function __construct(Matcher $matcher)
method matchesSafelyWithDiagnosticDescription (line 24) | protected function matchesSafelyWithDiagnosticDescription($items, Desc...
method describeTo (line 38) | public function describeTo(Description $description): void
method everyItem (line 52) | public static function everyItem(Matcher $itemMatcher): self
FILE: hamcrest/Hamcrest/Core/HasToString.php
class HasToString (line 15) | class HasToString extends FeatureMatcher
method __construct (line 18) | public function __construct(Matcher $toStringMatcher)
method matchesSafelyWithDiagnosticDescription (line 29) | public function matchesSafelyWithDiagnosticDescription($actual, Descri...
method featureValueOf (line 38) | protected function featureValueOf($actual)
method hasToString (line 54) | public static function hasToString($matcher): self
FILE: hamcrest/Hamcrest/Core/Is.php
class Is (line 19) | class Is extends BaseMatcher
method __construct (line 24) | public function __construct(Matcher $matcher)
method matches (line 29) | public function matches($arg): bool
method describeTo (line 34) | public function describeTo(Description $description): void
method describeMismatch (line 39) | public function describeMismatch($item, Description $mismatchDescripti...
method is (line 54) | public static function is($value): self
FILE: hamcrest/Hamcrest/Core/IsAnything.php
class IsAnything (line 13) | class IsAnything extends BaseMatcher
method __construct (line 18) | public function __construct(string $message = 'ANYTHING')
method matches (line 23) | public function matches($item): bool
method describeTo (line 28) | public function describeTo(Description $description): void
method anything (line 40) | public static function anything(string $description = 'ANYTHING'): self
FILE: hamcrest/Hamcrest/Core/IsCollectionContaining.php
class IsCollectionContaining (line 15) | class IsCollectionContaining extends TypeSafeMatcher
method __construct (line 20) | public function __construct(Matcher $elementMatcher)
method matchesSafely (line 27) | protected function matchesSafely($items): bool
method describeMismatchSafely (line 38) | protected function describeMismatchSafely($items, Description $mismatc...
method describeTo (line 43) | public function describeTo(Description $description): void
method hasItem (line 63) | public static function hasItem(): self
method hasItems (line 82) | public static function hasItems(/* args... */): AllOf
FILE: hamcrest/Hamcrest/Core/IsEqual.php
class IsEqual (line 14) | class IsEqual extends BaseMatcher
method __construct (line 24) | public function __construct($item)
method matches (line 29) | public function matches($arg): bool
method describeTo (line 34) | public function describeTo(Description $description): void
method equalTo (line 46) | public static function equalTo($item): self
FILE: hamcrest/Hamcrest/Core/IsIdentical.php
class IsIdentical (line 13) | class IsIdentical extends IsSame
method __construct (line 24) | public function __construct($value)
method describeTo (line 30) | public function describeTo(Description $description): void
method identicalTo (line 41) | public static function identicalTo($value): self
FILE: hamcrest/Hamcrest/Core/IsInstanceOf.php
class IsInstanceOf (line 13) | class IsInstanceOf extends DiagnosingMatcher
method __construct (line 25) | public function __construct(string $theClass)
method matchesWithDiagnosticDescription (line 30) | protected function matchesWithDiagnosticDescription($item, Description...
method describeTo (line 48) | public function describeTo(Description $description): void
method anInstanceOf (line 63) | public static function anInstanceOf(string $theClass): self
FILE: hamcrest/Hamcrest/Core/IsNot.php
class IsNot (line 15) | class IsNot extends BaseMatcher
method __construct (line 20) | public function __construct(Matcher $matcher)
method matches (line 25) | public function matches($arg): bool
method describeTo (line 30) | public function describeTo(Description $description): void
method not (line 41) | public static function not($value): self
FILE: hamcrest/Hamcrest/Core/IsNull.php
class IsNull (line 13) | class IsNull extends BaseMatcher
method matches (line 19) | public function matches($item): bool
method describeTo (line 24) | public function describeTo(Description $description): void
method nullValue (line 34) | public static function nullValue(): self
method notNullValue (line 48) | public static function notNullValue(): IsNot
FILE: hamcrest/Hamcrest/Core/IsSame.php
class IsSame (line 14) | class IsSame extends BaseMatcher
method __construct (line 25) | public function __construct($object)
method matches (line 30) | public function matches($object): bool
method describeTo (line 35) | public function describeTo(Description $description): void
method sameInstance (line 53) | public static function sameInstance($object): self
FILE: hamcrest/Hamcrest/Core/IsTypeOf.php
class IsTypeOf (line 13) | class IsTypeOf extends BaseMatcher
method __construct (line 24) | public function __construct(string $theType)
method matches (line 29) | public function matches($item): bool
method describeTo (line 34) | public function describeTo(Description $description): void
method describeMismatch (line 39) | public function describeMismatch($item, Description $description): void
method getTypeDescription (line 52) | public static function getTypeDescription(string $type): string
method typeOf (line 68) | public static function typeOf(string $theType): self
FILE: hamcrest/Hamcrest/Core/Set.php
class Set (line 22) | class Set extends BaseMatcher
method __construct (line 34) | public function __construct($property, bool $not = false)
method matches (line 40) | public function matches($item): bool
method describeTo (line 59) | public function describeTo(Description $description): void
method describeMismatch (line 64) | public function describeMismatch($item, Description $description): void
method set (line 88) | public static function set($property): self
method notSet (line 99) | public static function notSet($property): self
FILE: hamcrest/Hamcrest/Core/ShortcutCombination.php
class ShortcutCombination (line 12) | abstract class ShortcutCombination extends BaseMatcher
method __construct (line 23) | public function __construct(array $matchers)
method matchesWithShortcut (line 33) | protected function matchesWithShortcut($item, bool $shortcut): bool
method describeToWithOperator (line 44) | public function describeToWithOperator(Description $description, strin...
FILE: hamcrest/Hamcrest/Description.php
type Description (line 14) | interface Description
method appendText (line 24) | public function appendText(string $text): self;
method appendDescriptionOf (line 34) | public function appendDescriptionOf(SelfDescribing $value);
method appendValue (line 43) | public function appendValue($value): self;
method appendValueList (line 55) | public function appendValueList(string $start, string $separator, stri...
method appendList (line 68) | public function appendList(string $start, string $separator, string $e...
FILE: hamcrest/Hamcrest/DiagnosingMatcher.php
class DiagnosingMatcher (line 11) | abstract class DiagnosingMatcher extends BaseMatcher
method matches (line 14) | final public function matches($item): bool
method describeMismatch (line 19) | public function describeMismatch($item, Description $mismatchDescripti...
method matchesWithDiagnosticDescription (line 27) | abstract protected function matchesWithDiagnosticDescription($item, De...
FILE: hamcrest/Hamcrest/FeatureMatcher.php
class FeatureMatcher (line 13) | abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher
method __construct (line 29) | public function __construct(int $type, ?string $subtype, Matcher $subM...
method featureValueOf (line 45) | abstract protected function featureValueOf($actual);
method matchesSafelyWithDiagnosticDescription (line 47) | public function matchesSafelyWithDiagnosticDescription($actual, Descri...
method describeTo (line 61) | final public function describeTo(Description $description): void
FILE: hamcrest/Hamcrest/Internal/SelfDescribingValue.php
class SelfDescribingValue (line 13) | class SelfDescribingValue implements SelfDescribing
method __construct (line 23) | public function __construct($value)
method describeTo (line 28) | public function describeTo(Description $description): void
FILE: hamcrest/Hamcrest/Matcher.php
type Matcher (line 23) | interface Matcher extends SelfDescribing
method matches (line 36) | public function matches($item): bool;
method describeMismatch (line 49) | public function describeMismatch($item, Description $description): void;
FILE: hamcrest/Hamcrest/MatcherAssert.php
class MatcherAssert (line 8) | class MatcherAssert
method assertThat (line 38) | public static function assertThat(/* $args ... */): void
method getCount (line 77) | public static function getCount(): int
method resetCount (line 85) | public static function resetCount(): void
method doAssert (line 102) | private static function doAssert($identifier, $actual, Matcher $matche...
FILE: hamcrest/Hamcrest/Matchers.php
class Matchers (line 14) | class Matchers
method anArray (line 20) | public static function anArray(/* args... */): \Hamcrest\Arrays\IsArray
method hasItemInArray (line 33) | public static function hasItemInArray($item): \Hamcrest\Arrays\IsArray...
method hasValue (line 45) | public static function hasValue($item): \Hamcrest\Arrays\IsArrayContai...
method arrayContainingInAnyOrder (line 53) | public static function arrayContainingInAnyOrder(/* args... */): \Hamc...
method containsInAnyOrder (line 62) | public static function containsInAnyOrder(/* args... */): \Hamcrest\Ar...
method arrayContaining (line 71) | public static function arrayContaining(/* args... */): \Hamcrest\Array...
method contains (line 80) | public static function contains(/* args... */): \Hamcrest\Arrays\IsArr...
method hasKeyInArray (line 93) | public static function hasKeyInArray($key): \Hamcrest\Arrays\IsArrayCo...
method hasKey (line 105) | public static function hasKey($key): \Hamcrest\Arrays\IsArrayContainin...
method hasKeyValuePair (line 116) | public static function hasKeyValuePair($key, $value): \Hamcrest\Arrays...
method hasEntry (line 127) | public static function hasEntry($key, $value): \Hamcrest\Arrays\IsArra...
method arrayWithSize (line 139) | public static function arrayWithSize($size): \Hamcrest\Arrays\IsArrayW...
method emptyArray (line 147) | public static function emptyArray(): \Hamcrest\Core\DescribedAs
method nonEmptyArray (line 155) | public static function nonEmptyArray(): \Hamcrest\Core\DescribedAs
method emptyTraversable (line 163) | public static function emptyTraversable(): \Hamcrest\Collection\IsEmpt...
method nonEmptyTraversable (line 171) | public static function nonEmptyTraversable(): \Hamcrest\Collection\IsE...
method traversableWithSize (line 181) | public static function traversableWithSize($size): \Hamcrest\Collectio...
method allOf (line 189) | public static function allOf(/* args... */): \Hamcrest\Core\AllOf
method anyOf (line 198) | public static function anyOf(/* args... */): \Hamcrest\Core\AnyOf
method noneOf (line 207) | public static function noneOf(/* args... */): \Hamcrest\Core\IsNot
method both (line 220) | public static function both(\Hamcrest\Matcher $matcher): \Hamcrest\Cor...
method either (line 232) | public static function either(\Hamcrest\Matcher $matcher): \Hamcrest\C...
method describedAs (line 240) | public static function describedAs(/* args... */): \Hamcrest\Core\Desc...
method everyItem (line 253) | public static function everyItem(\Hamcrest\Matcher $itemMatcher): \Ham...
method hasToString (line 264) | public static function hasToString($matcher): \Hamcrest\Core\HasToString
method is (line 278) | public static function is($value): \Hamcrest\Core\Is
method anything (line 288) | public static function anything(string $description = 'ANYTHING'): \Ha...
method hasItem (line 303) | public static function hasItem(/* args... */): \Hamcrest\Core\IsCollec...
method hasItems (line 318) | public static function hasItems(/* args... */): \Hamcrest\Core\AllOf
method equalTo (line 330) | public static function equalTo($item): \Hamcrest\Core\IsEqual
method identicalTo (line 340) | public static function identicalTo($value): \Hamcrest\Core\IsIdentical
method anInstanceOf (line 351) | public static function anInstanceOf(string $theClass): \Hamcrest\Core\...
method any (line 362) | public static function any(string $theClass): \Hamcrest\Core\IsInstanceOf
method not (line 372) | public static function not($value): \Hamcrest\Core\IsNot
method nullValue (line 380) | public static function nullValue(): \Hamcrest\Core\IsNull
method notNullValue (line 388) | public static function notNullValue(): \Hamcrest\Core\IsNot
method sameInstance (line 402) | public static function sameInstance($object): \Hamcrest\Core\IsSame
method typeOf (line 412) | public static function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
method set (line 422) | public static function set($property): \Hamcrest\Core\Set
method notSet (line 432) | public static function notSet($property): \Hamcrest\Core\Set
method closeTo (line 444) | public static function closeTo($value, $delta): \Hamcrest\Number\IsClo...
method comparesEqualTo (line 454) | public static function comparesEqualTo($value): \Hamcrest\Number\Order...
method greaterThan (line 464) | public static function greaterThan($value): \Hamcrest\Number\OrderingC...
method greaterThanOrEqualTo (line 474) | public static function greaterThanOrEqualTo($value): \Hamcrest\Number\...
method atLeast (line 484) | public static function atLeast($value): \Hamcrest\Number\OrderingCompa...
method lessThan (line 494) | public static function lessThan($value): \Hamcrest\Number\OrderingComp...
method lessThanOrEqualTo (line 504) | public static function lessThanOrEqualTo($value): \Hamcrest\Number\Ord...
method atMost (line 514) | public static function atMost($value): \Hamcrest\Number\OrderingCompar...
method isEmptyString (line 522) | public static function isEmptyString(): \Hamcrest\Text\IsEmptyString
method emptyString (line 530) | public static function emptyString(): \Hamcrest\Text\IsEmptyString
method isEmptyOrNullString (line 538) | public static function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
method nullOrEmptyString (line 546) | public static function nullOrEmptyString(): \Hamcrest\Core\AnyOf
method isNonEmptyString (line 554) | public static function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
method nonEmptyString (line 562) | public static function nonEmptyString(): \Hamcrest\Text\IsEmptyString
method equalToIgnoringCase (line 572) | public static function equalToIgnoringCase($string): \Hamcrest\Text\Is...
method equalToIgnoringWhiteSpace (line 582) | public static function equalToIgnoringWhiteSpace($string): \Hamcrest\T...
method matchesPattern (line 592) | public static function matchesPattern($pattern): \Hamcrest\Text\Matche...
method containsString (line 602) | public static function containsString($substring): \Hamcrest\Text\Stri...
method containsStringIgnoringCase (line 612) | public static function containsStringIgnoringCase($substring): \Hamcre...
method stringContainsInOrder (line 620) | public static function stringContainsInOrder(/* args... */): \Hamcrest...
method endsWith (line 631) | public static function endsWith($substring): \Hamcrest\Text\StringEnds...
method startsWith (line 641) | public static function startsWith($substring): \Hamcrest\Text\StringSt...
method arrayValue (line 649) | public static function arrayValue(): \Hamcrest\Type\IsArray
method booleanValue (line 657) | public static function booleanValue(): \Hamcrest\Type\IsBoolean
method boolValue (line 665) | public static function boolValue(): \Hamcrest\Type\IsBoolean
method callableValue (line 673) | public static function callableValue(): \Hamcrest\Type\IsCallable
method doubleValue (line 681) | public static function doubleValue(): \Hamcrest\Type\IsDouble
method floatValue (line 689) | public static function floatValue(): \Hamcrest\Type\IsDouble
method integerValue (line 697) | public static function integerValue(): \Hamcrest\Type\IsInteger
method intValue (line 705) | public static function intValue(): \Hamcrest\Type\IsInteger
method numericValue (line 713) | public static function numericValue(): \Hamcrest\Type\IsNumeric
method objectValue (line 721) | public static function objectValue(): \Hamcrest\Type\IsObject
method anObject (line 729) | public static function anObject(): \Hamcrest\Type\IsObject
method resourceValue (line 737) | public static function resourceValue(): \Hamcrest\Type\IsResource
method scalarValue (line 745) | public static function scalarValue(): \Hamcrest\Type\IsScalar
method stringValue (line 753) | public static function stringValue(): \Hamcrest\Type\IsString
method hasXPath (line 766) | public static function hasXPath(string $xpath, $matcher = null): \Hamc...
FILE: hamcrest/Hamcrest/NullDescription.php
class NullDescription (line 11) | class NullDescription implements Description
method appendText (line 14) | public function appendText(string $text): self
method appendDescriptionOf (line 19) | public function appendDescriptionOf(SelfDescribing $value): self
method appendValue (line 24) | public function appendValue($value): self
method appendValueList (line 29) | public function appendValueList(string $start, string $separator, stri...
method appendList (line 34) | public function appendList(string $start, string $separator, string $e...
method __toString (line 39) | public function __toString()
FILE: hamcrest/Hamcrest/Number/IsCloseTo.php
class IsCloseTo (line 14) | class IsCloseTo extends TypeSafeMatcher
method __construct (line 30) | public function __construct($value, $delta)
method matchesSafely (line 38) | protected function matchesSafely($item): bool
method describeMismatchSafely (line 43) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 51) | public function describeTo(Description $description): void
method closeTo (line 68) | public static function closeTo($value, $delta): self
method _actualDelta (line 79) | private function _actualDelta($item)
FILE: hamcrest/Hamcrest/Number/OrderingComparison.php
class OrderingComparison (line 11) | class OrderingComparison extends TypeSafeMatcher
method __construct (line 32) | public function __construct($value, $minCompare, $maxCompare)
method matchesSafely (line 41) | protected function matchesSafely($other): bool
method describeMismatchSafely (line 48) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 57) | public function describeTo(Description $description): void
method comparesEqualTo (line 76) | public static function comparesEqualTo($value): self
method greaterThan (line 87) | public static function greaterThan($value): self
method greaterThanOrEqualTo (line 98) | public static function greaterThanOrEqualTo($value): self
method lessThan (line 109) | public static function lessThan($value): self
method lessThanOrEqualTo (line 120) | public static function lessThanOrEqualTo($value): self
method _compare (line 131) | private function _compare($left, $right): int
method _comparison (line 148) | private function _comparison($compare): string
FILE: hamcrest/Hamcrest/SelfDescribing.php
type SelfDescribing (line 11) | interface SelfDescribing
method describeTo (line 22) | public function describeTo(Description $description): void;
FILE: hamcrest/Hamcrest/StringDescription.php
class StringDescription (line 11) | class StringDescription extends BaseDescription
method __construct (line 19) | public function __construct($out = '')
method __toString (line 24) | public function __toString()
method toString (line 39) | public static function toString(SelfDescribing $selfDescribing): string
method asString (line 49) | public static function asString(SelfDescribing $selfDescribing): string
method append (line 56) | protected function append($str): void
FILE: hamcrest/Hamcrest/Text/IsEmptyString.php
class IsEmptyString (line 15) | class IsEmptyString extends BaseMatcher
method __construct (line 24) | public function __construct(bool $empty = true)
method matches (line 29) | public function matches($item): bool
method describeTo (line 36) | public function describeTo(Description $description): void
method isEmptyString (line 46) | public static function isEmptyString(): self
method isEmptyOrNullString (line 60) | public static function isEmptyOrNullString(): AnyOf
method isNonEmptyString (line 77) | public static function isNonEmptyString(): self
FILE: hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php
class IsEqualIgnoringCase (line 13) | class IsEqualIgnoringCase extends TypeSafeMatcher
method __construct (line 23) | public function __construct($string)
method matchesSafely (line 30) | protected function matchesSafely($item): bool
method describeMismatchSafely (line 35) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 40) | public function describeTo(Description $description): void
method equalToIgnoringCase (line 54) | public static function equalToIgnoringCase($string): self
FILE: hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php
class IsEqualIgnoringWhiteSpace (line 14) | class IsEqualIgnoringWhiteSpace extends TypeSafeMatcher
method __construct (line 24) | public function __construct($string)
method matchesSafely (line 31) | protected function matchesSafely($item): bool
method describeMismatchSafely (line 37) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 42) | public function describeTo(Description $description): void
method equalToIgnoringWhiteSpace (line 56) | public static function equalToIgnoringWhiteSpace($string): self
method _stripSpace (line 63) | private function _stripSpace(string $string): string
FILE: hamcrest/Hamcrest/Text/MatchesPattern.php
class MatchesPattern (line 11) | class MatchesPattern extends SubstringMatcher
method __construct (line 16) | public function __construct($pattern)
method matchesPattern (line 27) | public static function matchesPattern($pattern): self
method evalSubstringOf (line 34) | protected function evalSubstringOf(string $item): bool
method relationship (line 39) | protected function relationship(): string
FILE: hamcrest/Hamcrest/Text/StringContains.php
class StringContains (line 11) | class StringContains extends SubstringMatcher
method __construct (line 16) | public function __construct($substring)
method ignoringCase (line 21) | public function ignoringCase(): StringContainsIgnoringCase
method containsString (line 32) | public static function containsString($substring): self
method evalSubstringOf (line 39) | protected function evalSubstringOf(string $item): bool
method relationship (line 44) | protected function relationship(): string
FILE: hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php
class StringContainsIgnoringCase (line 11) | class StringContainsIgnoringCase extends SubstringMatcher
method __construct (line 17) | public function __construct($substring)
method containsStringIgnoringCase (line 28) | public static function containsStringIgnoringCase($substring): self
method evalSubstringOf (line 35) | protected function evalSubstringOf(string $item): bool
method relationship (line 40) | protected function relationship(): string
FILE: hamcrest/Hamcrest/Text/StringContainsInOrder.php
class StringContainsInOrder (line 13) | class StringContainsInOrder extends TypeSafeMatcher
method __construct (line 23) | public function __construct(array $substrings)
method matchesSafely (line 30) | protected function matchesSafely($item): bool
method describeMismatchSafely (line 43) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 48) | public function describeTo(Description $description): void
method stringContainsInOrder (line 61) | public static function stringContainsInOrder(/* args... */): self
FILE: hamcrest/Hamcrest/Text/StringEndsWith.php
class StringEndsWith (line 11) | class StringEndsWith extends SubstringMatcher
method __construct (line 17) | public function __construct($substring)
method endsWith (line 28) | public static function endsWith($substring): self
method evalSubstringOf (line 35) | protected function evalSubstringOf(string $string): bool
method relationship (line 40) | protected function relationship(): string
FILE: hamcrest/Hamcrest/Text/StringStartsWith.php
class StringStartsWith (line 11) | class StringStartsWith extends SubstringMatcher
method __construct (line 17) | public function __construct($substring)
method startsWith (line 28) | public static function startsWith($substring): self
method evalSubstringOf (line 35) | protected function evalSubstringOf(string $string): bool
method relationship (line 40) | protected function relationship(): string
FILE: hamcrest/Hamcrest/Text/SubstringMatcher.php
class SubstringMatcher (line 11) | abstract class SubstringMatcher extends TypeSafeMatcher
method __construct (line 22) | public function __construct($substring)
method matchesSafely (line 29) | protected function matchesSafely($item): bool
method describeMismatchSafely (line 34) | protected function describeMismatchSafely($item, Description $mismatch...
method describeTo (line 39) | public function describeTo(Description $description): void
method evalSubstringOf (line 48) | abstract protected function evalSubstringOf(string $string): bool;
method relationship (line 50) | abstract protected function relationship(): string;
FILE: hamcrest/Hamcrest/Type/IsArray.php
class IsArray (line 12) | class IsArray extends IsTypeOf
method __construct (line 18) | public function __construct()
method arrayValue (line 28) | public static function arrayValue(): self
FILE: hamcrest/Hamcrest/Type/IsBoolean.php
class IsBoolean (line 12) | class IsBoolean extends IsTypeOf
method __construct (line 18) | public function __construct()
method booleanValue (line 28) | public static function booleanValue(): self
FILE: hamcrest/Hamcrest/Type/IsCallable.php
class IsCallable (line 12) | class IsCallable extends IsTypeOf
method __construct (line 18) | public function __construct()
method matches (line 23) | public function matches($item): bool
method callableValue (line 33) | public static function callableValue(): self
FILE: hamcrest/Hamcrest/Type/IsDouble.php
class IsDouble (line 14) | class IsDouble extends IsTypeOf
method __construct (line 20) | public function __construct()
method doubleValue (line 30) | public static function doubleValue(): self
FILE: hamcrest/Hamcrest/Type/IsInteger.php
class IsInteger (line 12) | class IsInteger extends IsTypeOf
method __construct (line 18) | public function __construct()
method integerValue (line 28) | public static function integerValue(): self
FILE: hamcrest/Hamcrest/Type/IsNumeric.php
class IsNumeric (line 12) | class IsNumeric extends IsTypeOf
method __construct (line 15) | public function __construct()
method matches (line 20) | public function matches($item): bool
method isHexadecimal (line 36) | private function isHexadecimal($item)
method numericValue (line 50) | public static function numericValue(): self
FILE: hamcrest/Hamcrest/Type/IsObject.php
class IsObject (line 12) | class IsObject extends IsTypeOf
method __construct (line 18) | public function __construct()
method objectValue (line 28) | public static function objectValue(): self
FILE: hamcrest/Hamcrest/Type/IsResource.php
class IsResource (line 12) | class IsResource extends IsTypeOf
method __construct (line 18) | public function __construct()
method resourceValue (line 28) | public static function resourceValue(): self
FILE: hamcrest/Hamcrest/Type/IsScalar.php
class IsScalar (line 12) | class IsScalar extends IsTypeOf
method __construct (line 15) | public function __construct()
method matches (line 20) | public function matches($item): bool
method scalarValue (line 30) | public static function scalarValue(): self
FILE: hamcrest/Hamcrest/Type/IsString.php
class IsString (line 12) | class IsString extends IsTypeOf
method __construct (line 18) | public function __construct()
method stringValue (line 28) | public static function stringValue(): self
FILE: hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php
class TypeSafeDiagnosingMatcher (line 9) | abstract class TypeSafeDiagnosingMatcher extends TypeSafeMatcher
method matchesSafely (line 12) | final public function matchesSafely($actual): bool
method describeMismatchSafely (line 17) | final public function describeMismatchSafely($actual, Description $mis...
method matchesSafelyWithDiagnosticDescription (line 29) | abstract protected function matchesSafelyWithDiagnosticDescription($ac...
FILE: hamcrest/Hamcrest/TypeSafeMatcher.php
class TypeSafeMatcher (line 13) | abstract class TypeSafeMatcher extends BaseMatcher
method __construct (line 43) | public function __construct(int $expectedType, ?string $expectedSubtyp...
method matches (line 49) | final public function matches($item): bool
method describeMismatch (line 54) | final public function describeMismatch($item, Description $mismatchDes...
method matchesSafely (line 69) | abstract protected function matchesSafely($item): bool;
method describeMismatchSafely (line 75) | abstract protected function describeMismatchSafely($item, Description ...
method _isSafeType (line 82) | private function _isSafeType($value): bool
FILE: hamcrest/Hamcrest/Util.php
class Util (line 13) | class Util
method registerGlobalFunctions (line 15) | public static function registerGlobalFunctions(): void
method wrapValueWithIsEqual (line 26) | public static function wrapValueWithIsEqual($item)
method checkAllAreMatchers (line 40) | public static function checkAllAreMatchers(array $matchers): void
method createMatcherArray (line 60) | public static function createMatcherArray(array $items)
FILE: hamcrest/Hamcrest/Xml/HasXPath.php
class HasXPath (line 17) | class HasXPath extends DiagnosingMatcher
method __construct (line 38) | public function __construct(string $xpath, ?Matcher $matcher = null)
method matchesWithDiagnosticDescription (line 51) | protected function matchesWithDiagnosticDescription($actual, Descripti...
method createDocument (line 76) | protected function createDocument($text)
method evaluate (line 99) | protected function evaluate(\DOMNode $node)
method matchesContent (line 120) | protected function matchesContent(\DOMNodeList $nodes, Description $mi...
method matchesExpression (line 151) | protected function matchesExpression($result, Description $mismatchDes...
method describeTo (line 170) | public function describeTo(Description $description): void
method hasXPath (line 190) | public static function hasXPath(string $xpath, $matcher = null): self
FILE: tests/Hamcrest/AbstractMatcherTest.php
class UnknownType (line 6) | class UnknownType {
class AbstractMatcherTest (line 9) | abstract class AbstractMatcherTest extends TestCase
method setUpTest (line 18) | protected function setUpTest()
method createMatcher (line 23) | abstract protected function createMatcher();
method assertMatches (line 25) | public function assertMatches(\Hamcrest\Matcher $matcher, $arg, $message)
method assertDoesNotMatch (line 30) | public function assertDoesNotMatch(\Hamcrest\Matcher $matcher, $arg, $...
method assertDescription (line 35) | public function assertDescription($expected, \Hamcrest\Matcher $matcher)
method assertMismatchDescription (line 42) | public function assertMismatchDescription($expected, \Hamcrest\Matcher...
method testIsNullSafe (line 60) | public function testIsNullSafe()
method testCopesWithUnknownTypes (line 73) | public function testCopesWithUnknownTypes()
method tearDownTest (line 86) | protected function tearDownTest()
FILE: tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php
class IsArrayContainingInAnyOrderTest (line 6) | class IsArrayContainingInAnyOrderTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testHasAReadableDescription (line 14) | public function testHasAReadableDescription()
method testMatchesItemsInAnyOrder (line 19) | public function testMatchesItemsInAnyOrder()
method testAppliesMatchersInAnyOrder (line 26) | public function testAppliesMatchersInAnyOrder()
method testMismatchesItemsInAnyOrder (line 45) | public function testMismatchesItemsInAnyOrder()
FILE: tests/Hamcrest/Array/IsArrayContainingInOrderTest.php
class IsArrayContainingInOrderTest (line 6) | class IsArrayContainingInOrderTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testHasAReadableDescription (line 14) | public function testHasAReadableDescription()
method testMatchesItemsInOrder (line 19) | public function testMatchesItemsInOrder()
method testAppliesMatchersInOrder (line 25) | public function testAppliesMatchersInOrder()
method testMismatchesItemsInAnyOrder (line 35) | public function testMismatchesItemsInAnyOrder()
FILE: tests/Hamcrest/Array/IsArrayContainingKeyTest.php
class IsArrayContainingKeyTest (line 6) | class IsArrayContainingKeyTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testMatchesSingleElementArrayContainingKey (line 14) | public function testMatchesSingleElementArrayContainingKey()
method testMatchesArrayContainingKey (line 21) | public function testMatchesArrayContainingKey()
method testMatchesArrayContainingKeyWithIntegerKeys (line 29) | public function testMatchesArrayContainingKeyWithIntegerKeys()
method testMatchesArrayContainingKeyWithNumberKeys (line 36) | public function testMatchesArrayContainingKeyWithNumberKeys()
method testHasReadableDescription (line 46) | public function testHasReadableDescription()
method testDoesNotMatchEmptyArray (line 51) | public function testDoesNotMatchEmptyArray()
method testDoesNotMatchArrayMissingKey (line 56) | public function testDoesNotMatchArrayMissingKey()
FILE: tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php
class IsArrayContainingKeyValuePairTest (line 6) | class IsArrayContainingKeyValuePairTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testMatchesArrayContainingMatchingKeyAndValue (line 14) | public function testMatchesArrayContainingMatchingKeyAndValue()
method testDoesNotMatchNull (line 27) | public function testDoesNotMatchNull()
method testHasReadableDescription (line 32) | public function testHasReadableDescription()
FILE: tests/Hamcrest/Array/IsArrayContainingTest.php
class IsArrayContainingTest (line 6) | class IsArrayContainingTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testMatchesAnArrayThatContainsAnElementMatchingTheGivenMatcher (line 14) | public function testMatchesAnArrayThatContainsAnElementMatchingTheGive...
method testDoesNotMatchAnArrayThatDoesntContainAnElementMatchingTheGivenMatcher (line 23) | public function testDoesNotMatchAnArrayThatDoesntContainAnElementMatch...
method testDoesNotMatchNull (line 37) | public function testDoesNotMatchNull()
method testHasAReadableDescription (line 46) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Array/IsArrayTest.php
class IsArrayTest (line 6) | class IsArrayTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testMatchesAnArrayThatMatchesAllTheElementMatchers (line 14) | public function testMatchesAnArrayThatMatchesAllTheElementMatchers()
method testDoesNotMatchAnArrayWhenElementsDoNotMatch (line 23) | public function testDoesNotMatchAnArrayWhenElementsDoNotMatch()
method testDoesNotMatchAnArrayOfDifferentSize (line 32) | public function testDoesNotMatchAnArrayOfDifferentSize()
method testDoesNotMatchNull (line 46) | public function testDoesNotMatchNull()
method testHasAReadableDescription (line 55) | public function testHasAReadableDescription()
method testHasAReadableMismatchDescriptionWhenKeysDontMatch (line 63) | public function testHasAReadableMismatchDescriptionWhenKeysDontMatch()
method testSupportsMatchesAssociativeArrays (line 72) | public function testSupportsMatchesAssociativeArrays()
method testDoesNotMatchAnAssociativeArrayWhenKeysDoNotMatch (line 81) | public function testDoesNotMatchAnAssociativeArrayWhenKeysDoNotMatch()
FILE: tests/Hamcrest/Array/IsArrayWithSizeTest.php
class IsArrayWithSizeTest (line 6) | class IsArrayWithSizeTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testMatchesWhenSizeIsCorrect (line 14) | public function testMatchesWhenSizeIsCorrect()
method testProvidesConvenientShortcutForArrayWithSizeEqualTo (line 20) | public function testProvidesConvenientShortcutForArrayWithSizeEqualTo()
method testEmptyArray (line 26) | public function testEmptyArray()
method testHasAReadableDescription (line 32) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/BaseMatcherTest.php
class BaseMatcherTest (line 5) | class BaseMatcherTest extends \Hamcrest\BaseMatcher
method matches (line 8) | public function matches($item): bool
method describeTo (line 13) | public function describeTo(\Hamcrest\Description $description): void
method testDescribesItselfWithToStringMethod (line 18) | public function testDescribesItselfWithToStringMethod()
FILE: tests/Hamcrest/Collection/IsEmptyTraversableTest.php
class IsEmptyTraversableTest (line 6) | class IsEmptyTraversableTest extends AbstractMatcherTest
method createMatcher (line 9) | protected function createMatcher()
method testEmptyMatcherMatchesWhenEmpty (line 14) | public function testEmptyMatcherMatchesWhenEmpty()
method testEmptyMatcherDoesNotMatchWhenNotEmpty (line 23) | public function testEmptyMatcherDoesNotMatchWhenNotEmpty()
method testEmptyMatcherDoesNotMatchNull (line 32) | public function testEmptyMatcherDoesNotMatchNull()
method testEmptyMatcherHasAReadableDescription (line 41) | public function testEmptyMatcherHasAReadableDescription()
method testNonEmptyDoesNotMatchNull (line 46) | public function testNonEmptyDoesNotMatchNull()
method testNonEmptyDoesNotMatchWhenEmpty (line 55) | public function testNonEmptyDoesNotMatchWhenEmpty()
method testNonEmptyMatchesWhenNotEmpty (line 64) | public function testNonEmptyMatchesWhenNotEmpty()
method testNonEmptyNonEmptyMatcherHasAReadableDescription (line 73) | public function testNonEmptyNonEmptyMatcherHasAReadableDescription()
FILE: tests/Hamcrest/Collection/IsTraversableWithSizeTest.php
class IsTraversableWithSizeTest (line 4) | class IsTraversableWithSizeTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testMatchesWhenSizeIsCorrect (line 14) | public function testMatchesWhenSizeIsCorrect()
method testDoesNotMatchWhenSizeIsIncorrect (line 23) | public function testDoesNotMatchWhenSizeIsIncorrect()
method testDoesNotMatchNull (line 32) | public function testDoesNotMatchNull()
method testProvidesConvenientShortcutForTraversableWithSizeEqualTo (line 41) | public function testProvidesConvenientShortcutForTraversableWithSizeEq...
method testHasAReadableDescription (line 50) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Core/AllOfTest.php
class AllOfTest (line 4) | class AllOfTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTheLogicalConjunctionOfTwoOtherMatchers (line 12) | public function testEvaluatesToTheLogicalConjunctionOfTwoOtherMatchers()
method testEvaluatesToTheLogicalConjunctionOfManyOtherMatchers (line 21) | public function testEvaluatesToTheLogicalConjunctionOfManyOtherMatchers()
method testSupportsMixedTypes (line 27) | public function testSupportsMixedTypes()
method testHasAReadableDescription (line 40) | public function testHasAReadableDescription()
method testMismatchDescriptionDescribesFirstFailingMatch (line 48) | public function testMismatchDescriptionDescribesFirstFailingMatch()
FILE: tests/Hamcrest/Core/AnyOfTest.php
class AnyOfTest (line 4) | class AnyOfTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testAnyOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers (line 12) | public function testAnyOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMat...
method testAnyOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers (line 21) | public function testAnyOfEvaluatesToTheLogicalDisjunctionOfManyOtherMa...
method testAnyOfSupportsMixedTypes (line 27) | public function testAnyOfSupportsMixedTypes()
method testAnyOfHasAReadableDescription (line 38) | public function testAnyOfHasAReadableDescription()
method testNoneOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers (line 46) | public function testNoneOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMa...
method testNoneOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers (line 55) | public function testNoneOfEvaluatesToTheLogicalDisjunctionOfManyOtherM...
method testNoneOfSupportsMixedTypes (line 61) | public function testNoneOfSupportsMixedTypes()
method testNoneOfHasAReadableDescription (line 72) | public function testNoneOfHasAReadableDescription()
FILE: tests/Hamcrest/Core/CombinableMatcherTest.php
class CombinableMatcherTest (line 4) | class CombinableMatcherTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 13) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testBothAcceptsAndRejects (line 26) | public function testBothAcceptsAndRejects()
method testAcceptsAndRejectsThreeAnds (line 32) | public function testAcceptsAndRejectsThreeAnds()
method testBothDescribesItself (line 39) | public function testBothDescribesItself()
method testEitherAcceptsAndRejects (line 45) | public function testEitherAcceptsAndRejects()
method testAcceptsAndRejectsThreeOrs (line 51) | public function testAcceptsAndRejectsThreeOrs()
method testEitherDescribesItself (line 59) | public function testEitherDescribesItself()
FILE: tests/Hamcrest/Core/DescribedAsTest.php
class DescribedAsTest (line 4) | class DescribedAsTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testOverridesDescriptionOfOtherMatcherWithThatPassedToConstructor (line 12) | public function testOverridesDescriptionOfOtherMatcherWithThatPassedTo...
method testAppendsValuesToDescription (line 21) | public function testAppendsValuesToDescription()
method testDelegatesMatchingToAnotherMatcher (line 28) | public function testDelegatesMatchingToAnotherMatcher()
FILE: tests/Hamcrest/Core/EveryTest.php
class EveryTest (line 4) | class EveryTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testIsTrueWhenEveryValueMatches (line 12) | public function testIsTrueWhenEveryValueMatches()
method testIsAlwaysTrueForEmptyLists (line 18) | public function testIsAlwaysTrueForEmptyLists()
method testDescribesItself (line 23) | public function testDescribesItself()
FILE: tests/Hamcrest/Core/HasToStringTest.php
class PhpForm (line 4) | class PhpForm
method __toString (line 6) | public function __toString()
class JavaForm (line 12) | class JavaForm
method toString (line 14) | public function toString()
class BothForms (line 20) | class BothForms
method __toString (line 22) | public function __toString()
method toString (line 27) | public function toString()
class HasToStringTest (line 33) | class HasToStringTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 36) | protected function createMatcher()
method testMatchesWhenToStringMatches (line 41) | public function testMatchesWhenToStringMatches()
method testPicksJavaOverPhpToString (line 55) | public function testPicksJavaOverPhpToString()
method testDoesNotMatchWhenToStringDoesNotMatch (line 64) | public function testDoesNotMatchWhenToStringDoesNotMatch()
method testDoesNotMatchNull (line 83) | public function testDoesNotMatchNull()
method testProvidesConvenientShortcutForTraversableWithSizeEqualTo (line 92) | public function testProvidesConvenientShortcutForTraversableWithSizeEq...
method testHasAReadableDescription (line 101) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Core/IsAnythingTest.php
class IsAnythingTest (line 4) | class IsAnythingTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testAlwaysEvaluatesToTrue (line 12) | public function testAlwaysEvaluatesToTrue()
method testHasUsefulDefaultDescription (line 19) | public function testHasUsefulDefaultDescription()
method testCanOverrideDescription (line 24) | public function testCanOverrideDescription()
FILE: tests/Hamcrest/Core/IsCollectionContainingTest.php
class IsCollectionContainingTest (line 4) | class IsCollectionContainingTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testMatchesACollectionThatContainsAnElementMatchingTheGivenMatcher (line 12) | public function testMatchesACollectionThatContainsAnElementMatchingThe...
method testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGivenMatcher (line 23) | public function testDoesNotMatchCollectionThatDoesntContainAnElementMa...
method testDoesNotMatchNull (line 40) | public function testDoesNotMatchNull()
method testHasAReadableDescription (line 49) | public function testHasAReadableDescription()
method testMatchesAllItemsInCollection (line 54) | public function testMatchesAllItemsInCollection()
FILE: tests/Hamcrest/Core/IsEqualTest.php
class DummyToStringClass (line 4) | class DummyToStringClass
method __construct (line 8) | public function __construct($arg)
method __toString (line 13) | public function __toString()
class IsEqualTest (line 19) | class IsEqualTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 22) | protected function createMatcher()
method testComparesObjectsUsingEqualityOperator (line 27) | public function testComparesObjectsUsingEqualityOperator()
method testCanCompareNullValues (line 38) | public function testCanCompareNullValues()
method testComparesTheElementsOfAnArray (line 46) | public function testComparesTheElementsOfAnArray()
method testComparesTheElementsOfAnArrayOfPrimitiveTypes (line 59) | public function testComparesTheElementsOfAnArrayOfPrimitiveTypes()
method testRecursivelyTestsElementsOfArrays (line 72) | public function testRecursivelyTestsElementsOfArrays()
method testIncludesTheResultOfCallingToStringOnItsArgumentInTheDescription (line 85) | public function testIncludesTheResultOfCallingToStringOnItsArgumentInT...
method testReturnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake (line 92) | public function testReturnsAnObviousDescriptionIfCreatedWithANestedMat...
method testReturnsGoodDescriptionIfCreatedWithNullReference (line 98) | public function testReturnsGoodDescriptionIfCreatedWithNullReference()
FILE: tests/Hamcrest/Core/IsIdenticalTest.php
class IsIdenticalTest (line 4) | class IsIdenticalTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject (line 12) | public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedOb...
method testReturnsReadableDescriptionFromToString (line 21) | public function testReturnsReadableDescriptionFromToString()
method testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull (line 26) | public function testReturnsReadableDescriptionFromToStringWhenInitiali...
FILE: tests/Hamcrest/Core/IsInstanceOfTest.php
class IsInstanceOfTest (line 4) | class IsInstanceOfTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 13) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher(): IsInstanceOf
method testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass (line 26) | public function testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass()
method testEvaluatesToFalseIfArgumentIsNotAnObject (line 34) | public function testEvaluatesToFalseIfArgumentIsNotAnObject()
method testHasAReadableDescription (line 43) | public function testHasAReadableDescription()
method testDecribesActualClassInMismatchMessage (line 48) | public function testDecribesActualClassInMismatchMessage()
FILE: tests/Hamcrest/Core/IsNotTest.php
class IsNotTest (line 4) | class IsNotTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTheTheLogicalNegationOfAnotherMatcher (line 12) | public function testEvaluatesToTheTheLogicalNegationOfAnotherMatcher()
method testProvidesConvenientShortcutForNotEqualTo (line 18) | public function testProvidesConvenientShortcutForNotEqualTo()
method testUsesDescriptionOfNegatedMatcherWithPrefix (line 26) | public function testUsesDescriptionOfNegatedMatcherWithPrefix()
FILE: tests/Hamcrest/Core/IsNullTest.php
class IsNullTest (line 4) | class IsNullTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentIsNull (line 12) | public function testEvaluatesToTrueIfArgumentIsNull()
FILE: tests/Hamcrest/Core/IsSameTest.php
class IsSameTest (line 4) | class IsSameTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedObject (line 12) | public function testEvaluatesToTrueIfArgumentIsReferenceToASpecifiedOb...
method testReturnsReadableDescriptionFromToString (line 21) | public function testReturnsReadableDescriptionFromToString()
method testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull (line 26) | public function testReturnsReadableDescriptionFromToStringWhenInitiali...
FILE: tests/Hamcrest/Core/IsTest.php
class IsTest (line 4) | class IsTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testJustMatchesTheSameWayTheUnderylingMatcherDoes (line 12) | public function testJustMatchesTheSameWayTheUnderylingMatcherDoes()
method testGeneratesIsPrefixInDescription (line 20) | public function testGeneratesIsPrefixInDescription()
method testProvidesConvenientShortcutForIsEqualTo (line 25) | public function testProvidesConvenientShortcutForIsEqualTo()
FILE: tests/Hamcrest/Core/IsTypeOfTest.php
class IsTypeOfTest (line 4) | class IsTypeOfTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 23) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 34) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 40) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Core/SampleBaseClass.php
class SampleBaseClass (line 4) | class SampleBaseClass
method __construct (line 9) | public function __construct($arg)
method __toString (line 14) | public function __toString()
FILE: tests/Hamcrest/Core/SampleSubClass.php
class SampleSubClass (line 4) | class SampleSubClass extends \Hamcrest\Core\SampleBaseClass
FILE: tests/Hamcrest/Core/SetTest.php
class SetTest (line 4) | class SetTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 13) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testEvaluatesToTrueIfArrayPropertyIsSet (line 26) | public function testEvaluatesToTrueIfArrayPropertyIsSet()
method testNegatedEvaluatesToFalseIfArrayPropertyIsSet (line 31) | public function testNegatedEvaluatesToFalseIfArrayPropertyIsSet()
method testEvaluatesToTrueIfClassPropertyIsSet (line 36) | public function testEvaluatesToTrueIfClassPropertyIsSet()
method testNegatedEvaluatesToFalseIfClassPropertyIsSet (line 42) | public function testNegatedEvaluatesToFalseIfClassPropertyIsSet()
method testEvaluatesToTrueIfObjectPropertyIsSet (line 48) | public function testEvaluatesToTrueIfObjectPropertyIsSet()
method testNegatedEvaluatesToFalseIfObjectPropertyIsSet (line 54) | public function testNegatedEvaluatesToFalseIfObjectPropertyIsSet()
method testEvaluatesToFalseIfArrayPropertyIsNotSet (line 60) | public function testEvaluatesToFalseIfArrayPropertyIsNotSet()
method testNegatedEvaluatesToTrueIfArrayPropertyIsNotSet (line 65) | public function testNegatedEvaluatesToTrueIfArrayPropertyIsNotSet()
method testEvaluatesToFalseIfClassPropertyIsNotSet (line 70) | public function testEvaluatesToFalseIfClassPropertyIsNotSet()
method testNegatedEvaluatesToTrueIfClassPropertyIsNotSet (line 75) | public function testNegatedEvaluatesToTrueIfClassPropertyIsNotSet()
method testEvaluatesToFalseIfObjectPropertyIsNotSet (line 80) | public function testEvaluatesToFalseIfObjectPropertyIsNotSet()
method testNegatedEvaluatesToTrueIfObjectPropertyIsNotSet (line 85) | public function testNegatedEvaluatesToTrueIfObjectPropertyIsNotSet()
method testHasAReadableDescription (line 90) | public function testHasAReadableDescription()
method testDecribesPropertySettingInMismatchMessage (line 96) | public function testDecribesPropertySettingInMismatchMessage()
FILE: tests/Hamcrest/FeatureMatcherTest.php
class Thingy (line 4) | class Thingy
method __construct (line 7) | public function __construct($result)
method getResult (line 11) | public function getResult()
class ResultMatcher (line 18) | class ResultMatcher extends \Hamcrest\FeatureMatcher
method __construct (line 20) | public function __construct()
method featureValueOf (line 24) | public function featureValueOf($actual)
class FeatureMatcherTest (line 32) | class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 40) | protected function setUpTest()
method createMatcher (line 47) | protected function createMatcher()
method testMatchesPartOfAnObject (line 52) | public function testMatchesPartOfAnObject()
method testMismatchesPartOfAnObject (line 58) | public function testMismatchesPartOfAnObject()
method testDoesNotGenerateNoticesForNull (line 67) | public function testDoesNotGenerateNoticesForNull()
method _resultMatcher (line 74) | private function _resultMatcher()
FILE: tests/Hamcrest/InvokedMatcherTest.php
class SampleInvokeMatcher (line 6) | class SampleInvokeMatcher extends BaseMatcherTest
method __construct (line 10) | public function __construct($matchAgainst)
method matches (line 15) | public function matches($item): bool
class InvokedMatcherTest (line 22) | class InvokedMatcherTest extends TestCase
method testInvokedMatchersCallMatches (line 24) | public function testInvokedMatchersCallMatches()
FILE: tests/Hamcrest/MatcherAssertTest.php
class MatcherAssertTest (line 6) | class MatcherAssertTest extends TestCase
method setUpTest (line 12) | protected function setUpTest()
method testResetCount (line 17) | public function testResetCount()
method testAssertThatWithTrueArgPasses (line 25) | public function testAssertThatWithTrueArgPasses()
method testAssertThatWithFalseArgFails (line 35) | public function testAssertThatWithFalseArgFails()
method testAssertThatWithIdentifierAndTrueArgPasses (line 76) | public function testAssertThatWithIdentifierAndTrueArgPasses()
method testAssertThatWithIdentifierAndFalseArgFails (line 86) | public function testAssertThatWithIdentifierAndFalseArgFails()
method testAssertThatWithActualValueAndMatcherArgsThatMatchPasses (line 127) | public function testAssertThatWithActualValueAndMatcherArgsThatMatchPa...
method testAssertThatWithActualValueAndMatcherArgsThatDontMatchFails (line 133) | public function testAssertThatWithActualValueAndMatcherArgsThatDontMat...
method testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatMatchPasses (line 151) | public function testAssertThatWithIdentifierAndActualValueAndMatcherAr...
method testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatDontMatchFails (line 157) | public function testAssertThatWithIdentifierAndActualValueAndMatcherAr...
method testAssertThatWithNoArgsThrowsErrorAndDoesntIncrementCount (line 176) | public function testAssertThatWithNoArgsThrowsErrorAndDoesntIncrementC...
method testAssertThatWithFourArgsThrowsErrorAndDoesntIncrementCount (line 186) | public function testAssertThatWithFourArgsThrowsErrorAndDoesntIncremen...
FILE: tests/Hamcrest/Number/IsCloseToTest.php
class IsCloseToTest (line 4) | class IsCloseToTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentIsEqualToADoubleValueWithinSomeError (line 14) | public function testEvaluatesToTrueIfArgumentIsEqualToADoubleValueWith...
FILE: tests/Hamcrest/Number/OrderingComparisonTest.php
class OrderingComparisonTest (line 4) | class OrderingComparisonTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testComparesValuesForGreaterThan (line 12) | public function testComparesValuesForGreaterThan()
method testComparesValuesForLessThan (line 18) | public function testComparesValuesForLessThan()
method testComparesValuesForEquality (line 24) | public function testComparesValuesForEquality()
method testAllowsForInclusiveComparisons (line 30) | public function testAllowsForInclusiveComparisons()
method testSupportsDifferentTypesOfComparableValues (line 36) | public function testSupportsDifferentTypesOfComparableValues()
FILE: tests/Hamcrest/StringDescriptionTest.php
class SampleSelfDescriber (line 6) | class SampleSelfDescriber implements \Hamcrest\SelfDescribing
method __construct (line 10) | public function __construct($text)
method describeTo (line 15) | public function describeTo(\Hamcrest\Description $description): void
class StringDescriptionTest (line 21) | class StringDescriptionTest extends TestCase
method setUpTest (line 29) | protected function setUpTest()
method testAppendTextAppendsTextInformation (line 34) | public function testAppendTextAppendsTextInformation()
method testAppendValueCanAppendTextTypes (line 40) | public function testAppendValueCanAppendTextTypes()
method testSpecialCharactersAreEscapedForStringTypes (line 46) | public function testSpecialCharactersAreEscapedForStringTypes()
method testIntegerValuesCanBeAppended (line 52) | public function testIntegerValuesCanBeAppended()
method testFloatValuesCanBeAppended (line 58) | public function testFloatValuesCanBeAppended()
method testNullValuesCanBeAppended (line 64) | public function testNullValuesCanBeAppended()
method testArraysCanBeAppended (line 70) | public function testArraysCanBeAppended()
method testObjectsCanBeAppended (line 76) | public function testObjectsCanBeAppended()
method testBooleanValuesCanBeAppended (line 82) | public function testBooleanValuesCanBeAppended()
method testListsOfvaluesCanBeAppended (line 88) | public function testListsOfvaluesCanBeAppended()
method testIterableOfvaluesCanBeAppended (line 94) | public function testIterableOfvaluesCanBeAppended()
method testIteratorOfvaluesCanBeAppended (line 101) | public function testIteratorOfvaluesCanBeAppended()
method testListsOfvaluesCanBeAppendedManually (line 108) | public function testListsOfvaluesCanBeAppendedManually()
method testIterableOfvaluesCanBeAppendedManually (line 114) | public function testIterableOfvaluesCanBeAppendedManually()
method testIteratorOfvaluesCanBeAppendedManually (line 121) | public function testIteratorOfvaluesCanBeAppendedManually()
method testSelfDescribingObjectsCanBeAppended (line 128) | public function testSelfDescribingObjectsCanBeAppended()
method testSelfDescribingObjectsCanBeAppendedAsLists (line 137) | public function testSelfDescribingObjectsCanBeAppendedAsLists()
method testSelfDescribingObjectsCanBeAppendedAsIteratedLists (line 146) | public function testSelfDescribingObjectsCanBeAppendedAsIteratedLists()
method testSelfDescribingObjectsCanBeAppendedAsIterators (line 156) | public function testSelfDescribingObjectsCanBeAppendedAsIterators()
method testToStringAppendsSelfDescribing (line 166) | public function testToStringAppendsSelfDescribing()
FILE: tests/Hamcrest/Text/IsEmptyStringTest.php
class IsEmptyStringTest (line 4) | class IsEmptyStringTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEmptyDoesNotMatchNull (line 12) | public function testEmptyDoesNotMatchNull()
method testEmptyDoesNotMatchZero (line 17) | public function testEmptyDoesNotMatchZero()
method testEmptyDoesNotMatchFalse (line 22) | public function testEmptyDoesNotMatchFalse()
method testEmptyDoesNotMatchEmptyArray (line 27) | public function testEmptyDoesNotMatchEmptyArray()
method testEmptyMatchesEmptyString (line 32) | public function testEmptyMatchesEmptyString()
method testEmptyDoesNotMatchNonEmptyString (line 37) | public function testEmptyDoesNotMatchNonEmptyString()
method testEmptyHasAReadableDescription (line 42) | public function testEmptyHasAReadableDescription()
method testEmptyOrNullMatchesNull (line 47) | public function testEmptyOrNullMatchesNull()
method testEmptyOrNullMatchesEmptyString (line 52) | public function testEmptyOrNullMatchesEmptyString()
method testEmptyOrNullDoesNotMatchNonEmptyString (line 57) | public function testEmptyOrNullDoesNotMatchNonEmptyString()
method testEmptyOrNullHasAReadableDescription (line 62) | public function testEmptyOrNullHasAReadableDescription()
method testNonEmptyDoesNotMatchNull (line 67) | public function testNonEmptyDoesNotMatchNull()
method testNonEmptyDoesNotMatchEmptyString (line 72) | public function testNonEmptyDoesNotMatchEmptyString()
method testNonEmptyMatchesNonEmptyString (line 77) | public function testNonEmptyMatchesNonEmptyString()
method testNonEmptyHasAReadableDescription (line 82) | public function testNonEmptyHasAReadableDescription()
FILE: tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php
class IsEqualIgnoringCaseTest (line 4) | class IsEqualIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testIgnoresCaseOfCharsInString (line 12) | public function testIgnoresCaseOfCharsInString()
method testFailsIfAdditionalWhitespaceIsPresent (line 21) | public function testFailsIfAdditionalWhitespaceIsPresent()
method testFailsIfMatchingAgainstNull (line 28) | public function testFailsIfMatchingAgainstNull()
method testDescribesItselfAsCaseInsensitive (line 33) | public function testDescribesItselfAsCaseInsensitive()
FILE: tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php
class IsEqualIgnoringWhiteSpaceTest (line 4) | class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 12) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testPassesIfWordsAreSameButWhitespaceDiffers (line 26) | public function testPassesIfWordsAreSameButWhitespaceDiffers()
method testFailsIfTextOtherThanWhitespaceDiffers (line 32) | public function testFailsIfTextOtherThanWhitespaceDiffers()
method testFailsIfWhitespaceIsAddedOrRemovedInMidWord (line 38) | public function testFailsIfWhitespaceIsAddedOrRemovedInMidWord()
method testFailsIfMatchingAgainstNull (line 44) | public function testFailsIfMatchingAgainstNull()
method testHasAReadableDescription (line 49) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/MatchesPatternTest.php
class MatchesPatternTest (line 4) | class MatchesPatternTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentmatchesPattern (line 12) | public function testEvaluatesToTrueIfArgumentmatchesPattern()
method testEvaluatesToFalseIfArgumentDoesntMatchRegex (line 20) | public function testEvaluatesToFalseIfArgumentDoesntMatchRegex()
method testHasAReadableDescription (line 26) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php
class StringContainsIgnoringCaseTest (line 4) | class StringContainsIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 14) | protected function setUpTest()
method createMatcher (line 23) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring (line 28) | public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring()
method testEvaluatesToTrueIfArgumentIsEqualToSubstring (line 57) | public function testEvaluatesToTrueIfArgumentIsEqualToSubstring()
method testEvaluatesToTrueIfArgumentContainsExactSubstring (line 65) | public function testEvaluatesToTrueIfArgumentContainsExactSubstring()
method testHasAReadableDescription (line 77) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/StringContainsInOrderTest.php
class StringContainsInOrderTest (line 4) | class StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 12) | protected function setUpTest()
method createMatcher (line 19) | protected function createMatcher()
method testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder (line 24) | public function testMatchesOnlyIfStringContainsGivenSubstringsInTheSam...
method testAcceptsVariableArguments (line 35) | public function testAcceptsVariableArguments()
method testHasAReadableDescription (line 40) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/StringContainsTest.php
class StringContainsTest (line 4) | class StringContainsTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 14) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentContainsSubstring (line 26) | public function testEvaluatesToTrueIfArgumentContainsSubstring()
method testEvaluatesToTrueIfArgumentIsEqualToSubstring (line 55) | public function testEvaluatesToTrueIfArgumentIsEqualToSubstring()
method testEvaluatesToFalseIfArgumentContainsSubstringIgnoringCase (line 63) | public function testEvaluatesToFalseIfArgumentContainsSubstringIgnorin...
method testIgnoringCaseReturnsCorrectMatcher (line 75) | public function testIgnoringCaseReturnsCorrectMatcher()
method testHasAReadableDescription (line 83) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/StringEndsWithTest.php
class StringEndsWithTest (line 4) | class StringEndsWithTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 14) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring (line 26) | public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring()
method testEvaluatesToTrueIfArgumentIsEqualToSubstring (line 55) | public function testEvaluatesToTrueIfArgumentIsEqualToSubstring()
method testHasAReadableDescription (line 63) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Text/StringStartsWithTest.php
class StringStartsWithTest (line 4) | class StringStartsWithTest extends \Hamcrest\AbstractMatcherTest
method setUpTest (line 14) | protected function setUpTest()
method createMatcher (line 21) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring (line 26) | public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring()
method testEvaluatesToTrueIfArgumentIsEqualToSubstring (line 55) | public function testEvaluatesToTrueIfArgumentIsEqualToSubstring()
method testHasAReadableDescription (line 63) | public function testHasAReadableDescription()
FILE: tests/Hamcrest/Type/IsArrayTest.php
class IsArrayTest (line 4) | class IsArrayTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 18) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 25) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 30) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsBooleanTest.php
class IsBooleanTest (line 4) | class IsBooleanTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 18) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 25) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 30) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsCallableTest.php
class IsCallableTest (line 4) | class IsCallableTest extends \Hamcrest\AbstractMatcherTest
method callableFunction (line 7) | public static function callableFunction()
method __invoke (line 11) | public function __invoke()
method createMatcher (line 15) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentIsFunctionName (line 20) | public function testEvaluatesToTrueIfArgumentIsFunctionName()
method testEvaluatesToTrueIfArgumentIsStaticMethodCallback (line 25) | public function testEvaluatesToTrueIfArgumentIsStaticMethodCallback()
method testEvaluatesToTrueIfArgumentIsInstanceMethodCallback (line 33) | public function testEvaluatesToTrueIfArgumentIsInstanceMethodCallback()
method testEvaluatesToTrueIfArgumentIsClosure (line 41) | public function testEvaluatesToTrueIfArgumentIsClosure()
method testEvaluatesToTrueIfArgumentImplementsInvoke (line 49) | public function testEvaluatesToTrueIfArgumentImplementsInvoke()
method testEvaluatesToFalseIfArgumentIsInvalidFunctionName (line 57) | public function testEvaluatesToFalseIfArgumentIsInvalidFunctionName()
method testEvaluatesToFalseIfArgumentIsInvalidStaticMethodCallback (line 66) | public function testEvaluatesToFalseIfArgumentIsInvalidStaticMethodCal...
method testEvaluatesToFalseIfArgumentIsInvalidInstanceMethodCallback (line 74) | public function testEvaluatesToFalseIfArgumentIsInvalidInstanceMethodC...
method testEvaluatesToFalseIfArgumentDoesntImplementInvoke (line 79) | public function testEvaluatesToFalseIfArgumentDoesntImplementInvoke()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 84) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 90) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 95) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsDoubleTest.php
class IsDoubleTest (line 4) | class IsDoubleTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 18) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 25) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 30) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsIntegerTest.php
class IsIntegerTest (line 4) | class IsIntegerTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 19) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 26) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 31) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsNumericTest.php
class IsNumericTest (line 4) | class IsNumericTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 32) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 43) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 48) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsObjectTest.php
class IsObjectTest (line 4) | class IsObjectTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 17) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 24) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 29) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsResourceTest.php
class IsResourceTest (line 4) | class IsResourceTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 17) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 24) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 29) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsScalarTest.php
class IsScalarTest (line 4) | class IsScalarTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 20) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 29) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 34) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/Type/IsStringTest.php
class IsStringTest (line 4) | class IsStringTest extends \Hamcrest\AbstractMatcherTest
method createMatcher (line 7) | protected function createMatcher()
method testEvaluatesToTrueIfArgumentMatchesType (line 12) | public function testEvaluatesToTrueIfArgumentMatchesType()
method testEvaluatesToFalseIfArgumentDoesntMatchType (line 18) | public function testEvaluatesToFalseIfArgumentDoesntMatchType()
method testHasAReadableDescription (line 25) | public function testHasAReadableDescription()
method testDecribesActualTypeInMismatchMessage (line 30) | public function testDecribesActualTypeInMismatchMessage()
FILE: tests/Hamcrest/UtilTest.php
class UtilTest (line 6) | class UtilTest extends TestCase
method testWrapValueWithIsEqualLeavesMatchersUntouched (line 9) | public function testWrapValueWithIsEqualLeavesMatchersUntouched()
method testWrapValueWithIsEqualWrapsPrimitive (line 16) | public function testWrapValueWithIsEqualWrapsPrimitive()
method testCheckAllAreMatchersAcceptsMatchers (line 26) | public function testCheckAllAreMatchersAcceptsMatchers()
method testCheckAllAreMatchersFailsForPrimitive (line 34) | public function testCheckAllAreMatchersFailsForPrimitive()
method callAndAssertCreateMatcherArray (line 52) | private function callAndAssertCreateMatcherArray($items)
method testCreateMatcherArrayLeavesMatchersUntouched (line 64) | public function testCreateMatcherArrayLeavesMatchersUntouched()
method testCreateMatcherArrayWrapsPrimitiveWithIsEqualMatcher (line 72) | public function testCreateMatcherArrayWrapsPrimitiveWithIsEqualMatcher()
method testCreateMatcherArrayDoesntModifyOriginalArray (line 79) | public function testCreateMatcherArrayDoesntModifyOriginalArray()
method testCreateMatcherArrayUnwrapsSingleArrayElement (line 86) | public function testCreateMatcherArrayUnwrapsSingleArrayElement()
FILE: tests/Hamcrest/Xml/HasXPathTest.php
class HasXPathTest (line 4) | class HasXPathTest extends \Hamcrest\AbstractMatcherTest
method setUpBeforeClassTest (line 13) | public static function setUpBeforeClassTest()
method createMatcher (line 51) | protected function createMatcher()
method testMatchesWhenXPathIsFound (line 56) | public function testMatchesWhenXPathIsFound()
method testDoesNotMatchWhenXPathIsNotFound (line 62) | public function testDoesNotMatchWhenXPathIsNotFound()
method testMatchesWhenExpressionWithoutMatcherEvaluatesToTrue (line 71) | public function testMatchesWhenExpressionWithoutMatcherEvaluatesToTrue()
method testDoesNotMatchWhenExpressionWithoutMatcherEvaluatesToFalse (line 80) | public function testDoesNotMatchWhenExpressionWithoutMatcherEvaluatesT...
method testMatchesWhenExpressionIsEqual (line 89) | public function testMatchesWhenExpressionIsEqual()
method testDoesNotMatchWhenExpressionIsNotEqual (line 103) | public function testDoesNotMatchWhenExpressionIsNotEqual()
method testMatchesWhenContentMatches (line 117) | public function testMatchesWhenContentMatches()
method testDoesNotMatchWhenContentDoesNotMatch (line 131) | public function testDoesNotMatchWhenContentDoesNotMatch()
method testProvidesConvenientShortcutForHasXPathEqualTo (line 145) | public function testProvidesConvenientShortcutForHasXPathEqualTo()
method testProvidesConvenientShortcutForHasXPathCountEqualTo (line 151) | public function testProvidesConvenientShortcutForHasXPathCountEqualTo()
method testMatchesAcceptsXmlString (line 156) | public function testMatchesAcceptsXmlString()
method testMatchesAcceptsHtmlString (line 161) | public function testMatchesAcceptsHtmlString()
method testHasAReadableDescription (line 166) | public function testHasAReadableDescription()
method testHasAReadableMismatchDescription (line 183) | public function testHasAReadableMismatchDescription()
Condensed preview — 156 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (317K chars).
[
{
"path": ".coveralls.yml",
"chars": 18,
"preview": "src_dir: hamcrest\n"
},
{
"path": ".gitattributes",
"chars": 133,
"preview": "/.coveralls.yml export-ignore\r\n/.gush.yml export-ignore\r\n/.travis.yml export-ignore\r\n/.github export-ignore\r\n/tests expo"
},
{
"path": ".github/workflows/ci.yml",
"chars": 1275,
"preview": "name: ci\n\non:\n push:\n pull_request:\n\njobs:\n static_analysis:\n name: Static analysis\n runs-on: ubuntu-latest\n\n "
},
{
"path": ".gitignore",
"chars": 67,
"preview": "composer.lock\ntests/.phpunit.result.cache\ntests/phpunit.xml\nvendor\n"
},
{
"path": ".gush.yml",
"chars": 184,
"preview": "adapter: github\nissue_tracker: github\nmeta-header: \"Copyright (c) 2009-2015 hamcrest.org\"\ntable-pr:\n fixed_tickets: ["
},
{
"path": "CHANGES.txt",
"chars": 5605,
"preview": "== Version 2.1.1: Released Apr 30 2025 ==\n\n* Fix implicitly nullable via default value null for PHP 8.4 (#85)\n\n== Versio"
},
{
"path": "CONTRIBUTING.md",
"chars": 1747,
"preview": "# Contributing\nhamcrest-php is an open source, community-driven project. If you'd like to contribute, feel free to do th"
},
{
"path": "LICENSE.txt",
"chars": 1482,
"preview": "BSD License\n\nCopyright (c) 2000-2025, www.hamcrest.org\nAll rights reserved.\n\nRedistribution and use in source and binary"
},
{
"path": "README.md",
"chars": 11250,
"preview": "This is the PHP port of Hamcrest Matchers\n=========================================\n\n[ 2009 hamcrest.org\n */\n\nclass FactoryCall\n{\n /**\n * Hamcrest standard is two spaces for e"
},
{
"path": "generator/FactoryClass.php",
"chars": 1386,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass FactoryClass\n{\n /**\n * @var string\n */\n private $fil"
},
{
"path": "generator/FactoryFile.php",
"chars": 3671,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nabstract class FactoryFile\n{\n /**\n * Hamcrest standard is two spa"
},
{
"path": "generator/FactoryGenerator.php",
"chars": 2996,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Controls the process of extracting @factory doctags\n * and genera"
},
{
"path": "generator/FactoryMethod.php",
"chars": 6003,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Represents a single static factory method from a {@link Matcher} "
},
{
"path": "generator/FactoryParameter.php",
"chars": 3539,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass FactoryParameter\n{\n /**\n * @var FactoryMethod\n */\n p"
},
{
"path": "generator/GlobalFunctionFile.php",
"chars": 930,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass GlobalFunctionFile extends FactoryFile\n{\n /**\n * @var strin"
},
{
"path": "generator/StaticMethodFile.php",
"chars": 773,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass StaticMethodFile extends FactoryFile\n{\n /**\n * @var string "
},
{
"path": "generator/parts/file_header.txt",
"chars": 120,
"preview": "<?php\n\n/*\n Copyright (c) 2009-2010 hamcrest.org\n */\n\n// This file is generated from the static method @factory doctags.\n"
},
{
"path": "generator/parts/functions_footer.txt",
"chars": 0,
"preview": ""
},
{
"path": "generator/parts/functions_header.txt",
"chars": 660,
"preview": "\nif (!function_exists('assertThat')) {\n /**\n * Make an assertion and throw {@link Hamcrest_AssertionError} if it "
},
{
"path": "generator/parts/functions_imports.txt",
"chars": 0,
"preview": ""
},
{
"path": "generator/parts/matchers_footer.txt",
"chars": 2,
"preview": "}\n"
},
{
"path": "generator/parts/matchers_header.txt",
"chars": 86,
"preview": "\n\n/**\n * A series of static factories for all hamcrest matchers.\n */\nclass Matchers\n{\n"
},
{
"path": "generator/parts/matchers_imports.txt",
"chars": 20,
"preview": "\nnamespace Hamcrest;"
},
{
"path": "generator/run.php",
"chars": 1083,
"preview": "<?php\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nrequire __DIR__ . '/../vendor/autoload.php';\n\n/*\n * Generates the Hamcres"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArray.php",
"chars": 3375,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n// NOTE: This class is not exactly a direct p"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayContaining.php",
"chars": 1529,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php",
"chars": 1649,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php",
"chars": 1543,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php",
"chars": 1996,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php",
"chars": 2350,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/**\n * Tests for the presence of both a key and value inside an array.\n */\nuse Hamcres"
},
{
"path": "hamcrest/Hamcrest/Arrays/IsArrayWithSize.php",
"chars": 1517,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Core\\DescribedAs;\nuse Hamcrest\\Co"
},
{
"path": "hamcrest/Hamcrest/Arrays/MatchingOnce.php",
"chars": 1909,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\Description;\nuse Hamcrest\\Matche"
},
{
"path": "hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php",
"chars": 2252,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\Description;\nuse Hamcrest\\Matche"
},
{
"path": "hamcrest/Hamcrest/AssertionError.php",
"chars": 119,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass AssertionError extends \\RuntimeException\n{\n}\n"
},
{
"path": "hamcrest/Hamcrest/BaseDescription.php",
"chars": 3314,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Internal\\SelfDescribingValue;\n\n/**\n * A "
},
{
"path": "hamcrest/Hamcrest/BaseMatcher.php",
"chars": 626,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * BaseClass for all Matcher implementations.\n *"
},
{
"path": "hamcrest/Hamcrest/Collection/IsEmptyTraversable.php",
"chars": 1441,
"preview": "<?php\nnamespace Hamcrest\\Collection;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Des"
},
{
"path": "hamcrest/Hamcrest/Collection/IsTraversableWithSize.php",
"chars": 955,
"preview": "<?php\nnamespace Hamcrest\\Collection;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\FeatureMatcher;\nuse Hamcrest\\"
},
{
"path": "hamcrest/Hamcrest/Core/AllOf.php",
"chars": 1549,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Diagnosin"
},
{
"path": "hamcrest/Hamcrest/Core/AnyOf.php",
"chars": 1364,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher;\n"
},
{
"path": "hamcrest/Hamcrest/Core/CombinableMatcher.php",
"chars": 1877,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descript"
},
{
"path": "hamcrest/Hamcrest/Core/DescribedAs.php",
"chars": 1995,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/Every.php",
"chars": 1374,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher;"
},
{
"path": "hamcrest/Hamcrest/Core/HasToString.php",
"chars": 1492,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\FeatureMa"
},
{
"path": "hamcrest/Hamcrest/Core/Is.php",
"chars": 1414,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsAnything.php",
"chars": 873,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsCollectionContaining.php",
"chars": 2195,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Matcher;\n"
},
{
"path": "hamcrest/Hamcrest/Core/IsEqual.php",
"chars": 954,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsIdentical.php",
"chars": 832,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\n\n/**\n * The same as {@"
},
{
"path": "hamcrest/Hamcrest/Core/IsInstanceOf.php",
"chars": 1743,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\Diagnosin"
},
{
"path": "hamcrest/Hamcrest/Core/IsNot.php",
"chars": 879,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsNull.php",
"chars": 1028,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsSame.php",
"chars": 1197,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/IsTypeOf.php",
"chars": 1771,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/Set.php",
"chars": 2599,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Core/ShortcutCombination.php",
"chars": 1005,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest/Description.php",
"chars": 1612,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * A description of a Matcher. A Matcher will de"
},
{
"path": "hamcrest/Hamcrest/DiagnosingMatcher.php",
"chars": 663,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Official documentation for this class is miss"
},
{
"path": "hamcrest/Hamcrest/FeatureMatcher.php",
"chars": 2060,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Supporting class for matching a feature of an"
},
{
"path": "hamcrest/Hamcrest/Internal/SelfDescribingValue.php",
"chars": 564,
"preview": "<?php\nnamespace Hamcrest\\Internal;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\SelfD"
},
{
"path": "hamcrest/Hamcrest/Matcher.php",
"chars": 1644,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * A matcher over acceptable values.\n * A matche"
},
{
"path": "hamcrest/Hamcrest/MatcherAssert.php",
"chars": 3414,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nclass MatcherAssert\n{\n\n /**\n * Number of asse"
},
{
"path": "hamcrest/Hamcrest/Matchers.php",
"chars": 22524,
"preview": "<?php\n\n/*\n Copyright (c) 2009-2010 hamcrest.org\n */\n\n// This file is generated from the static method @factory doctags.\n"
},
{
"path": "hamcrest/Hamcrest/NullDescription.php",
"chars": 778,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Null implementation of {@link Hamcrest\\Descri"
},
{
"path": "hamcrest/Hamcrest/Number/IsCloseTo.php",
"chars": 1974,
"preview": "<?php\nnamespace Hamcrest\\Number;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSaf"
},
{
"path": "hamcrest/Hamcrest/Number/OrderingComparison.php",
"chars": 3436,
"preview": "<?php\nnamespace Hamcrest\\Number;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSa"
},
{
"path": "hamcrest/Hamcrest/SelfDescribing.php",
"chars": 541,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * The ability of an object to describe itself.\n"
},
{
"path": "hamcrest/Hamcrest/StringDescription.php",
"chars": 1193,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * A {@link Hamcrest\\Description} that is stored"
},
{
"path": "hamcrest/Hamcrest/Text/IsEmptyString.php",
"chars": 1901,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\BaseMatcher;\nuse Hamcrest\\Core\\AnyO"
},
{
"path": "hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php",
"chars": 1337,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSafeM"
},
{
"path": "hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php",
"chars": 1737,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSafeM"
},
{
"path": "hamcrest/Hamcrest/Text/MatchesPattern.php",
"chars": 847,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\n\n/**\n * Tests if the argument is a string that m"
},
{
"path": "hamcrest/Hamcrest/Text/StringContains.php",
"chars": 982,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Tests if the argument is a string that c"
},
{
"path": "hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php",
"chars": 915,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\n\n/**\n * Tests if the argument is a string that c"
},
{
"path": "hamcrest/Hamcrest/Text/StringContainsInOrder.php",
"chars": 1692,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSafeM"
},
{
"path": "hamcrest/Hamcrest/Text/StringEndsWith.php",
"chars": 860,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Tests if the argument is a string that e"
},
{
"path": "hamcrest/Hamcrest/Text/StringStartsWith.php",
"chars": 863,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\n/**\n * Tests if the argument is a string that c"
},
{
"path": "hamcrest/Hamcrest/Text/SubstringMatcher.php",
"chars": 1215,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\n\nuse Hamcrest\\Description;\nuse Hamcrest\\TypeSafe"
},
{
"path": "hamcrest/Hamcrest/Type/IsArray.php",
"chars": 479,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsBoolean.php",
"chars": 499,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsCallable.php",
"chars": 580,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsDouble.php",
"chars": 561,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsInteger.php",
"chars": 500,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsNumeric.php",
"chars": 1045,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsObject.php",
"chars": 494,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsResource.php",
"chars": 495,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsScalar.php",
"chars": 588,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/Type/IsString.php",
"chars": 483,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\n/*\n Copyright (c) 2010 hamcrest.org\n */\nuse Hamcrest\\Core\\IsTypeOf;\n\n/**\n * Tests whethe"
},
{
"path": "hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php",
"chars": 897,
"preview": "<?php\nnamespace Hamcrest;\n\n/**\n * Convenient base class for Matchers that require a value of a specific type.\n * This si"
},
{
"path": "hamcrest/Hamcrest/TypeSafeMatcher.php",
"chars": 3237,
"preview": "<?php\nnamespace Hamcrest;\n\n/**\n * Convenient base class for Matchers that require a value of a specific type.\n * This si"
},
{
"path": "hamcrest/Hamcrest/Util.php",
"chars": 2090,
"preview": "<?php\nnamespace Hamcrest;\n\n/*\n Copyright (c) 2012 hamcrest.org\n */\n\n/**\n * Contains utility methods for handling Hamcres"
},
{
"path": "hamcrest/Hamcrest/Xml/HasXPath.php",
"chars": 6402,
"preview": "<?php\nnamespace Hamcrest\\Xml;\n\n/*\n Copyright (c) 2009 hamcrest.org\n */\nuse Hamcrest\\Core\\IsEqual;\nuse Hamcrest\\Descripti"
},
{
"path": "hamcrest/Hamcrest.php",
"chars": 25178,
"preview": "<?php\n\n/*\n Copyright (c) 2009-2010 hamcrest.org\n */\n\n// This file is generated from the static method @factory doctags.\n"
},
{
"path": "phpstan.neon",
"chars": 345,
"preview": "includes:\n\t- vendor/phpstan/phpstan-phpunit/extension.neon\n\t- tests/phpstan-baseline.neon\n\nparameters:\n level: 8\n "
},
{
"path": "tests/Hamcrest/AbstractMatcherTest.php",
"chars": 2277,
"preview": "<?php\nnamespace Hamcrest;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass UnknownType {\n}\n\nabstract class AbstractMatcherTest ex"
},
{
"path": "tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php",
"chars": 1724,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayContainingInAnyOrderTest extends Abstr"
},
{
"path": "tests/Hamcrest/Array/IsArrayContainingInOrderTest.php",
"chars": 1561,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayContainingInOrderTest extends Abstract"
},
{
"path": "tests/Hamcrest/Array/IsArrayContainingKeyTest.php",
"chars": 1598,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayContainingKeyTest extends AbstractMatc"
},
{
"path": "tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php",
"chars": 1098,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayContainingKeyValuePairTest extends Abs"
},
{
"path": "tests/Hamcrest/Array/IsArrayContainingTest.php",
"chars": 1261,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayContainingTest extends AbstractMatcher"
},
{
"path": "tests/Hamcrest/Array/IsArrayTest.php",
"chars": 2494,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayTest extends AbstractMatcherTest\n{\n\n "
},
{
"path": "tests/Hamcrest/Array/IsArrayWithSizeTest.php",
"chars": 1155,
"preview": "<?php\nnamespace Hamcrest\\Arrays;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsArrayWithSizeTest extends AbstractMatcherTe"
},
{
"path": "tests/Hamcrest/BaseMatcherTest.php",
"chars": 547,
"preview": "<?php\nnamespace Hamcrest;\n\n/* Test-specific subclass only */\nclass BaseMatcherTest extends \\Hamcrest\\BaseMatcher\n{\n\n "
},
{
"path": "tests/Hamcrest/Collection/IsEmptyTraversableTest.php",
"chars": 1867,
"preview": "<?php\nnamespace Hamcrest\\Collection;\n\nuse Hamcrest\\AbstractMatcherTest;\n\nclass IsEmptyTraversableTest extends AbstractMa"
},
{
"path": "tests/Hamcrest/Collection/IsTraversableWithSizeTest.php",
"chars": 1370,
"preview": "<?php\nnamespace Hamcrest\\Collection;\n\nclass IsTraversableWithSizeTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n prote"
},
{
"path": "tests/Hamcrest/Core/AllOfTest.php",
"chars": 1563,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass AllOfTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createMa"
},
{
"path": "tests/Hamcrest/Core/AnyOfTest.php",
"chars": 2463,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass AnyOfTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createMa"
},
{
"path": "tests/Hamcrest/Core/CombinableMatcherTest.php",
"chars": 1838,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass CombinableMatcherTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n private $_eithe"
},
{
"path": "tests/Hamcrest/Core/DescribedAsTest.php",
"chars": 1071,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass DescribedAsTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function cr"
},
{
"path": "tests/Hamcrest/Core/EveryTest.php",
"chars": 834,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass EveryTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createMa"
},
{
"path": "tests/Hamcrest/Core/HasToStringTest.php",
"chars": 2366,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass PhpForm\n{\n public function __toString()\n {\n return 'php';\n }\n}\n\ncl"
},
{
"path": "tests/Hamcrest/Core/IsAnythingTest.php",
"chars": 684,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsAnythingTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function cre"
},
{
"path": "tests/Hamcrest/Core/IsCollectionContainingTest.php",
"chars": 2630,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsCollectionContainingTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected "
},
{
"path": "tests/Hamcrest/Core/IsEqualTest.php",
"chars": 2766,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass DummyToStringClass\n{\n private $_arg;\n\n public function __construct($arg)\n "
},
{
"path": "tests/Hamcrest/Core/IsIdenticalTest.php",
"chars": 769,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsIdenticalTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function cr"
},
{
"path": "tests/Hamcrest/Core/IsInstanceOfTest.php",
"chars": 1917,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsInstanceOfTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n private $_baseClassI"
},
{
"path": "tests/Hamcrest/Core/IsNotTest.php",
"chars": 998,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsNotTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createMa"
},
{
"path": "tests/Hamcrest/Core/IsNullTest.php",
"chars": 484,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsNullTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createM"
},
{
"path": "tests/Hamcrest/Core/IsSameTest.php",
"chars": 795,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsSameTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createM"
},
{
"path": "tests/Hamcrest/Core/IsTest.php",
"chars": 1106,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function createMatch"
},
{
"path": "tests/Hamcrest/Core/IsTypeOfTest.php",
"chars": 1481,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass IsTypeOfTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function creat"
},
{
"path": "tests/Hamcrest/Core/SampleBaseClass.php",
"chars": 231,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass SampleBaseClass\n{\n\n private $_arg;\n\n public function __construct($arg)\n {"
},
{
"path": "tests/Hamcrest/Core/SampleSubClass.php",
"chars": 96,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass SampleSubClass extends \\Hamcrest\\Core\\SampleBaseClass\n{\n}\n"
},
{
"path": "tests/Hamcrest/Core/SetTest.php",
"chars": 3263,
"preview": "<?php\nnamespace Hamcrest\\Core;\n\nclass SetTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n public static $_classProperty"
},
{
"path": "tests/Hamcrest/FeatureMatcherTest.php",
"chars": 1726,
"preview": "<?php\nnamespace Hamcrest;\n\nclass Thingy\n{\n private $_result;\n public function __construct($result)\n {\n $"
},
{
"path": "tests/Hamcrest/InvokedMatcherTest.php",
"chars": 617,
"preview": "<?php\nnamespace Hamcrest;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass SampleInvokeMatcher extends BaseMatcherTest\n{\n priv"
},
{
"path": "tests/Hamcrest/MatcherAssertTest.php",
"chars": 7392,
"preview": "<?php\nnamespace Hamcrest;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass MatcherAssertTest extends TestCase\n{\n\n /**\n * @"
},
{
"path": "tests/Hamcrest/Number/IsCloseToTest.php",
"chars": 801,
"preview": "<?php\nnamespace Hamcrest\\Number;\n\nclass IsCloseToTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function cr"
},
{
"path": "tests/Hamcrest/Number/OrderingComparisonTest.php",
"chars": 1000,
"preview": "<?php\nnamespace Hamcrest\\Number;\n\nclass OrderingComparisonTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected fu"
},
{
"path": "tests/Hamcrest/StringDescriptionTest.php",
"chars": 5718,
"preview": "<?php\nnamespace Hamcrest;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass SampleSelfDescriber implements \\Hamcrest\\SelfDescribin"
},
{
"path": "tests/Hamcrest/Text/IsEmptyStringTest.php",
"chars": 2295,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass IsEmptyStringTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function "
},
{
"path": "tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php",
"chars": 1148,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass IsEqualIgnoringCaseTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected fun"
},
{
"path": "tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php",
"chars": 1455,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass IsEqualIgnoringWhiteSpaceTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n private"
},
{
"path": "tests/Hamcrest/Text/MatchesPatternTest.php",
"chars": 859,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass MatchesPatternTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function"
},
{
"path": "tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php",
"chars": 2554,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass StringContainsIgnoringCaseTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n const "
},
{
"path": "tests/Hamcrest/Text/StringContainsInOrderTest.php",
"chars": 1320,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass StringContainsInOrderTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n private $_m"
},
{
"path": "tests/Hamcrest/Text/StringContainsTest.php",
"chars": 2715,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass StringContainsTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n const EXCERPT = 'E"
},
{
"path": "tests/Hamcrest/Text/StringEndsWithTest.php",
"chars": 1963,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass StringEndsWithTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n const EXCERPT = 'E"
},
{
"path": "tests/Hamcrest/Text/StringStartsWithTest.php",
"chars": 1974,
"preview": "<?php\nnamespace Hamcrest\\Text;\n\nclass StringStartsWithTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n const EXCERPT = "
},
{
"path": "tests/Hamcrest/Type/IsArrayTest.php",
"chars": 937,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsArrayTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function create"
},
{
"path": "tests/Hamcrest/Type/IsBooleanTest.php",
"chars": 951,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsBooleanTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function crea"
},
{
"path": "tests/Hamcrest/Type/IsCallableTest.php",
"chars": 2815,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsCallableTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n public static function"
},
{
"path": "tests/Hamcrest/Type/IsDoubleTest.php",
"chars": 950,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsDoubleTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function creat"
},
{
"path": "tests/Hamcrest/Type/IsIntegerTest.php",
"chars": 985,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsIntegerTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function crea"
},
{
"path": "tests/Hamcrest/Type/IsNumericTest.php",
"chars": 1848,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsNumericTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function crea"
},
{
"path": "tests/Hamcrest/Type/IsObjectTest.php",
"chars": 905,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsObjectTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function creat"
},
{
"path": "tests/Hamcrest/Type/IsResourceTest.php",
"chars": 922,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsResourceTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function cre"
},
{
"path": "tests/Hamcrest/Type/IsScalarTest.php",
"chars": 1138,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsScalarTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function creat"
},
{
"path": "tests/Hamcrest/Type/IsStringTest.php",
"chars": 943,
"preview": "<?php\nnamespace Hamcrest\\Type;\n\nclass IsStringTest extends \\Hamcrest\\AbstractMatcherTest\n{\n\n protected function creat"
},
{
"path": "tests/Hamcrest/UtilTest.php",
"chars": 3010,
"preview": "<?php\nnamespace Hamcrest;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass UtilTest extends TestCase\n{\n\n public function testW"
},
{
"path": "tests/Hamcrest/Xml/HasXPathTest.php",
"chars": 5136,
"preview": "<?php\nnamespace Hamcrest\\Xml;\n\nclass HasXPathTest extends \\Hamcrest\\AbstractMatcherTest\n{\n protected static $xml;\n "
},
{
"path": "tests/bootstrap.php",
"chars": 220,
"preview": "<?php\n\nerror_reporting(E_ALL | E_STRICT);\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\nif (defined('E_DEPRECATED')) {\n"
},
{
"path": "tests/phpstan-baseline.neon",
"chars": 1621,
"preview": "parameters:\n\tignoreErrors:\n\t\t-\n\t\t\tmessage: '#^Cannot call method matches\\(\\) on Hamcrest\\\\Matcher\\|null\\.$#'\n\t\t\tidentifi"
},
{
"path": "tests/phpunit.xml.dist",
"chars": 619,
"preview": "<phpunit backupGlobals=\"false\"\n backupStaticAttributes=\"false\"\n bootstrap=\"bootstrap.php\"\n color"
}
]
About this extraction
This page contains the full source code of the hamcrest/hamcrest-php GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 156 files (285.8 KB), approximately 75.1k tokens, and a symbol index with 1038 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.