danrspencer/phpunit-expect-syntax

Expect syntax for PHPUnit assertions

2.0.0 2018-05-29 20:53 UTC

This package is not auto-updated.

Last update: 2024-04-27 12:27:06 UTC


README

A wrapper for PHPUnit which allows expect assertion syntax inspired by JavaScript's Jasmine.

Note: currently incomplete - if I'm missing a matcher you need create an issue or pull request

Installation

Step 1. Install via Composer

The preferred way to install this bundle is via Composer. Just add it to your composer.json:

{
    "require": {
        // ...
        "danrspencer/phpunit-expect-syntax": "2.0.0"
    }
}

Step 2. Include the expect-syntax.php file

To begin using the syntax you'll need to include the expect-syntax.php file. This can be done in your PHPUnit bootstrap (recommended) or in invididual tests.

e.g.

require_once '../vendor/danrspencer/phpunit-expect-syntax/ExpectSyntax.php';

Example usage

/** @test */
function it_tests_something() {
	expect($this)->toEqual($that);	
}