PHPackages                             codekandis/phpunit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. codekandis/phpunit

ActiveLibrary[Testing &amp; Quality](/categories/testing)

codekandis/phpunit
==================

`codekandis/phpunit` is a library for `PHPUnit` testing with enhanced test cases and custom constraint assertions.

5.0.2(3w ago)058020MITPHPPHP ^8.5CI passing

Since Dec 27Pushed 2w ago1 watchersCompare

[ Source](https://github.com/codekandis/phpunit)[ Packagist](https://packagist.org/packages/codekandis/phpunit)[ RSS](/packages/codekandis-phpunit/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (8)Versions (10)Used By (20)

codekandis/phpunit
==================

[](#codekandisphpunit)

[![Version](https://camo.githubusercontent.com/6dbf8d5609a756a96224876de2115b70a761379b23da4adb0ae2a3ee6b85745f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d352e302e352d626c75652e737667)](./CHANGELOG.md)[![License](https://camo.githubusercontent.com/07a7d0169027aac6d7a0bfa8964dfef5fbc40d5a2075cabb3d8bc67e17be3451/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d79656c6c6f772e737667)](./LICENSE)[![Minimum PHP Version](https://camo.githubusercontent.com/53ed757c327254f69117d4be63d81f6e9362690de65c0bbb1d6915d237e839d4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e352d3838393242462e737667)](https://php.net)[![Code Coverage](https://camo.githubusercontent.com/af813ae002de8e31bfd234a3d5eab4fe1963ed998df54d1f3c5e3e1fe334f7d6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d677265656e2e737667)](https://camo.githubusercontent.com/af813ae002de8e31bfd234a3d5eab4fe1963ed998df54d1f3c5e3e1fe334f7d6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d677265656e2e737667)

`codekandis/phpunit` is a library for [`PHPUnit`](https://packagist.org/packages/phpunit/phpunit) testing with enhanced test cases and custom constraint assertions.

Index
-----

[](#index)

- [Installation](#installation)
- [Usage](#usage)
    - [Using the test case wrapper](#using-the-test-case-wrapper)
    - [Failing exception test branches](#failing-exception-test-branches)
        - [`TestCase::failUnexpectedThrowableHasBeenThrown()`](#testcasefailunexpectedthrowablehasbeenthrown)
        - [`TestCase::failExpectedThrowableHasNotBeenThrown()`](#testcasefailexpectedthrowablehasnotbeenthrown)
    - [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
------------

[](#installation)

Install the latest version with

```
$ composer require --dev codekandis/phpunit
```

Usage
-----

[](#usage)

### Using the test case wrapper

[](#using-the-test-case-wrapper)

Create a test case that extends the [`TestCase`](./src/TestCase.php#L21) wrapper.

The additional constraint assertions are available through this wrapper.

```
