Slide 1

Slide 1 text

Writing PHPUnit tests 
 for TYPO3 extensions Oliver Klee, 2023-08 @[email protected] | [email protected]

Slide 2

Slide 2 text

About me Oliver „Oli“ Kle e #bon n #extension-de v #workshop-teache r #unit-testing-gu y #phpstan-gu y #best-practices-tea m #motivation-research-tea m #team-leadership-working-grou p #game-cookin g #powermetal

Slide 3

Slide 3 text

Unit
 Tests?

Slide 4

Slide 4 text

Manual testing is cumbersome

Slide 5

Slide 5 text

Automated
 testing 
 is fast

Slide 6

Slide 6 text

Unit tests for the 
 TYPO3 Core

Slide 7

Slide 7 text

Unit Tests
 406 (144) tests/s

Slide 8

Slide 8 text

Functional Tests
 8.13 (1.97) tests/s

Slide 9

Slide 9 text

Acceptance Tests
 .009 (.003) tests/s

Slide 10

Slide 10 text

Verify that your code does what you expect

Slide 11

Slide 11 text

Make sure that 
 your changes won‘t
 break anything

Slide 12

Slide 12 text

Keep others 
 from breaking your code

Slide 13

Slide 13 text

Don’t break anything 
 even in complex 
 projects

Slide 14

Slide 14 text

Create a safety net for refactoring or for TYPO3, PHP or Symfony updates

Slide 15

Slide 15 text

Improve the structure of your code

Slide 16

Slide 16 text

Find the location of bugs

Slide 17

Slide 17 text

Green feels good!

Slide 18

Slide 18 text

Test levels http:// fi lipdefar.com/2015/06/tested-be-thy-name.html

Slide 19

Slide 19 text

Unit tests are small and fast

Slide 20

Slide 20 text

Functional tests test how components work together also called integration tests

Slide 21

Slide 21 text

Acceptance tests Codeception Cypress

Slide 22

Slide 22 text

The testing pyramid Unit Functional/
 Integration Acceptance Photo by Eugene Tkachenko on Unsplash: https://unsplash.com/photos/TF47p5PHW18