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
 
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
 
TechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsTechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsDavid Sottimano
 

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
 
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
 
TechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsTechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOs
 

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

March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarThousandEyes
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingMAGNIntelligence
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and businessFrancesco Corti
 

Recently uploaded (20)

March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? Webinar
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced Computing
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and business
 

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