SlideShare ist ein Scribd-Unternehmen logo
1 von 98
Downloaden Sie, um offline zu lesen
GETTING YOUR HANDS DIRTY
TESTING
MAGENTO 2
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
ME
Freelance Developer & Trainer
https://github.com/vinai
https://twitter.com/vinaikopp
Dev since 1998
PHP WebDev since PHP3 (1999)
Magento since 2008-01-01
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TESTING
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
WHO IS DOING IT?
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
WHAT TOOL?
> PHPUnit?
> Behat && PHPSpec?
> Selenium?
> Codeception?
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD
BINGO
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD I:
UNIT TEST
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ vendor/bin/phpunit -c "dev/tests/unit/phpunit.xml.dist"
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ alias unit-test="$(pwd)/vendor/bin/phpunit
-c $(pwd)/dev/tests/unit/phpunit.xml.dist"
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ unit-test
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ unit-test "app/code/My/Module/Test/Unit"
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TRY IT
vendor/bin/phpunit 
-c "dev/tests/unit/phpunit.xml.dist" 
vendor/magento/module-catalog/Test/Unit/Block
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD II:
INTEGRATION
TEST
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
WHAT IS THE
DIFFERENCE?
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
REAL OBJECTS INTERACT
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
INTEGRATION TESTS NEED THE
RUNTIME ENVIRONMENT
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
A failing unit test tells me
exactly where my code is broken.
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
A failing integration test only
tells me that something is broken.
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Separate DB
dev/tests/integration/etc/install-config-mysql.php.dist
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ vendor/bin/phpunit -c dev/tests/integration/phpunit.xml
Could not read "dev/tests/integration/phpunit.xml".
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
$ cd dev/tests/integration
$ ../../../vendor/bin/phpunit
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Every run gets it's own
etc, pub and var dirs
dev/tests/integration/tmp/
sandbox-0-b79c13eb842cf3211459b11c775bfbde/
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD III:
TDD
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
WHAT IS TDD?
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
THE 3 RULES
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
I. No production code without
a failing unit test
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
II. Once there is a failing unit test,
stop and make it pass
by writing production code
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
III. Once the test passes,
stop writing production code
until you have a failing unit test again
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TDD FOR MAGENTO 2
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
NO DIFFERENCE
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
</TDD>
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
To learn more about TDD,
check out the Clean Coders
Videos from Robert C. Martin
http://cleancoders.com
(or do a training)
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
INTEGRATION TESTS
FOR MAGENTO 2
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
VERY SPECIFIC
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
PLATFORM KNOWLEDGE
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Magento 2 Testing Framework
dev/tests/integration/framework
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Test Framework ObjectManager
MagentoTestFrameworkObjectManager::getInstance()
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Dependencies
$configReader = $objectManager->create(Reader::class);
$deploymentConfig = $objectManager->create(
DeploymentConfig::class,
['reader' => $configReader]
);
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD IV
FIXTURES
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Fix the system into a known state
before a test is executed.
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Simple PHP Scripts
Relative to
dev/tests/integration/testsuite
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
/**
* @magentoDataFixture Magento/Sales/_files/order.php
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
public function testSomethingWithAnOrderAndACustomer()
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
CONFIG FIXTURES
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Store Scope
/**
* @magentoConfigFixture current_store catalog/price/scope 1
*/
public function testDoesSomeoneReadThisHelpMeLetMeOut()
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Global Scope
/**
* @magentoConfigFixture currency/options/allow USD
*/
public function testHowMashAndPieTastes()
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
BUZZWORD V
TEST ISOLATION
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
FRESH INSTALL
FOR EACH TEST RUN
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
dev/tests/integration/phpunit.xml.dist
<phpunit>
...
<php>
...
<const name="TESTS_CLEANUP" value="enabled"/>
...
</php>
...
</phpunit>
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TESTS_CLEANUP
== disabled
SPEEDS THINGS UP
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TESTS_CLEANUP
== disabled
MANUAL CLEANUP REQUIRED
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
integration/tmp/sandbox-*
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
DATABASE ISOLATION
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TRANSACTIONS
OR
ROLLBACK SCRIPTS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TRANSACTIONS
/**
* @magentoDbIsolation enabled
*/
public function testWithoutSideEffects
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
TRANSACTIONS
/**
* @magentoDataFixture Magento/Foo/_files/bar.php
*/
public function testTheFixtureIsAppliedWithinATransaction
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
ROLLBACK SCRIPTS
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDbIsolation disabled
*/
public function testTransactionalCode()
{
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Before Test
include 'Magento/Customer/_files/customer.php';
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
After Test
include 'Magento/Customer/_files/customer_rollback.php';
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
APPLICATION ISOLATION
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
REINSTANTIATE
ALMOST EVERYTHING
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
RESET MAGENTO AFTER TEST
/**
* @magentoAppIsolation enabled
*/
public function testTestWithSingletons()
{
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Controller Tests: Automatic reset
class FooBarIndexActionTest extends
MagentoTestFrameworkTestCaseAbstractController
{
public function testTheLayoutIsRendered()
{
$this->dispatch('foo/bar/index');
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
REMEMBER
THIS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
ISOLATE
YOUR TESTS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
AND ALL WILL BE
GOOD
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
[breathing pause]
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
APPLICATION AREA
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
APP AREAS
global
frontend
adminhtml
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
/**
* @magentoAppArea frontend
*/
class AddressesTest extends PHPUnit_Framework_TestCase
{
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
MORE AREAS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
webapi_rest
webapi_soap
cron
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
MagentoTestFrameworkAppState
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
public function testPluginInWebapiRestScope()
{
$class = MagentoTestFrameworkAppState::class;
$appAreaState = $this->objectManager->get($class);
$appAreaState->setAreaCode('webapi_rest');
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
protected function tearDown()
{
// ...
$appAreaState->setAreaCode(null);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
ACTION
[CONTROLLER]
TESTS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
FRONTEND
MagentoTestFrameworkTestCase
AbstractController
ADMINHTML
MagentoTestFrameworkTestCase
AbstractBackendController
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
EXAMPLE!
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Event Observer for:
sales_order_place_after
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
I. TESTING THE
CONFIGURATION
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
public function testTheModuleRegistersASalesOrderPlaceAfterObserver()
{
$class = MagentoFrameworkEventConfig::class;
$eventConfig = ObjectManager::getInstance()->create($class);
$observers = $eventConfig->getObservers('sales_order_place_after');
$this->assertArrayHasKey('meetup_observer', $observers);
$expectedClass = MeetupObserverObserverSalesOrderPlaceAfter::class;
$this->assertSame($expectedClass, $observers['meetup_observer']['instance']);
$this->assertFalse($observers['meetup_observer']['shared']);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
1/2) Get the config in array format
$class = MagentoFrameworkEventConfig::class;
$eventConfig = ObjectManager::getInstance()->create($class);
$event = 'sales_order_place_after';
$observers = $eventConfig->getObservers($event);
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
2/2) Assert config values
$this->assertArrayHasKey('meetup_observer', $observers);
$this->assertSame(
SalesOrderPlaceAfter::class,
$observers['meetup_observer']['instance']
);
$this->assertFalse($observers['meetup_observer']['shared']);
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
II. TESTING THE OBSERVER
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
O_0(NOTHING TO TEST)
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
III. INTEGRATION TEST
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
Our observer has no side effects.
We have to improvise...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testSalesOrderPlaceAfterObserverIsCalled()
{
$this->injectMockObserverWithExpectation();
$order = $this->getOrderFixture();
$this->objectManager
->create(OrderManagementInterface::class)
->place($order);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
public function injectMockObserverWithExpectation()
{
$mockObserver = $this->getMock(SalesOrderPlaceAfter::class);
$mockObserver->expects($this->once())->method('execute');
$this->registerObserverTestDouble($mockObserver);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
private function registerObserverTestDouble($mockObserver)
{
$class = MagentoFrameworkEventConfigData::class;
$eventConfigData = $this->objectManager->get($class);
$event = 'sales_order_place_after';
$name = 'meetup_observer';
$eventConfigData->merge(
[$event => [$name => ['shared' => true]]]
);
// ...
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
private function registerObserverTestDouble($mockObserver)
{
// ...
$this->objectManager->addSharedInstance(
$mockObserver,
SalesOrderPlaceAfter::class
);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testSalesOrderPlaceAfterObserverIsCalled()
{
// ...
$order = $this->getOrderFixture();
// ...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
private function getOrderFixture()
{
$class = OrderRepositoryInterface::class;
$orderRepository = $this->objectManager->create($class);
$criteria = $this->objectManager
->create(SearchCriteriaBuilder::class)
->addFilter('increment_id', '100000001')
->create();
$result = $orderRepository->getList($criteria);
return array_values($result->getItems())[0];
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testSalesOrderPlaceAfterObserverIsCalled()
{
$this->injectMockObserverWithExpectation();
$order = $this->getOrderFixture();
$this->objectManager
->create(OrderManagementInterface::class)
->place($order);
}
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
GO FORTH
AND TESTALL THINGS!
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
ONE MORE THING...
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
MAGE2KATAS
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
MAGE2KATAS
> Screencast Series
> Examples
> Code Katas
mage2katas.com
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
THANK YOU <3
Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp

Weitere ähnliche Inhalte

Andere mochten auch

Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMeet Magento Italy
 
Magento 2 overview. Alan Kent
Magento 2 overview. Alan Kent Magento 2 overview. Alan Kent
Magento 2 overview. Alan Kent MeetMagentoNY2014
 
Sergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionSergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionMeet Magento Italy
 
Magento 2 looks like.
Magento 2 looks like.Magento 2 looks like.
Magento 2 looks like.Magestore
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Meet Magento Italy
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design PatternsMax Pronko
 
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
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksYireo
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2Magestore
 
Meet Magento Belarus - Magento2: What to expect and when? - Elena Leonova
Meet Magento Belarus -  Magento2: What to expect and when? - Elena LeonovaMeet Magento Belarus -  Magento2: What to expect and when? - Elena Leonova
Meet Magento Belarus - Magento2: What to expect and when? - Elena LeonovaElena Leonova
 
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
 
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
 
How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1Magestore
 

Andere mochten auch (15)

Max Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overviewMax Yekaterynenko: Magento 2 overview
Max Yekaterynenko: Magento 2 overview
 
Magento 2 overview. Alan Kent
Magento 2 overview. Alan Kent Magento 2 overview. Alan Kent
Magento 2 overview. Alan Kent
 
Sergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions DistributionSergii Shymko: Magento 2: Composer for Extensions Distribution
Sergii Shymko: Magento 2: Composer for Extensions Distribution
 
Magento 2 looks like.
Magento 2 looks like.Magento 2 looks like.
Magento 2 looks like.
 
Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2Sergii Shymko - Code migration tool for upgrade to Magento 2
Sergii Shymko - Code migration tool for upgrade to Magento 2
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design Patterns
 
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
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2
 
Meet Magento Belarus - Magento2: What to expect and when? - Elena Leonova
Meet Magento Belarus -  Magento2: What to expect and when? - Elena LeonovaMeet Magento Belarus -  Magento2: What to expect and when? - Elena Leonova
Meet Magento Belarus - Magento2: What to expect and when? - Elena Leonova
 
Outlook on Magento 2
Outlook on Magento 2Outlook on Magento 2
Outlook on Magento 2
 
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
 
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
 
How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1How To Create Theme in Magento 2 - Part 1
How To Create Theme in Magento 2 - Part 1
 

Ähnlich wie Getting your Hands Dirty Testing Magento 2 (at London Meetup)

Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romainavinaikopp
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2vinaikopp
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Introvinaikopp
 
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
 
Vinai Kopp - FPC Hole punching in Magento 2
Vinai Kopp - FPC Hole punching in Magento 2Vinai Kopp - FPC Hole punching in Magento 2
Vinai Kopp - FPC Hole punching in Magento 2Meet Magento Italy
 
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
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Katavinaikopp
 
Awesome Architectures in Magento 2.3 - MM19PL
Awesome Architectures in Magento 2.3 - MM19PLAwesome Architectures in Magento 2.3 - MM19PL
Awesome Architectures in Magento 2.3 - MM19PLRiccardo Tempesta
 
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016Tatiane Aguirres Nogueira
 
Contribution Day Guide - MM19JP
Contribution Day Guide - MM19JPContribution Day Guide - MM19JP
Contribution Day Guide - MM19JPOleksii Korshenko
 
2020 [pweb] 13 typescript
2020 [pweb] 13 typescript2020 [pweb] 13 typescript
2020 [pweb] 13 typescriptVICTOR JATOBÁ
 
Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Oleksii Korshenko
 
Tools out of the box with Magento 2 in PHPSTORM
Tools out of the box with Magento 2 in PHPSTORMTools out of the box with Magento 2 in PHPSTORM
Tools out of the box with Magento 2 in PHPSTORMAndra Elena Lungu
 
28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento News28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento NewsMagento Meetup Austria
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016Ciaran Rooney
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponentsvinaikopp
 
RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2Somkiat Puisungnoen
 
Learnings PIM introduction - Magento Meetup Wien - may 2016
Learnings PIM introduction - Magento Meetup Wien - may 2016Learnings PIM introduction - Magento Meetup Wien - may 2016
Learnings PIM introduction - Magento Meetup Wien - may 2016Hartwig Brandl
 

Ähnlich wie Getting your Hands Dirty Testing Magento 2 (at London Meetup) (20)

Writing Testable Code (for Magento 1 and 2) 2016 Romaina
Writing Testable Code (for Magento 1 and 2)  2016 RomainaWriting Testable Code (for Magento 1 and 2)  2016 Romaina
Writing Testable Code (for Magento 1 and 2) 2016 Romaina
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Intro
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
 
Vinai Kopp - FPC Hole punching in Magento 2
Vinai Kopp - FPC Hole punching in Magento 2Vinai Kopp - FPC Hole punching in Magento 2
Vinai Kopp - FPC Hole punching in Magento 2
 
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
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Kata
 
Awesome Architectures in Magento 2.3 - MM19PL
Awesome Architectures in Magento 2.3 - MM19PLAwesome Architectures in Magento 2.3 - MM19PL
Awesome Architectures in Magento 2.3 - MM19PL
 
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
 
Contribution Day Guide - MM19JP
Contribution Day Guide - MM19JPContribution Day Guide - MM19JP
Contribution Day Guide - MM19JP
 
2020 [pweb] 13 typescript
2020 [pweb] 13 typescript2020 [pweb] 13 typescript
2020 [pweb] 13 typescript
 
GraphQL in Magento 2
GraphQL in Magento 2GraphQL in Magento 2
GraphQL in Magento 2
 
Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019Contribution day guide. MM19ES 2019
Contribution day guide. MM19ES 2019
 
Ionic 2 - O que mudou?
Ionic 2 - O que mudou?Ionic 2 - O que mudou?
Ionic 2 - O que mudou?
 
Tools out of the box with Magento 2 in PHPSTORM
Tools out of the box with Magento 2 in PHPSTORMTools out of the box with Magento 2 in PHPSTORM
Tools out of the box with Magento 2 in PHPSTORM
 
28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento News28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento News
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
 
RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2RobotFramework Meetup at Thailand #2
RobotFramework Meetup at Thailand #2
 
Learnings PIM introduction - Magento Meetup Wien - may 2016
Learnings PIM introduction - Magento Meetup Wien - may 2016Learnings PIM introduction - Magento Meetup Wien - may 2016
Learnings PIM introduction - Magento Meetup Wien - may 2016
 

Mehr von vinaikopp

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023vinaikopp
 
Hyvä: Compatibility Modules
Hyvä: Compatibility ModulesHyvä: Compatibility Modules
Hyvä: Compatibility Modulesvinaikopp
 
Hyvä from a developer perspective
Hyvä from a developer perspectiveHyvä from a developer perspective
Hyvä from a developer perspectivevinaikopp
 
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
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018vinaikopp
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNvinaikopp
 
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
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)vinaikopp
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slidesvinaikopp
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecturevinaikopp
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014vinaikopp
 

Mehr von vinaikopp (14)

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
 
Hyvä: Compatibility Modules
Hyvä: Compatibility ModulesHyvä: Compatibility Modules
Hyvä: Compatibility Modules
 
Hyvä from a developer perspective
Hyvä from a developer perspectiveHyvä from a developer perspective
Hyvä from a developer perspective
 
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
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018
 
ClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRNClojureScript in Magento 2 - PHPUGMRN
ClojureScript in Magento 2 - PHPUGMRN
 
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
 
Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)Getting your hands dirty testing Magento 2 (at MageTitansIT)
Getting your hands dirty testing Magento 2 (at MageTitansIT)
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
 

Kürzlich hochgeladen

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 

Kürzlich hochgeladen (20)

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 

Getting your Hands Dirty Testing Magento 2 (at London Meetup)

  • 1. GETTING YOUR HANDS DIRTY TESTING MAGENTO 2 Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 2. ME Freelance Developer & Trainer https://github.com/vinai https://twitter.com/vinaikopp Dev since 1998 PHP WebDev since PHP3 (1999) Magento since 2008-01-01 Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 3. TESTING Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 4. WHO IS DOING IT? Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 5. WHAT TOOL? > PHPUnit? > Behat && PHPSpec? > Selenium? > Codeception? Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 6. BUZZWORD BINGO Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 7. BUZZWORD I: UNIT TEST Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 8. $ vendor/bin/phpunit -c "dev/tests/unit/phpunit.xml.dist" Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 9. $ alias unit-test="$(pwd)/vendor/bin/phpunit -c $(pwd)/dev/tests/unit/phpunit.xml.dist" Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 10. $ unit-test Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 11. $ unit-test "app/code/My/Module/Test/Unit" Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 12. TRY IT vendor/bin/phpunit -c "dev/tests/unit/phpunit.xml.dist" vendor/magento/module-catalog/Test/Unit/Block Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 13. BUZZWORD II: INTEGRATION TEST Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 14. WHAT IS THE DIFFERENCE? Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 15. REAL OBJECTS INTERACT Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 16. INTEGRATION TESTS NEED THE RUNTIME ENVIRONMENT Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 17. A failing unit test tells me exactly where my code is broken. Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 18. A failing integration test only tells me that something is broken. Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 19. Separate DB dev/tests/integration/etc/install-config-mysql.php.dist Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 20. $ vendor/bin/phpunit -c dev/tests/integration/phpunit.xml Could not read "dev/tests/integration/phpunit.xml". Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 21. $ cd dev/tests/integration $ ../../../vendor/bin/phpunit Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 22. Every run gets it's own etc, pub and var dirs dev/tests/integration/tmp/ sandbox-0-b79c13eb842cf3211459b11c775bfbde/ Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 23. BUZZWORD III: TDD Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 24. WHAT IS TDD? Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 25. THE 3 RULES Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 26. I. No production code without a failing unit test Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 27. II. Once there is a failing unit test, stop and make it pass by writing production code Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 28. III. Once the test passes, stop writing production code until you have a failing unit test again Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 29. TDD FOR MAGENTO 2 Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 30. NO DIFFERENCE Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 31. </TDD> Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 32. To learn more about TDD, check out the Clean Coders Videos from Robert C. Martin http://cleancoders.com (or do a training) Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 33. INTEGRATION TESTS FOR MAGENTO 2 Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 34. VERY SPECIFIC Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 35. PLATFORM KNOWLEDGE Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 36. Magento 2 Testing Framework dev/tests/integration/framework Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 37. Test Framework ObjectManager MagentoTestFrameworkObjectManager::getInstance() Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 38. Dependencies $configReader = $objectManager->create(Reader::class); $deploymentConfig = $objectManager->create( DeploymentConfig::class, ['reader' => $configReader] ); Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 39. BUZZWORD IV FIXTURES Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 40. Fix the system into a known state before a test is executed. Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 41. Simple PHP Scripts Relative to dev/tests/integration/testsuite Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 42. /** * @magentoDataFixture Magento/Sales/_files/order.php * @magentoDataFixture Magento/Customer/_files/customer.php */ public function testSomethingWithAnOrderAndACustomer() { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 43. CONFIG FIXTURES Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 44. Store Scope /** * @magentoConfigFixture current_store catalog/price/scope 1 */ public function testDoesSomeoneReadThisHelpMeLetMeOut() { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 45. Global Scope /** * @magentoConfigFixture currency/options/allow USD */ public function testHowMashAndPieTastes() { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 46. BUZZWORD V TEST ISOLATION Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 47. FRESH INSTALL FOR EACH TEST RUN Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 48. dev/tests/integration/phpunit.xml.dist <phpunit> ... <php> ... <const name="TESTS_CLEANUP" value="enabled"/> ... </php> ... </phpunit> Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 49. TESTS_CLEANUP == disabled SPEEDS THINGS UP Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 50. TESTS_CLEANUP == disabled MANUAL CLEANUP REQUIRED Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 51. integration/tmp/sandbox-* Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 52. DATABASE ISOLATION Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 53. TRANSACTIONS OR ROLLBACK SCRIPTS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 54. TRANSACTIONS /** * @magentoDbIsolation enabled */ public function testWithoutSideEffects { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 55. TRANSACTIONS /** * @magentoDataFixture Magento/Foo/_files/bar.php */ public function testTheFixtureIsAppliedWithinATransaction { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 56. ROLLBACK SCRIPTS /** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDbIsolation disabled */ public function testTransactionalCode() { // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 57. Before Test include 'Magento/Customer/_files/customer.php'; Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 58. After Test include 'Magento/Customer/_files/customer_rollback.php'; Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 59. APPLICATION ISOLATION Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 60. REINSTANTIATE ALMOST EVERYTHING Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 61. RESET MAGENTO AFTER TEST /** * @magentoAppIsolation enabled */ public function testTestWithSingletons() { Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 62. Controller Tests: Automatic reset class FooBarIndexActionTest extends MagentoTestFrameworkTestCaseAbstractController { public function testTheLayoutIsRendered() { $this->dispatch('foo/bar/index'); Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 63. REMEMBER THIS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 64. ISOLATE YOUR TESTS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 65. AND ALL WILL BE GOOD Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 66. [breathing pause] Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 67. APPLICATION AREA Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 68. APP AREAS global frontend adminhtml Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 69. /** * @magentoAppArea frontend */ class AddressesTest extends PHPUnit_Framework_TestCase { Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 70. MORE AREAS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 71. webapi_rest webapi_soap cron Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 72. MagentoTestFrameworkAppState Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 73. public function testPluginInWebapiRestScope() { $class = MagentoTestFrameworkAppState::class; $appAreaState = $this->objectManager->get($class); $appAreaState->setAreaCode('webapi_rest'); Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 74. protected function tearDown() { // ... $appAreaState->setAreaCode(null); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 75. ACTION [CONTROLLER] TESTS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 76. FRONTEND MagentoTestFrameworkTestCase AbstractController ADMINHTML MagentoTestFrameworkTestCase AbstractBackendController Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 77. EXAMPLE! Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 78. Event Observer for: sales_order_place_after Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 79. I. TESTING THE CONFIGURATION Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 80. public function testTheModuleRegistersASalesOrderPlaceAfterObserver() { $class = MagentoFrameworkEventConfig::class; $eventConfig = ObjectManager::getInstance()->create($class); $observers = $eventConfig->getObservers('sales_order_place_after'); $this->assertArrayHasKey('meetup_observer', $observers); $expectedClass = MeetupObserverObserverSalesOrderPlaceAfter::class; $this->assertSame($expectedClass, $observers['meetup_observer']['instance']); $this->assertFalse($observers['meetup_observer']['shared']); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 81. 1/2) Get the config in array format $class = MagentoFrameworkEventConfig::class; $eventConfig = ObjectManager::getInstance()->create($class); $event = 'sales_order_place_after'; $observers = $eventConfig->getObservers($event); Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 82. 2/2) Assert config values $this->assertArrayHasKey('meetup_observer', $observers); $this->assertSame( SalesOrderPlaceAfter::class, $observers['meetup_observer']['instance'] ); $this->assertFalse($observers['meetup_observer']['shared']); Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 83. II. TESTING THE OBSERVER Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 84. O_0(NOTHING TO TEST) Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 85. III. INTEGRATION TEST Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 86. Our observer has no side effects. We have to improvise... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 87. /** * @magentoDataFixture Magento/Sales/_files/order.php */ public function testSalesOrderPlaceAfterObserverIsCalled() { $this->injectMockObserverWithExpectation(); $order = $this->getOrderFixture(); $this->objectManager ->create(OrderManagementInterface::class) ->place($order); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 88. public function injectMockObserverWithExpectation() { $mockObserver = $this->getMock(SalesOrderPlaceAfter::class); $mockObserver->expects($this->once())->method('execute'); $this->registerObserverTestDouble($mockObserver); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 89. private function registerObserverTestDouble($mockObserver) { $class = MagentoFrameworkEventConfigData::class; $eventConfigData = $this->objectManager->get($class); $event = 'sales_order_place_after'; $name = 'meetup_observer'; $eventConfigData->merge( [$event => [$name => ['shared' => true]]] ); // ... } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 90. private function registerObserverTestDouble($mockObserver) { // ... $this->objectManager->addSharedInstance( $mockObserver, SalesOrderPlaceAfter::class ); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 91. /** * @magentoDataFixture Magento/Sales/_files/order.php */ public function testSalesOrderPlaceAfterObserverIsCalled() { // ... $order = $this->getOrderFixture(); // ... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 92. private function getOrderFixture() { $class = OrderRepositoryInterface::class; $orderRepository = $this->objectManager->create($class); $criteria = $this->objectManager ->create(SearchCriteriaBuilder::class) ->addFilter('increment_id', '100000001') ->create(); $result = $orderRepository->getList($criteria); return array_values($result->getItems())[0]; } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 93. /** * @magentoDataFixture Magento/Sales/_files/order.php */ public function testSalesOrderPlaceAfterObserverIsCalled() { $this->injectMockObserverWithExpectation(); $order = $this->getOrderFixture(); $this->objectManager ->create(OrderManagementInterface::class) ->place($order); } Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 94. GO FORTH AND TESTALL THINGS! Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 95. ONE MORE THING... Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 96. MAGE2KATAS Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 97. MAGE2KATAS > Screencast Series > Examples > Code Katas mage2katas.com Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp
  • 98. THANK YOU <3 Getting your hands dirty Testing Magento 2 - Magento London Meetup, Feb. 2016 - ! - contact@vinaikopp.com - twitter://@VinaiKopp