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
99
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
130
Team-Management-Plattform
oliverklee
0
98
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
Genieを崇めよ
kameitomohiro
0
170
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
750
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
250
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
180
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
360
Goodbye ShellScript, Hello File-based App
shunsock
0
290
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
210
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
410
人間はどの意思決定を手放せるのか
kawasima
15
7.4k
サーバーレスをどこまで使う? WebRTC対戦ゲームで選んだVPSとの共存設計
kaidouji85
0
120
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
190
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
130
Featured
See All Featured
BBQ
matthewcrist
89
10k
The Spectacular Lies of Maps
axbom
PRO
1
1k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
580
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
KATA
mclloyd
PRO
35
15k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
The World Runs on Bad Software
bkeepers
PRO
72
12k
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