├── dev └── tests │ ├── integration │ ├── etc │ │ └── install-config-mysql.php │ └── phpunit.xml │ ├── functional │ ├── etc │ │ └── config.xml │ └── phpunit.xml │ └── unit │ └── phpunit.xml ├── composer.json └── README.md /dev/tests/integration/etc/install-config-mysql.php: -------------------------------------------------------------------------------- 1 | 'mysql', 9 | 'db-user' => 'root', 10 | 'db-password' => 'enAVINa2', 11 | 'db-name' => 'magento_integration_tests', 12 | 'db-prefix' => '', 13 | 'backend-frontname' => 'backend', 14 | 'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 15 | 'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 16 | 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 17 | 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 18 | 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, 19 | ]; 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tddwizard/magento2-exercises", 3 | "description": "Test configuration files for magento2-dockerized setup and the Test Driven Magento exercises", 4 | "license": "Apache-2.0", 5 | "authors": [ 6 | { 7 | "name": "Fabian Schmengler", 8 | "email": "fabian@schmengler-se.de", 9 | "homepage": "https://www.schmengler-se.de", 10 | "role": "Author" 11 | } 12 | ], 13 | "type": "magento2-component", 14 | "homepage": "https://github.com/tddwizard/magento2-exercises", 15 | "extra": { 16 | "map": [ 17 | [ 18 | "dev/tests/integration/phpunit.xml", 19 | "dev/tests/integration/phpunit.xml" 20 | ], 21 | [ 22 | "dev/tests/integration/etc/install-config-mysql.php", 23 | "dev/tests/integration/etc/install-config-mysql.php" 24 | ], 25 | [ 26 | "dev/tests/functional/phpunit.xml", 27 | "dev/tests/functional/phpunit.xml" 28 | ], 29 | [ 30 | "dev/tests/unit/phpunit.xml", 31 | "dev/tests/unit/phpunit.xml" 32 | ], 33 | [ 34 | "dev/tests/functional/etc/config.xml", 35 | "dev/tests/functional/etc/config.xml" 36 | ] 37 | ] 38 | }, 39 | "require": { 40 | "tddwizard/exercise-contact": "dev-master@dev", 41 | "tddwizard/exercise-brands": "dev-master@dev" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Test Driven Magento: Exercises 2 | 3 | Exercises for the Test Driven Magento course. The exercise descriptions are in the [Wiki](https://github.com/tddwizard/magento2-exercises/wiki) 4 | 5 | ## TDD Katas 6 | 7 | To get started with TDD Katas (not Magento), refer to this tutorial: [Get Ready for TDD Katas with PHPUnit + PhpStorm 8 | ](https://www.schmengler-se.de/en/2017/01/get-ready-for-tdd-katas-with-phpunit-phpstorm/) 9 | 10 | ## Docker Dev Environment 11 | 12 | If you use Docker, a Magento 2 dev environment which is suitable for tests, can be created as follows: 13 | 14 | 1. Install Magento via composer 15 | 16 | composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition --ignore-platform-reqs 17 | 18 | More info: http://devdocs.magento.com/guides/v2.2/install-gde/prereq/integrator_install_ce.html 19 | 20 | 2. Install the dockerize-magento2 component 21 | 22 | composer require --ignore-platform-reqs tddwizard/magento2-dockerized:@dev 23 | 24 | More info: https://github.com/tddwizard/magento2-dockerized 25 | 26 | 3. Install the test configuration for the exercises: 27 | 28 | composer require tddwizard/magento2-exercises:@dev 29 | 30 | Or download and copy the files from `dev` in this repository manually into `dev` of your Magento installation -------------------------------------------------------------------------------- /dev/tests/functional/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | testCase 11 | admin 12 | enAVINa2 13 | http://www.magento.lh/management/ 14 | admin/auth/login 15 | 16 | 17 | dev/tests/functional/isolation.php 18 | none 19 | none 20 | none 21 | 22 | 23 | www.magento.lh 24 | admin 25 | enAVINa2 26 | magento_functional_tests 27 | http://www.magento.lh/ 28 | management 29 | 30 | 31 | 33 | 34 | ANY 35 | 36 | 37 | 38 | 39 | 40 | w13qvo0pcwildt8urh0aotmeilxx4s7j 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /dev/tests/functional/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | tests/app/Fooman 22 | 23 | 24 | tests/app/TddWizard 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /dev/tests/unit/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 15 | ../../../app/code/TddWizard/*/Test/Unit 16 | 17 | 18 | ../../../vendor/tddwizard/*/Test/Unit 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ../../../app/code/* 27 | ../../../lib/internal/Magento 28 | ../../../setup/src/* 29 | 30 | ../../../app/code/*/*/Test 31 | ../../../lib/internal/*/*/Test 32 | ../../../lib/internal/*/*/*/Test 33 | ../../../setup/src/*/*/Test 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 47 | 50 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /dev/tests/integration/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 14 | 15 | 16 | ../../../app/code/TddWizard/*/Test/Integration 17 | 18 | 19 | ../../../vendor/tddwizard/*/tests 20 | 21 | 22 | 23 | 24 | 25 | ../../../app/code/Magento 26 | ../../../lib/internal/Magento 27 | 28 | ../../../app/code/*/*/Test 29 | ../../../lib/internal/*/*/Test 30 | ../../../lib/internal/*/*/*/Test 31 | ../../../setup/src/*/*/Test 32 | 33 | 34 | 35 | 36 | 37 | . 38 | testsuite 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | --------------------------------------------------------------------------------