-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PHP Reactive Programming
By :

We're not going to go into very much detail about how to use PHPUnit, and instead leave it to its in-depth documentation ( https://phpunit.de/manual/5.6/en/index.html ). For the purpose of this chapter, we should, however, have a quick look at some of the basics we're going to use for the purposes of testing RxPHP code.
There are some basic rules we should follow:
All tests for a single class, MyClass
, go into a class called MyClassTest
, which should inherit from PHPUnit\Framework\TestCase
.
Each test scenario is represented by a function prefixed with test
or annotated with @test
annotation. This way it can be auto-discovered by PHPUnit.
Each test function consists of one or more assertions using assert*
methods (more on them later). If any one of them fails, the whole test scenario (one test function) is marked as failed. All assertions are inherited from PHPUnit\Framework\TestCase
.
We can specify dependencies between test scenarios using @depends testname...