testing

  • PHPUnit 8 wants void on setUp, and it is a fatal error

    8.0 declares void on the template methods, so every override without it is an incompatible signature — which is a fatal error rather than a deprecation warning. It…

  • setUp with a return type, because 7 wants one

    PHPUnit 7 declares void on the template methods, so an override without it is an incompatible signature and a fatal error rather than a warning. It is a…

  • expectException replaced the annotation, quietly

    The @expectedException annotation asserts that the exception happened somewhere in the method, which passes when it is thrown by the setup rather than by the thing under test.…

  • The editor changed, and so did every plugin

    5.0 shipped on 6 December and the meta box is no longer the answer. What still works, what needs a flag, and what has to be rewritten.

  • PHPUnit 7 changed the assertion you use most

    7.0 landed in February and deprecated a set of assertions that appear in almost every suite, with removals following in 8 — so the warnings are a deadline…

  • React 16 rewrote how a component fails

    An error in one component used to blank the page. 16 unmounts the whole tree deliberately — and gives you the mechanism to stop it.

  • A data provider turns twelve tests into one

    Twelve near-identical test methods differing only in their input is twelve places to update when the method signature changes, and a suite nobody reads. Naming the rows with…

  • Testing what the database actually does

    The repository test passed against a mock and failed against MySQL. A mock asserts what you believe the database does, which is the thing in question.

  • A test that asserts on a query count

    An N+1 does not fail a test — the page renders correctly, just slowly — so the regression ships and is found by a customer three releases later.…

  • Assembling an API skeleton from packages you did not write

    A micro-framework, and the six packages it takes to make it useful. What goes in the starter pack, what does not, and when micro stops paying off.