SlideShare a Scribd company logo
1 of 14
Download to read offline
Code Katas
for Magento 2
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Code Kata?
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
We practice our craft.
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Like an 80s movie
Training Montage
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Today's Kata:
Magento 2 Total Model
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Training Module: Example_GiftItem
Add a free water bottle to the cart
when the customer adds a product from the
sample data Bags attribute set.
https://github.com/Vinai/module-example-giftitem
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Training Module: Example_GiftItem
The gift item total model is responsible for
setting the price of gift items to zero.
https://github.com/Vinai/module-example-giftitem
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
What does this
kata teach?
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
(1/2) Generic skills:
4 TDD Red-Green-Refactor process
4 Working with stubs & mocks
4 Separating pure functions and
side effects
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
(2/2) Magento 2 skills:
4 Test driving Magento code
4 Memorizing the total model architecture
4 Dealing with Law of Demeter violations
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Getting started:
# Create module dir
mkdir -p app/code/Example && cd app/code/Example
# Clone repo
git clone https://github.com/Vinai/module-example-giftitem.git GiftItem
cd GiftItem
# Check out git tag
git checkout beginning-of-kata
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Kata Task:
Test drive the Example_GiftItem total model
ModelTotalsGiftItemAddressTotal
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Target collect() behavior:
4 Subtract gift item row totals and base row totals
from the subtotal
4 Set calculation_price
and base_calculation_price
of every gift item to zero
4 Call calcRowTotal on each item
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Enjoy the session and feel
those reflexes get sharper!
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp

More Related Content

What's hot

Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Joshua Warren
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
Max Yekaterinenko - Magento 2 & Quality
Max Yekaterinenko - Magento 2 & QualityMax Yekaterinenko - Magento 2 & Quality
Max Yekaterinenko - Magento 2 & QualityMeet Magento Italy
 
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Joshua Warren
 
How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)Magestore
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]M-Connect Media
 
Dependency Injection Extended: the way to advanced Magento 2 development
Dependency Injection Extended: the way to advanced Magento 2 developmentDependency Injection Extended: the way to advanced Magento 2 development
Dependency Injection Extended: the way to advanced Magento 2 developmentAndreas von Studnitz
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slidesvinaikopp
 
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향명신 김
 
Magento 2 Modules are Easy!
Magento 2 Modules are Easy!Magento 2 Modules are Easy!
Magento 2 Modules are Easy!Ben Marks
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design PatternsMax Pronko
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2 Igor Miniailo
 
Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015David Alger
 
2020 [pweb] 13 typescript
2020 [pweb] 13 typescript2020 [pweb] 13 typescript
2020 [pweb] 13 typescriptVICTOR JATOBÁ
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2Mathew Beane
 
Igor Bondarenko - Process organization of the development modules specific to...
Igor Bondarenko - Process organization of the development modules specific to...Igor Bondarenko - Process organization of the development modules specific to...
Igor Bondarenko - Process organization of the development modules specific to...Meet Magento Italy
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceMeet Magento Italy
 

What's hot (20)

Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
Magento 2 - An Intro to a Modern PHP-Based System - Northeast PHP 2015
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
Max Yekaterinenko - Magento 2 & Quality
Max Yekaterinenko - Magento 2 & QualityMax Yekaterinenko - Magento 2 & Quality
Max Yekaterinenko - Magento 2 & Quality
 
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
Magento 2 - An Intro to a Modern PHP-Based System - ZendCon 2015
 
How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)How To Install Magento 2 (updated for the latest version)
How To Install Magento 2 (updated for the latest version)
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]
 
Ajax for PHP Developers
Ajax for PHP DevelopersAjax for PHP Developers
Ajax for PHP Developers
 
Dependency Injection Extended: the way to advanced Magento 2 development
Dependency Injection Extended: the way to advanced Magento 2 developmentDependency Injection Extended: the way to advanced Magento 2 development
Dependency Injection Extended: the way to advanced Magento 2 development
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향
ASP.NET을 중심으로 한 웹 개발 기술의 발전과 마이크로소프트의 최근 동향
 
Magento 2 Modules are Easy!
Magento 2 Modules are Easy!Magento 2 Modules are Easy!
Magento 2 Modules are Easy!
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design Patterns
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2
 
Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015
 
2020 [pweb] 13 typescript
2020 [pweb] 13 typescript2020 [pweb] 13 typescript
2020 [pweb] 13 typescript
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2
 
Igor Bondarenko - Process organization of the development modules specific to...
Igor Bondarenko - Process organization of the development modules specific to...Igor Bondarenko - Process organization of the development modules specific to...
Igor Bondarenko - Process organization of the development modules specific to...
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performance
 
Job
JobJob
Job
 

Similar to Magento 2 TDD Code Kata Intro

Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)vinaikopp
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)vinaikopp
 
Vinai Kopp - How i develop M2 modules
Vinai Kopp - How i develop M2 modules Vinai Kopp - How i develop M2 modules
Vinai Kopp - How i develop M2 modules Meet Magento Italy
 
Contribution Day Guide - MM19JP
Contribution Day Guide - MM19JPContribution Day Guide - MM19JP
Contribution Day Guide - MM19JPOleksii Korshenko
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecturevinaikopp
 
Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020Slava Mankivski
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponentsvinaikopp
 
Ai for Art and Design with TensorFlow Lite - TFUG India Summit
Ai for Art and Design with TensorFlow Lite - TFUG India SummitAi for Art and Design with TensorFlow Lite - TFUG India Summit
Ai for Art and Design with TensorFlow Lite - TFUG India SummitMargaret Maynard-Reid
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNvinaikopp
 
Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Oleksii Korshenko
 
Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptAutomate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptCatalyst
 
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by DefaultJS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by DefaultJSFestUA
 
From a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFrom a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFlorian Rival
 
Engaging Tech Students Past Traditional Hands On
Engaging Tech Students Past Traditional Hands OnEngaging Tech Students Past Traditional Hands On
Engaging Tech Students Past Traditional Hands OnFiras Obeid
 
35C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 235C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 2tobiaspreuss
 
How To Win a Hackaton - My thoughts on the WebGeek Devcup
How To Win a Hackaton - My thoughts on the WebGeek DevcupHow To Win a Hackaton - My thoughts on the WebGeek Devcup
How To Win a Hackaton - My thoughts on the WebGeek DevcupNikko Bautista
 
Database versioning in golang
Database versioning in golangDatabase versioning in golang
Database versioning in golangThuc Le Dong
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1David Amend
 

Similar to Magento 2 TDD Code Kata Intro (20)

Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)Writing Testable Code (for Magento 1 and 2)
Writing Testable Code (for Magento 1 and 2)
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
 
Vinai Kopp - How i develop M2 modules
Vinai Kopp - How i develop M2 modules Vinai Kopp - How i develop M2 modules
Vinai Kopp - How i develop M2 modules
 
Contribution Day Guide - MM19JP
Contribution Day Guide - MM19JPContribution Day Guide - MM19JP
Contribution Day Guide - MM19JP
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
 
Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
 
Geek git
Geek gitGeek git
Geek git
 
Ai for Art and Design with TensorFlow Lite - TFUG India Summit
Ai for Art and Design with TensorFlow Lite - TFUG India SummitAi for Art and Design with TensorFlow Lite - TFUG India Summit
Ai for Art and Design with TensorFlow Lite - TFUG India Summit
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRN
 
Magento best practices
Magento best practicesMagento best practices
Magento best practices
 
Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019
 
Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptAutomate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
 
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by DefaultJS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
 
From a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFrom a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscripten
 
Engaging Tech Students Past Traditional Hands On
Engaging Tech Students Past Traditional Hands OnEngaging Tech Students Past Traditional Hands On
Engaging Tech Students Past Traditional Hands On
 
35C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 235C3: EventFahrplan - Lightning Talk - Day 2
35C3: EventFahrplan - Lightning Talk - Day 2
 
How To Win a Hackaton - My thoughts on the WebGeek Devcup
How To Win a Hackaton - My thoughts on the WebGeek DevcupHow To Win a Hackaton - My thoughts on the WebGeek Devcup
How To Win a Hackaton - My thoughts on the WebGeek Devcup
 
Database versioning in golang
Database versioning in golangDatabase versioning in golang
Database versioning in golang
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 

More from vinaikopp

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023vinaikopp
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHPvinaikopp
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019vinaikopp
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017vinaikopp
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17devinaikopp
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other sidevinaikopp
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)vinaikopp
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014vinaikopp
 

More from vinaikopp (8)

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other side
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
 

Recently uploaded

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Magento 2 TDD Code Kata Intro

  • 1. Code Katas for Magento 2 TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 2. Code Kata? TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 3. We practice our craft. TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 4. Like an 80s movie Training Montage TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 5. Today's Kata: Magento 2 Total Model TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 6. Training Module: Example_GiftItem Add a free water bottle to the cart when the customer adds a product from the sample data Bags attribute set. https://github.com/Vinai/module-example-giftitem TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 7. Training Module: Example_GiftItem The gift item total model is responsible for setting the price of gift items to zero. https://github.com/Vinai/module-example-giftitem TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 8. What does this kata teach? TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 9. (1/2) Generic skills: 4 TDD Red-Green-Refactor process 4 Working with stubs & mocks 4 Separating pure functions and side effects TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 10. (2/2) Magento 2 skills: 4 Test driving Magento code 4 Memorizing the total model architecture 4 Dealing with Law of Demeter violations TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 11. Getting started: # Create module dir mkdir -p app/code/Example && cd app/code/Example # Clone repo git clone https://github.com/Vinai/module-example-giftitem.git GiftItem cd GiftItem # Check out git tag git checkout beginning-of-kata TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 12. Kata Task: Test drive the Example_GiftItem total model ModelTotalsGiftItemAddressTotal TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 13. Target collect() behavior: 4 Subtract gift item row totals and base row totals from the subtotal 4 Set calculation_price and base_calculation_price of every gift item to zero 4 Call calcRowTotal on each item TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  • 14. Enjoy the session and feel those reflexes get sharper! TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp