Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unit Testing: What? Why? How?

Unit Testing: What? Why? How?

Slides from my talk at WP Hooked, February 2017.

https://www.meetup.com/wp_hooked/

John Blackbourn

February 14, 2017
Tweet

More Decks by John Blackbourn

Other Decks in Technology

Transcript

  1. John Blackbourn WordPress core developer Working with WordPress for 10+

    years Senior Engineer at Human Made @johnbillion
  2. A unit test is a piece of code which exists

    only to verify expectations about the behaviour of another piece of code Verification
  3. Assertions assertTrue( $actual ) assertFalse( $actual ) assertEquals( $expected, $actual

    ) assertCount( $expected, $actual ) assertObjectHasAttribute( $key, $actual ) assertArrayHasKey( $key, $actual ) assertWPError( $actual ) assertCanonical( $actual, $expected )
  4. WUT