Skip to content
A Hack library for writing unit tests expressively
Branch: master
Clone or download
fredemmott Update requirement to HHVM 4.1
- 4.0 is unsupported
- 4.1 is the oldest supported release
- test 4.1-latest, latest, and nightlies
Latest commit 166f5c8 May 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src linty fresh May 20, 2019
tests Allow toAlmostEqual with nulls Feb 14, 2019
.LICENSE_HEADER.hh.txt License header linter Feb 14, 2019
.gitattributes Don't install tests/ or .hhconfig Sep 21, 2018
.gitignore Ignore composer.lock Apr 22, 2019
.hhconfig Support typed user attributes Oct 18, 2018
.travis.sh Ignore composer.lock Apr 22, 2019
.travis.yml Update requirement to HHVM 4.1 May 20, 2019
CODE_OF_CONDUCT.md Add CODE_OF_CONDUCT.md Feb 14, 2019
CONTRIBUTING.md Add CONTRIBUTING.md and README.md Jul 3, 2017
LICENSE Relicense to MIT Apr 12, 2018
README.md update readme Sep 25, 2018
composer.json Update requirement to HHVM 4.1 May 20, 2019
hh_autoload.json
hhast-lint.json More linters, and strict everything Feb 14, 2019

README.md

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:

hhvm ~/composer require facebook/fbexpect

License

FBExpect is MIT-licensed.

You can’t perform that action at this time.