Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Unit testing with TYPO3
Search
Oliver Klee
October 25, 2015
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Unit testing with TYPO3
Oliver Klee
October 25, 2015
More Decks by Oliver Klee
See All by Oliver Klee
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
95
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
130
Team-Management-Plattform
oliverklee
0
95
Vertrauen in Teams & Führung
oliverklee
0
330
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
62
Vertrauen in Teams & Führung
oliverklee
0
180
Testing von TYPO3-Extensions
oliverklee
0
110
Software-Qualität von Extensions automatisieren
oliverklee
1
66
Content-Synchronisierung
oliverklee
0
200
Other Decks in Technology
See All in Technology
module Synths; end
asonas
1
130
Reactの設計論
uhyo
15
8.4k
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
3
190
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
4
1.1k
Omarchy Quattro の日本語設定周り
simosako
2
150
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
120
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
200
AIで仕事のやり方を変える
matsu7874
3
1.1k
家のリアーキテクト・リファクタリング
suguruooki
0
120
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
350
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
350
Sigmaで作る業務アプリ
kazushiro_honma
0
120
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
Statistics for Hackers
jakevdp
799
230k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
530
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
420
We Have a Design System, Now What?
morganepeng
55
8.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Accessibility Awareness
sabderemane
1
210
Making Projects Easy
brettharned
120
6.7k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
280
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
450
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
Transcript
Unit testing with TYPO3 Oliver Klee, 2015-10-26 @oliklee
[email protected]
Unit tests?
Manual testing is cumbersome
Automated testing is fast
Unit tests for the Realty Manager extension
more than 1600 tests
in less than 60 seconds
Verify that your code does what you expect
Make sure that your changes won‘t break anything
Keep other coders from breaking your code
Don‘t break anything even in complex projects
Create a safety net for refactoring
Improve the structure of the code
Green feelsgood!
None
Know your tools
The phpunit extension has it all phpunit (TYPO3 extension) PHPUnit
(Composer package) Testrunner (back-end- module) Testrunner (CLI module) Testing framework for FE & DB
Let‘s get some terms straight
Test suite Test case Test Two tests meet in a
bar ... Assertion Test Test Test case
The life cycle of a unit test new FooTest(); setUp();
/** @test */ lifeIsGood(); tearDown();
4 test phases Setup Exercise Verify Teardown setUp() in the
test method call assert… tearDown() https://robots.thoughtbot.com/four-phase-test
Code test-first write test write code refactor
kata Code
Testing levels http://dabrorius.github.io/2015/06/tested-be-thy-name.html
Unit tests are small and fast
Integration tests check the interaction of components
System tests test the complete system
Test types
Blackbox tests what is visible to the outside test
Whitebox tests inner workings test the
Functional tests
Acceptance tests Selenium
Regression tests
Smoke tests
Smoke tests
Use meaningful unit test names classCanBeInstantiated setTitleSetsTitle setSizeWithZeroThrowsException hasTitleForEmptyTitleReturnsFalse Name
the behavior. Name the preconditions. Mention the method. Dont‘t use "works" or "correctly". measureFrubbleWorksCorrectly
The testing framework is created quickly /** * @var Tx_Phpunit_Framework
*/ protected $testingFramework = NULL; protected function setUp() { $this->testingFramework = new Tx_Phpunit_Framework('tx_news2'); } protected function tearDown() { $this->testingFramework->cleanUp(); } CREATE TABLE tx_news2_domain_model_news ( … is_dummy_record tinyint(1) unsigned DEFAULT '0' NOT NULL, … discard the FE, delete DB records, delete files
$recordUid = $tf->createRecord($tableName, array $recordData = array()); The testing framework
can fake almost everything $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign); $numberOfRecords = $tf->countRecords($tableName, $whereClause = ''); $success = $tf->existsRecord($tableName, $whereClause = ''); $success = $tf->existsRecordWithUid($tableName, $uid); $success = $tf->existsExactlyOneRecord($tableName, $whereClause = '');
$groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups =
'', array $recordData = array()); $userUid = $tf->createAndLoginFrontEndUser($groups = '', array $recordData = array()); $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $tf->loginFrontEndUser($userId); $tf->logoutFrontEndUser(); $isLoggedIn = $tf->isLoggedIn(); The testing framework can fake almost everything
$recordUid = $tf->createBackEndUser(array $recordData = array()); $recordUid = $tf->createBackEndUserGroup(array $recordData
= array()); The testing framework can fake almost everything
$path = $tf->createDummyFile($fileName = 'test.txt', $content = ''); $path =
$tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array()); $tf->deleteDummyFile($fileName); $tf->deleteDummyFolder($folderName); $path = $tf->createDummyFolder($folderName); The testing framework can fake almost everything
None