PHPackages                             facebook/fbexpect - 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. facebook/fbexpect

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

facebook/fbexpect
=================

Unit test helpers for Facebook projects

v2.9.1(3y ago)231.1M↓31.4%10[3 issues](https://github.com/hhvm/fbexpect/issues)[1 PRs](https://github.com/hhvm/fbexpect/pulls)20MITHack

Since Aug 1Pushed 2y ago20 watchersCompare

[ Source](https://github.com/hhvm/fbexpect)[ Packagist](https://packagist.org/packages/facebook/fbexpect)[ RSS](/packages/facebook-fbexpect/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (45)Used By (20)

[![Build Status](https://camo.githubusercontent.com/1d809c6ffd207542baf522469c6604911a23265ae09958b97a1a9bf2bca58a8a/68747470733a2f2f7472617669732d63692e6f72672f6868766d2f66626578706563742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hhvm/fbexpect)

FBExpect
========

[](#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](https://github.com/hhvm/hacktest/).

Examples
--------

[](#examples)

### Clarity

[](#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

[](#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
------------

[](#installation)

FBExpect is installed via composer:

```
composer require facebook/fbexpect

```

Composer must be executed with `php`, not HHVM.

License
-------

[](#license)

FBExpect is MIT-licensed.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~135 days

Total

44

Last Release

1442d ago

Major Versions

v0.4.1 → v1.0.02018-05-09

v1.1.0 → v2.0.02018-08-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3757713?v=4)[Joel Marcey](/maintainers/JoelMarcey)[@JoelMarcey](https://github.com/JoelMarcey)

![](https://avatars.githubusercontent.com/u/8306375?v=4)[HHVM Community Bot](/maintainers/hhvm-bot)[@hhvm-bot](https://github.com/hhvm-bot)

![](https://avatars.githubusercontent.com/u/601530?v=4)[Yang, Bo](/maintainers/Atry)[@Atry](https://github.com/Atry)

![](https://avatars.githubusercontent.com/u/727402?v=4)[Alexey Toptygin](/maintainers/alexeyt)[@alexeyt](https://github.com/alexeyt)

---

Top Contributors

[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (96 commits)")[![jjergus](https://avatars.githubusercontent.com/u/2483917?v=4)](https://github.com/jjergus "jjergus (14 commits)")[![lexidor](https://avatars.githubusercontent.com/u/31805625?v=4)](https://github.com/lexidor "lexidor (12 commits)")[![Atry](https://avatars.githubusercontent.com/u/601530?v=4)](https://github.com/Atry "Atry (5 commits)")[![wlin53](https://avatars.githubusercontent.com/u/26862692?v=4)](https://github.com/wlin53 "wlin53 (3 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (2 commits)")[![kmeht](https://avatars.githubusercontent.com/u/1120478?v=4)](https://github.com/kmeht "kmeht (2 commits)")[![yns88](https://avatars.githubusercontent.com/u/757922?v=4)](https://github.com/yns88 "yns88 (1 commits)")[![johanoskarsson](https://avatars.githubusercontent.com/u/26380?v=4)](https://github.com/johanoskarsson "johanoskarsson (1 commits)")

### Embed Badge

![Health badge](/badges/facebook-fbexpect/health.svg)

```
[![Health](https://phpackages.com/badges/facebook-fbexpect/health.svg)](https://phpackages.com/packages/facebook-fbexpect)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

78768.9M1.5k](/packages/phpstan-phpstan-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
