facebook/fbexpect

This package is abandoned and no longer maintained. No replacement package was suggested.

Unit test helpers for Facebook projects

Package info

github.com/hhvm/fbexpect

Language:Hack

pkg:composer/facebook/fbexpect

Statistics

Installs: 1 096 493

Dependents: 73

Suggesters: 0

Stars: 21

Open Issues: 4

v2.9.1 2022-06-06 19:39 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 5ad14d4f6e6e57a468f9b415d97ab6050630e144


README

👁 Build Status

FBExpect

FBExpect is a standalone unit testing utility based on the notion of assertions from PHPUnit. Starting with 2.x, FBExpect no longer uses PHPUnit as a dependency, and instead implements the assertions directly, and is intentended for use with HackTest.

Examples

Clarity

It is linguistically clear which value is the expected value and which is the actual value:

use function Facebook\FBExpect\expect;

// PHPUnit
$this->assertSame($a, $b);

// FBExpect
expect($b)->toBeSame($a);

Type Refinement

use function Facebook\FBExpect\expect;

// PHPUnit
$this->assertNotNull($x); // Actual test
assert($x !== null); // Tell the typechecker what's going on
$this->assertInstanceOf(Foo::class, $y);
assert($y instanceof Foo);

// FBExpect
$x = expect($x)->toNotBeNull();
$y = expect($y)->toBeInstanceOf(Foo::class);

Installation

FBExpect is installed via composer:

composer require facebook/fbexpect

Composer must be executed with php, not HHVM.

License

FBExpect is MIT-licensed.