My problem: How my I test some MVC part with Pest in CakePHP, for example: When I´m use PHPUnit, I´ll type:
public class ItemTest extends TestCase
And it will show what thing that I wanna test, but how do that with Pest?
(Obs.: I´m really new on tests, so I accept anything that will make me improve :) )
After you installed Pest you just have to follow its syntax and documentation, removing all the OOP code and just using
test()
orit()
. The file name will be the same. This is an example from CakePHP docs:With Pest, it will become:
Note that
toBeInstanceOf()
andtoBe()
are part of the available Pest expectations.Finally, instead of running your test suite with
$ ./vendor/bin/phpunit
, you will run it with$ ./vendor/bin/pest
.