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

Test-driven development with PHPUnit

Test-driven development with PHPUnit

Oliver Klee

June 23, 2018
Tweet

More Decks by Oliver Klee

Other Decks in Technology

Transcript

  1. This is Oliver Klee (me!) Workshop teacher •unit testing •extension

    development •software quality •saying „no“, consent culture TYPO3 extension
 developer (wanna-be)
 singer @oliklee oliverklee oliverklee.de
  2. The life cycle of a test new FooTest(); setUp(); /**

    @test */ lifeIsGood(); tearDown();
  3. 4 test phases set up setUp()
 code in the test

    method exercise method call verify assert…() tear down tearDown()
  4. Use meaningful test names classCanBeInstantiated setTitleSetsTitle setSizeWithZeroThrowsException hasTitleForEmptyTitleReturnsFalse Name the

    behavior. Name the preconditions. Name the method. Don’t use
 “works” or
 “works correctly”. measureFrubbleWorksCorrectly