Chapter 5. Testing RxPHP Code
In this chapter, we're going to start testing code based on RxPHP. So far, we've been testing code by just running it and watching for the expected output in console. Of course, this isn't a very systematic approach, so it's time to start testing our code in an automatic way.
More precisely, in this chapter we will do the following:
- Introduce the
doOn*()
operators - Start using the PHPUnit library for unit testing code
- Talk about testing asynchronous code in general and try some common pitfalls ourselves
- Explore classes that come with RxPHP intended for testing and see how to use them separately, and how they fit into the great scheme of things
- For demonstration purposes, create a
SumObservable
class that calculates the sum of all integers going through, and test it using RxPHP testing tools - Write a simplified
ForkJoinObservable
class and test it - Stress how important it is to be aware of timing when testing Observables and...