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

Clean and Quality Unit Tests

codecleaner
November 23, 2013

Clean and Quality Unit Tests

Talk about readability and high quality of unit tests written in PHPUnit

codecleaner

November 23, 2013
Tweet

Other Decks in Technology

Transcript

  1. •  Names matters •  Exceptions •  Test Doubles •  Stubbing

    Collections •  Arrange Act Assert What’s it all about?
  2. How does getMock() really work? •  Does Configuration class exist?

    •  Create Mock_Configuration_123abc class extends Configuration class •  Create instance of that class •  Return instance
  3. How does getMock() really work? •  Does Configuration class exist?

    •  Create Mock_Configuration_123abc class extends Configuration class •  Create instance of that class •  Return instance •  Create Configuration class
  4. Stubs provide canned answers to calls made during the test

    "Mocks Aren’t Stubs" Martin Fowler
  5. Mocks are objects pre-programmed with expectations which form a specification

    of the calls they are expected to receive "Mocks Aren’t Stubs" Martin Fowler