Unit testing for the
TYPO3 4.x core




Oliver Klee, T3DD10
Why write
unit tests for
 the Core?
Verify that your code
does what you expect
Make sure people
     won‘t break
      your code
Create a safety net
    for refactoring
„Reviewing patches is
like cleaning other
people's bathroom“
                  (OH)
Get your
patches
reviewed
more
quickly
(and write
easy-to-read,
well-
documented,
well-formatted
patches)
Let‘s get
some terms
  straight
The phpunit extension
             has it all
The phpunit extension
               has it all
phpunit (TYPO3 extension)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)

 Testrunner
 (back-end-
  module)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)

 Testrunner   Testrunner (CLI
 (back-end-       module)
  module)
Two tests
meet in a
  bar ...
Two tests
Test   meet in a
         bar ...
Two tests
  Test      meet in a
Assertion     bar ...
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Testcase
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Testcase
Testcase
Two tests
  Test       meet in a
Assertion      bar ...
  Test
  Test
Testcase
Testcase
 Testsuite
Code   test-first
Code   test-first
Code   test-first

write
test
Code   test-first

write
test
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code



                       refactor
Code    test-first

write          write
test           code



                       refactor

Unit testing for the TYPO3 4.x core (T3DD10)