In addition to compiling and sending notifications, Elixir may also be used to automate the launching of tests. The following sections will discuss how Elixir can be used for both PHPSpec and PHPUnit.
The first step would be to run the PHPSpec tests to automate code testing. By adding phpSpec()
to our gulpfile.js
as follows, PHPSpec tests will run:
elixir(function(mix) { mix.less('app.less').phpSpec(); });
The output is shown in the following screenshot. The PHPSpec output is maintained, so the test output is very useful:
When the PHPSpec tests fail, the results are easily readable:
In this example, phpspec encountered an error in the it creates a reservation test line as shown in the preceding screenshot.