Pippin has heard about tests. He wrote some, proudly: “All green, boss!”
Gorm sent for an inspector, Master Verifix, a gnome with a monocle. He read Pippin's tests, and he sighed. Then he secretly slipped four bugs into the tavern, just to see. Pippin's tests stayed all green.
Your mission
Make the tests in tests/Taverne/InspectionTest.php honest: they must still pass on the tavern as it is, but fail on each of Master Verifix's four bugs, the mutants 🐛.
Don't touch the application: it's the tests that are lying.
The classic lies of a test
- Data that is too well-behaved, which gives the right result by chance.
- An assertion that is too soft, which checks that an item is there, but not that the others are absent.
- A swallowed failure: in PHPUnit, a failed assertion is an exception. A
try/catch (\Throwable)makes it disappear. - A test that checks the wrong thing, like a value that has no chance of being there.
A green test proves nothing until you have seen it turn red in front of a real bug. That's exactly what mutants do.
Master Verifix adjusts his monocle. He is waiting.