facebook / fbexpect
Unit test helpers for Facebook projects
Installs: 1 043 384
Dependents: 81
Suggesters: 0
Security: 0
Stars: 21
Watchers: 21
Forks: 9
Open Issues: 4
Language:Hack
Requires
- hhvm: ^4.128
- facebook/difflib: ^1.3.0
- hhvm/hacktest: ^1.0|^2.0
Requires (Dev)
- hhvm/hhast: ^4.0
- hhvm/hhvm-autoload: ^2.0|^3.0
- dev-main
- v2.9.1
- v2.9.0
- v2.8.1
- v2.8.0
- v2.7.8
- v2.7.7
- v2.7.6
- v2.7.5
- v2.7.4
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.x-dev
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.x-dev
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.1.0
- v1.0.0
- v0.4.1
- v0.4
- v0.3
- v0.2
This package is auto-updated.
Last update: 2023-08-06 21:56:23 UTC
README
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.