PHPackages                             eddiejaoude/phpunit-wrapper - 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. eddiejaoude/phpunit-wrapper

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

eddiejaoude/phpunit-wrapper
===========================

PHPUnit wrapper - wraps the functionality of phpunit with easy to use plain English

0.2.1(12y ago)115MITPHPPHP &gt;=5.5

Since Mar 8Pushed 12y ago1 watchersCompare

[ Source](https://github.com/eddiejaoude/phpunit-wrapper)[ Packagist](https://packagist.org/packages/eddiejaoude/phpunit-wrapper)[ RSS](/packages/eddiejaoude-phpunit-wrapper/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/0f7e4200fd4ca495a6f75910771f01e88c0ea994d55fcfc65a74daa39f610ffe/68747470733a2f2f7472617669732d63692e6f72672f65646469656a616f7564652f706870756e69742d777261707065722e706e67)](https://travis-ci.org/eddiejaoude/phpunit-wrapper)[![Coverage Status](https://camo.githubusercontent.com/2631751dae5f1a17cf963e6582d05a09a796d1ed10b98380cefa7c19f9b1b0b7/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f65646469656a616f7564652f706870756e69742d777261707065722f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/eddiejaoude/phpunit-wrapper?branch=master)[![Total Downloads](https://camo.githubusercontent.com/edf4f3f958d46b884de35c1a3cf5010ca1ca8a03ca751f8ff2ea9ac3759d9cbe/68747470733a2f2f706f7365722e707567782e6f72672f65646469656a616f7564652f706870756e69742d777261707065722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/eddiejaoude/phpunit-wrapper)

PHPUnitWrapper / phpunit-wrapper
================================

[](#phpunitwrapper--phpunit-wrapper)

PHPUnit wrapper - wraps the functionality of phpunit with easy to use `plain & simple English`

`Note: Your existing standard PHPUnit tests will not fail, they will continue to work fine`

---

Installation via Composer
-------------------------

[](#installation-via-composer)

```
    "require" : {
        "EddieJaoude\PHPUnitWrapper" : "0.*"
    }

```

---

Usage
-----

[](#usage)

Instead of extending `\PHPUnit_Framework_TestCase`, extend `\EddieJaoude\PHPUnitWrapper\Assert`.

The Assert class extends PHPUnit, therefore you get all the previous functionality &amp; your previous unit tests will not fail.

---

### Assert Equals

[](#assert-equals)

#### Standard PHPUnit

[](#standard-phpunit)

```
    $this->assertEquals($expected, $actual);

    // or with custom message

    $this->assertEquals($expected, $actual, $message);
```

#### PHPUnit Wrapper

[](#phpunit-wrapper)

```
    $this->expectedValue('abc')
                ->equals('abc');

    // or with custom message

    $this->expectedValue('abc')
            ->setMessage('Failure, these are not equal!') // optional
            ->equals('abc');
```

### Assert NOT Equals

[](#assert-not-equals)

#### Standard PHPUnit

[](#standard-phpunit-1)

```
    $this->assertNotEquals($expected, $actual, $message);
```

#### PHPUnit Wrapper

[](#phpunit-wrapper-1)

```
    $this->expectedValue('abc')
            ->notEquals('abcd');
```

---

### Contains

[](#contains)

#### Standard PHPUnit

[](#standard-phpunit-2)

```
    $this->assertContains($needle, $haystack);

    // or with custom message

    $this->assertContains($needle, $haystack, $message);
```

#### PHPUnit Wrapper

[](#phpunit-wrapper-2)

```
    $this->expectedValue($needle)
            ->existsIn($haystack);

    $this->expectedValue('b')
            ->existsIn(
                array('a', 'b', 'c')
            );

    // or with custom message

    $this->expectedValue('b')
            ->setMessage('Failure, does not exist!') // optional
            ->existsIn(
                array('a', 'b', 'c')
            );
```

### NOT Contains

[](#not-contains)

#### Standard PHPUnit

[](#standard-phpunit-3)

```
    $this->assertNotContains($needle, $haystack);

    // or with custom message

    $this->assertNotContains($needle, $haystack, $message);
```

#### PHPUnit Wrapper

[](#phpunit-wrapper-3)

```
    $this->expectedValue($needle)
            ->notExistsIn($haystack);

    $this->expectedValue('b')
            ->notExistsIn(
                array('a', 'c')
            );

    // or with custom message

    $this->expectedValue('b')
            ->setMessage('Failure, does exist!') // optional
            ->notExistsIn(
                array('a', 'c')
            );
```

---

---

### Complete usage simple Example

[](#complete-usage-simple-example)

```
