diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..567e24b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,44 @@ +# Contributing to FBExpect +We want to make contributing to this project as easy and transparent as +possible. + +## Our Development Process + +All development is direclty on GitHub. + +## Pull Requests +We actively welcome your pull requests. + +1. Fork the repo and create your branch from `master`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. If you haven't already, complete the Contributor License Agreement ("CLA"). + +## Contributor License Agreement ("CLA") +In order to accept your pull request, we need you to submit a CLA. You only need +to do this once to work on any of Facebook's open source projects. + +Complete your CLA here: + +## Issues +We use GitHub issues to track public bugs. Please ensure your description is +clear and has sufficient instructions to be able to reproduce the issue. + +Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe +disclosure of security bugs. In those cases, please go through the process +outlined on that page and do not file a public issue. + +## Coding Style + +Coding should match `hh_format`/`hackfmt` where practical; the key parts are: + +* 2 spaces for indentation rather than tabs +* 80 character line length +* indent, don't align + +## License + +By contributing to definition-finder, you agree that your contributions will be licensed +under the LICENSE file in the root directory of this source tree. diff --git a/README.md b/README.md new file mode 100644 index 0000000..09a01d1 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# FBExpect + +FBExpect is a unit testing utility built on top of PHPUnit. The primary goal of +this project is to allow Facebook to release our existing unit tests for other +projects, however it does have advantages for third-party Hack projects: + + - clarity + - type refinment for some assertions + - support for `vec`, `keyset`, and `dict` types + +## Examples + +### Clarity + +It is linguistically clearer which value is the expected value and which is the +actual value: + +```Hack +use Facebook\FBExpect\expect; + +// PHPUnit +$this->assertSame($a, $b); + +// FBExpect +expect($b)->toBeSame($a); +``` + +### Type Refinement + +```Hack +use 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 +``` + +FBExpect supports HHVM's PHP7 mode, however as it is also supports +having PHP7 mode disabled, it currently requires PHPUnit 5. + +## License + +FBExpect is BSD-licensed. We also provide an additional patent grant.