Conference-Driven Development: I only wanted to start preparing my upcoming "Testing with Doubles: Why, When, and How?" conference presentation ... and ended up rewriting the tests for #PHPUnit's test double functionality from scratch.
This is far from being complete, but it's a good start. Writing the remaining tests will just be busywork that can be done here and there on the side.
And, of course!, while working on these tests I found plenty of code that could be deleted or cleaned.
I’m trying to run “Debug” (for step-debugging with #Xdebug) in #PhpStorm while running a #Pest test. I do this all the time with standard #PHPUnit tests, and I’ve never had this problem…
The test runner stops immediately, and PhpStorm reports in the debug console, “Test framework quit unexpectedly.”
Has anyone else seen this error? Do you know what causes it?
@katalyst a good IDE can be very helpful, also if you are starting out. Jetbrains’ #phpstorm is very powerful and has lots of good tools, and already is IMO helpful fot beginners. For indepth php development, you will likely want to learn about frameworks such as #laravel and/or #symfony. #phpunit, #composer are two tools which are available within e.g. phpstorm which you very likely want to learn (about). Lots of resources on the net, though the official docs at php.net are often probably helpful as well. #learning#programming#php
#PhpStorm needs to add little “play” buttons next to each of the #PHPUnit TestWith attributes.
Along these same lines, when I have a base test case that uses a data provider defined in child test classes, PhpStorm should be able to figure out that the method in the child is a data provider and add “play” buttons there, as well.
When to use a data provider vs multiple tests in #PHPUnit? Imho there are two requirements that would let me to pick data providers to test variants:
The input of the data provider is not used for if conditions that lead to different code being executed in the test.
The data provider input and output variables should fit on a single line, or if an array/object is part of the test dataset, a handful of lines at max.*