2. Real Values.
Well ...
I really would like to do this testing stuff.
But I have no clue where to start.
Most common excuse
3. Real Values.
About
▪ Senior TYPO3 Developer @ sitegeist
▪ TYPO3 CMS Certified Developer
▪ Working with TYPO3 since version 3.8
▪ TYPO3 developer since 2004
▪ TYPO3 core contributor since 11/2014
▪ Cartographer, Food Blogger and
Square Dancer
▪ Twitter: @buccaneer23
Jan Helke
4. Real Values.
What to test?
I refuse to answer that
Audiences often understand "What ONLY to test?"
The obvious answer must be "Everything"
Ask yourself "Does this piece of code something meaningful?"
5. Real Values.
What (probably) not to test?
Classes/Domain/Model
• Should do only trivial stuff (e.g. getTitle(), setTitle())
• Business logic should be moved to Services or Utilities (e.g. getValidityDate())
Classes/Domain/Repository
• You can rely on the core to test that database stuff
Classes/Controller
• Should only be in control
• Gather data
• Call business logic
• Assign data to view
6. Real Values.
Testing methods
Unit testing
• Single units (e.g. single functions)
• Closed scope - only own code
• No 3rd party requirements (e.g. Database, TYPO3 Core functions)
Integration testing (a.k.a. functional testing)
• Composed functionality (e.g. "validate form and save values to database")
• Useful for public APIs (e.g. REST services)
• 3rd party requirements
(User) acceptance testing
• Frontend functionality
7. Real Values.
All units on deck
./composer.json
"require-dev": {
"typo3/testing-framework": "^4.12"
},
"scripts": {
"test:php-unit": "./bin/phpunit --color -d memory_limit=-1 ↵
-c ./Build/Testing/UnitTests.xml",
}