https://github.com/codekandis/phpunit
`codekandis/phpunit` is a library providing an enhanced test case wrapper with additional constraint assertions for `PhpUnit`.
https://github.com/codekandis/phpunit
classes helper library php phpunit wrapper
Last synced: 2 days ago
JSON representation
`codekandis/phpunit` is a library providing an enhanced test case wrapper with additional constraint assertions for `PhpUnit`.
- Host: GitHub
- URL: https://github.com/codekandis/phpunit
- Owner: codekandis
- License: mit
- Created: 2019-12-27T13:34:01.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2026-05-27T15:55:37.000Z (12 days ago)
- Last Synced: 2026-05-27T17:21:46.678Z (12 days ago)
- Topics: classes, helper, library, php, phpunit, wrapper
- Language: PHP
- Homepage:
- Size: 423 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# codekandis/phpunit
[![Version][xtlink-version-badge]][srclink-changelog]
[![License][xtlink-license-badge]][srclink-license]
[![Minimum PHP Version][xtlink-php-version-badge]][xtlink-php-net]
![Code Coverage][xtlink-code-coverage-badge]
`codekandis/phpunit` is a library providing an enhanced test case wrapper with additional constraint assertions for
[`phpunit/phpunit`][xtlink-packagist-phpunit-phpunit].
## Index
* [Installation](#installation)
* [Usage](#usage)
* [Using the test case wrapper](#using-the-test-case-wrapper)
* [Using the data provider interface](#using-the-data-provider-interface)
* [Asserting array subsets](#asserting-array-subsets)
* [`TestCase::assertArrayContainsKeyedSubset()`](#testcaseassertarraycontainskeyedsubset)
* [`TestCase::assertArrayContainsUnkeyedSubset()`](#testcaseassertarraycontainsunkeyedsubset)
* [`TestCase::assertIsKeyedSubsetOfArray()`](#testcaseassertiskeyedsubsetofarray)
* [`TestCase::assertIsUnkeyedSubsetOfArray()`](#testcaseassertisunkeyedsubsetofarray)
* [Asserting subclass relationships](#asserting-subclass-relationships)
* [`TestCase::assertIsSubClassOf()`](#testcaseassertissubclassof)
## Installation
Install the latest version with
```bash
$ composer require --dev codekandis/phpunit
```
## Usage
### Using the test case wrapper
Create a test case that extends the `TestCase` wrapper.
The additional constraint assertions are available through this wrapper.
```php
[
23,
42
],
1 => [
'foo',
'bar'
]
];
}
}
```
Use the data provider in your test case.
```php
[
'bar' => 23
]
],
[
'foo' => [
'bar' => 23,
'baz' => 42
]
],
true
);
}
}
```
#### `TestCase::assertArrayContainsUnkeyedSubset()`
Use `TestCase::assertArrayContainsUnkeyedSubset()` to assert that `$actualArray` contains the values of
`$expectedSubset` without comparing keys. Set `$strict` to `true` to compare values strictly, or to `false` to compare
values loosely.
```php
[
'bar' => 23,
'baz' => 42
]
],
[
'foo' => [
'bar' => 23
]
],
true
);
}
}
```
#### `TestCase::assertIsUnkeyedSubsetOfArray()`
Use `TestCase::assertIsUnkeyedSubsetOfArray()` to assert that the values of `$actualSubset` are contained in
`$expectedArray` without comparing keys. Set `$strict` to `true` to compare values strictly, or to `false` to compare
values loosely.
```php