├── Chapter 10 ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── appspec.yml │ ├── aws │ └── codedeploy │ │ └── containers_setup_php.sh │ ├── bitbucket-pipelines.yml │ ├── codebase │ ├── .htaccess │ ├── .idea │ │ ├── .gitignore │ │ ├── codebase.iml │ │ ├── inspectionProfiles │ │ │ └── profiles_settings.xml │ │ ├── modules.xml │ │ ├── php-test-framework.xml │ │ ├── php.xml │ │ └── vcs.xml │ ├── behat │ │ ├── .gitignore │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── behat.iml │ │ │ ├── inspectionProfiles │ │ │ │ └── profiles_settings.xml │ │ │ ├── modules.xml │ │ │ ├── php-test-framework.xml │ │ │ ├── php.xml │ │ │ └── vcs.xml │ │ ├── behat.yml │ │ ├── composer.json │ │ ├── features │ │ │ ├── bootstrap │ │ │ │ ├── CreateToyCarRecordContext.php │ │ │ │ ├── FeatureContext.php │ │ │ │ ├── HomeContext.php │ │ │ │ ├── InventoryClerkLoginContext.php │ │ │ │ └── InventoryClerkRegistrationContext.php │ │ │ ├── default │ │ │ │ └── home.feature │ │ │ ├── suite_a │ │ │ │ └── inventory_clerk_registration.feature │ │ │ ├── suite_b │ │ │ │ └── inventory_clerk_login.feature │ │ │ ├── suite_c │ │ │ │ └── create_toy_car_record.feature │ │ │ └── suite_d │ │ │ │ └── view_toy_car_table.feature │ │ ├── runBehatTests.sh │ │ ├── runDebugBehat.sh │ │ └── setup.sh │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── bundles.php │ │ ├── config_test.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── eloquent.yaml │ │ │ ├── framework.yaml │ │ │ ├── routing.yaml │ │ │ ├── security.yaml │ │ │ ├── translation.yaml │ │ │ ├── twig.yaml │ │ │ └── validator.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── feature │ │ └── homepage.feature │ │ ├── features │ │ └── bootstrap │ │ │ └── FeatureContext.php │ │ ├── migrations │ │ └── Version20221009235830.php │ │ ├── phpunit.xml │ │ ├── phpunit.xml.dist │ │ ├── public │ │ ├── .htaccess │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runTests.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ ├── ClerkController.php │ │ │ ├── HomeController.php │ │ │ ├── LoginController.php │ │ │ ├── RegistrationController.php │ │ │ └── TableController.php │ │ ├── DAL │ │ │ ├── Reader │ │ │ │ ├── Doctrine │ │ │ │ │ ├── ColorReader.php │ │ │ │ │ ├── ManufacturerReader.php │ │ │ │ │ ├── ReaderBase.php │ │ │ │ │ └── ToyCarReader.php │ │ │ │ └── ReaderInterface.php │ │ │ └── Writer │ │ │ │ ├── Doctrine │ │ │ │ └── ToyCarWriter.php │ │ │ │ ├── WriterException.php │ │ │ │ └── WriterInterface.php │ │ ├── DataFixtures │ │ │ └── AppFixtures.php │ │ ├── Entity │ │ │ ├── Color.php │ │ │ ├── Manufacturer.php │ │ │ ├── ToyCar.php │ │ │ └── User.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Factory │ │ │ └── ToyCarValidatorFactory.php │ │ ├── Form │ │ │ └── RegistrationFormType.php │ │ ├── Kernel.php │ │ ├── Model │ │ │ ├── .gitignore │ │ │ ├── CarManufacturer.php │ │ │ ├── ModelInterface.php │ │ │ ├── ToyCar.php │ │ │ ├── ToyColor.php │ │ │ └── ValidationModel.php │ │ ├── Processor │ │ │ └── ToyCarCreator.php │ │ ├── Repository │ │ │ ├── ColorRepository.php │ │ │ ├── ManufacturerRepository.php │ │ │ ├── ToyCarRepository.php │ │ │ └── UserRepository.php │ │ └── Validator │ │ │ ├── NameValidator.php │ │ │ ├── StringValidatorInterface.php │ │ │ ├── ToyCarTooOldException.php │ │ │ ├── ToyCarValidationException.php │ │ │ ├── ToyCarValidator.php │ │ │ ├── ToyCarValidatorInterface.php │ │ │ ├── ValidatorInterface.php │ │ │ └── YearValidator.php │ │ ├── symfony.lock │ │ ├── templates │ │ ├── base.html.twig │ │ ├── clerk │ │ │ └── index.html.twig │ │ ├── home │ │ │ └── index.html.twig │ │ ├── login │ │ │ └── index.html.twig │ │ ├── registration │ │ │ └── register.html.twig │ │ └── table │ │ │ └── index.html.twig │ │ ├── tests │ │ ├── Functional │ │ │ └── Controller │ │ │ │ ├── ClerkControllerTest.php │ │ │ │ ├── HomeControllerTest.php │ │ │ │ ├── LoginControllerTest.php │ │ │ │ ├── RegistrationControllerTest.php │ │ │ │ └── TableControllerTest.php │ │ ├── Integration │ │ │ ├── DAL │ │ │ │ ├── Reader │ │ │ │ │ ├── ColorReaderTest.php │ │ │ │ │ ├── DataReaderTestBase.php │ │ │ │ │ ├── ManufacturerReaderTest.php │ │ │ │ │ └── ToyCarReaderTest.php │ │ │ │ └── Writer │ │ │ │ │ └── DoctrineToyCarWriterTest.php │ │ │ ├── Factory │ │ │ │ └── ToyCarValidatorFactoryTest.php │ │ │ └── Processor │ │ │ │ └── ToyCarCreatorTest.php │ │ ├── Unit │ │ │ ├── CalculationTest.php │ │ │ └── Validator │ │ │ │ ├── NameValidatorTest.php │ │ │ │ ├── ToyCarValidatorTest.php │ │ │ │ └── YearValidatorTest.php │ │ └── bootstrap.php │ │ └── translations │ │ └── .gitignore │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ ├── docker-compose-production.yml │ └── docker-compose.yml ├── Chapter 3 ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ └── php8docker.iml │ ├── codebase │ └── index.php │ └── docker │ ├── .env_example │ ├── Dockerfile │ └── docker-compose.yml ├── Chapter 5 ├── .idea │ ├── .gitignore │ ├── chapter5.iml │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ └── php.xml ├── base.zip ├── base │ ├── demoSetup.sh │ └── phptdd │ │ ├── .idea │ │ ├── .gitignore │ │ ├── inspectionProfiles │ │ │ └── profiles_settings.xml │ │ ├── modules.xml │ │ ├── php.xml │ │ └── phptdd.iml │ │ ├── codebase │ │ ├── .htaccess │ │ ├── index.php │ │ └── symfony │ │ │ ├── .env │ │ │ ├── .env.test │ │ │ ├── .gitignore │ │ │ ├── bin │ │ │ ├── console │ │ │ └── phpunit │ │ │ ├── composer.json │ │ │ ├── composer.lock │ │ │ ├── config │ │ │ ├── bundles.php │ │ │ ├── packages │ │ │ │ ├── cache.yaml │ │ │ │ ├── doctrine.yaml │ │ │ │ ├── doctrine_migrations.yaml │ │ │ │ ├── framework.yaml │ │ │ │ └── routing.yaml │ │ │ ├── preload.php │ │ │ ├── routes.yaml │ │ │ ├── routes │ │ │ │ └── framework.yaml │ │ │ └── services.yaml │ │ │ ├── migrations │ │ │ └── .gitignore │ │ │ ├── phpunit.xml.dist │ │ │ ├── public │ │ │ └── index.php │ │ │ ├── runPhpunit.sh │ │ │ ├── setup.sh │ │ │ ├── src │ │ │ ├── Controller │ │ │ │ └── .gitignore │ │ │ ├── Entity │ │ │ │ └── .gitignore │ │ │ ├── Kernel.php │ │ │ └── Repository │ │ │ │ └── .gitignore │ │ │ ├── symfony.lock │ │ │ └── tests │ │ │ ├── Unit │ │ │ └── ExampleTest.php │ │ │ └── bootstrap.php │ │ └── docker │ │ ├── .env_example │ │ ├── Dockerfile │ │ └── docker-compose.yml ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── codebase │ ├── .htaccess │ ├── index.php │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── bundles.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── framework.yaml │ │ │ └── routing.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── migrations │ │ ├── .gitignore │ │ └── Version20220612061501.php │ │ ├── phpunit.xml.dist │ │ ├── public │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runPhpunit.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ └── .gitignore │ │ ├── Entity │ │ │ ├── .gitignore │ │ │ └── Consumption.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Kernel.php │ │ ├── Repository │ │ │ ├── .gitignore │ │ │ └── ConsumptionRepository.php │ │ └── Service │ │ │ └── ConsumptionService.php │ │ ├── symfony.lock │ │ └── tests │ │ ├── Integration │ │ └── Service │ │ │ └── ConsumptionTest.php │ │ ├── Unit │ │ ├── CalculationTest.php │ │ └── ExampleTest.php │ │ └── bootstrap.php │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ └── docker-compose.yml ├── Chapter 6 ├── base.zip ├── base │ ├── demoSetup.sh │ └── phptdd │ │ ├── codebase │ │ ├── .htaccess │ │ ├── index.php │ │ └── symfony │ │ │ ├── .env │ │ │ ├── .env.test │ │ │ ├── .gitignore │ │ │ ├── bin │ │ │ ├── console │ │ │ └── phpunit │ │ │ ├── composer.json │ │ │ ├── config │ │ │ ├── bundles.php │ │ │ ├── packages │ │ │ │ ├── cache.yaml │ │ │ │ ├── doctrine.yaml │ │ │ │ ├── doctrine_migrations.yaml │ │ │ │ ├── framework.yaml │ │ │ │ └── routing.yaml │ │ │ ├── preload.php │ │ │ ├── routes.yaml │ │ │ ├── routes │ │ │ │ └── framework.yaml │ │ │ └── services.yaml │ │ │ ├── migrations │ │ │ ├── .gitignore │ │ │ └── Version20220612061501.php │ │ │ ├── phpunit.xml.dist │ │ │ ├── public │ │ │ └── index.php │ │ │ ├── runCoverage.sh │ │ │ ├── runDebug.sh │ │ │ ├── runPhpunit.sh │ │ │ ├── setup.sh │ │ │ ├── src │ │ │ ├── Controller │ │ │ │ └── .gitignore │ │ │ ├── Entity │ │ │ │ ├── .gitignore │ │ │ │ └── Consumption.php │ │ │ ├── Example │ │ │ │ └── Calculator.php │ │ │ ├── Kernel.php │ │ │ ├── Repository │ │ │ │ ├── .gitignore │ │ │ │ └── ConsumptionRepository.php │ │ │ └── Service │ │ │ │ └── ConsumptionService.php │ │ │ ├── symfony.lock │ │ │ └── tests │ │ │ ├── Integration │ │ │ └── Service │ │ │ │ └── ConsumptionTest.php │ │ │ ├── Unit │ │ │ ├── CalculationTest.php │ │ │ └── ExampleTest.php │ │ │ └── bootstrap.php │ │ └── docker │ │ ├── .env_example │ │ ├── Dockerfile │ │ ├── config │ │ └── custom.ini │ │ └── docker-compose.yml ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ ├── php.xml │ └── phptdd.iml │ ├── codebase │ ├── .htaccess │ ├── behat │ │ ├── behat.yml │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── features │ │ │ ├── bootstrap │ │ │ │ ├── FeatureContext.php │ │ │ │ └── HomeContext.php │ │ │ └── home.feature │ │ ├── runBehat.sh │ │ └── vendor │ │ │ ├── autoload.php │ │ │ ├── bin │ │ │ ├── behat │ │ │ └── yaml-lint │ │ │ └── composer │ │ │ ├── ClassLoader.php │ │ │ ├── InstalledVersions.php │ │ │ ├── LICENSE │ │ │ ├── autoload_classmap.php │ │ │ ├── autoload_files.php │ │ │ ├── autoload_namespaces.php │ │ │ ├── autoload_psr4.php │ │ │ ├── autoload_real.php │ │ │ ├── autoload_static.php │ │ │ ├── installed.json │ │ │ ├── installed.php │ │ │ └── platform_check.php │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── bundles.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── framework.yaml │ │ │ └── routing.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── feature │ │ └── homepage.feature │ │ ├── features │ │ └── bootstrap │ │ │ └── FeatureContext.php │ │ ├── migrations │ │ ├── .gitignore │ │ └── Version20220612061501.php │ │ ├── phpunit.xml.dist │ │ ├── public │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runPhpunit.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ └── .gitignore │ │ ├── Entity │ │ │ ├── .gitignore │ │ │ └── Consumption.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Kernel.php │ │ ├── Repository │ │ │ ├── .gitignore │ │ │ └── ConsumptionRepository.php │ │ └── Service │ │ │ └── ConsumptionService.php │ │ ├── symfony.lock │ │ └── tests │ │ ├── Integration │ │ └── Service │ │ │ └── ConsumptionTest.php │ │ ├── Unit │ │ └── CalculationTest.php │ │ └── bootstrap.php │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ └── docker-compose.yml ├── Chapter 7 ├── base.zip ├── base │ ├── demoSetup.sh │ └── phptdd │ │ ├── codebase │ │ ├── .htaccess │ │ ├── behat │ │ │ ├── behat.yml │ │ │ ├── composer.json │ │ │ ├── features │ │ │ │ ├── bootstrap │ │ │ │ │ ├── FeatureContext.php │ │ │ │ │ └── HomeContext.php │ │ │ │ └── home.feature │ │ │ ├── runBehat.sh │ │ │ └── setup.sh │ │ └── symfony │ │ │ ├── .env │ │ │ ├── .env.test │ │ │ ├── .gitignore │ │ │ ├── bin │ │ │ ├── console │ │ │ └── phpunit │ │ │ ├── composer.json │ │ │ ├── config │ │ │ ├── bundles.php │ │ │ ├── packages │ │ │ │ ├── cache.yaml │ │ │ │ ├── doctrine.yaml │ │ │ │ ├── doctrine_migrations.yaml │ │ │ │ ├── framework.yaml │ │ │ │ └── routing.yaml │ │ │ ├── preload.php │ │ │ ├── routes.yaml │ │ │ ├── routes │ │ │ │ └── framework.yaml │ │ │ └── services.yaml │ │ │ ├── feature │ │ │ └── homepage.feature │ │ │ ├── features │ │ │ └── bootstrap │ │ │ │ └── FeatureContext.php │ │ │ ├── migrations │ │ │ ├── .gitignore │ │ │ └── Version20220612061501.php │ │ │ ├── phpunit.xml.dist │ │ │ ├── public │ │ │ └── index.php │ │ │ ├── runCoverage.sh │ │ │ ├── runDebug.sh │ │ │ ├── runPhpunit.sh │ │ │ ├── setup.sh │ │ │ ├── src │ │ │ ├── Controller │ │ │ │ └── .gitignore │ │ │ ├── Entity │ │ │ │ ├── .gitignore │ │ │ │ └── Consumption.php │ │ │ ├── Example │ │ │ │ └── Calculator.php │ │ │ ├── Kernel.php │ │ │ ├── Repository │ │ │ │ ├── .gitignore │ │ │ │ └── ConsumptionRepository.php │ │ │ └── Service │ │ │ │ └── ConsumptionService.php │ │ │ ├── symfony.lock │ │ │ └── tests │ │ │ ├── Integration │ │ │ └── Service │ │ │ │ └── ConsumptionTest.php │ │ │ ├── Unit │ │ │ └── CalculationTest.php │ │ │ └── bootstrap.php │ │ └── docker │ │ ├── .env_example │ │ ├── Dockerfile │ │ ├── config │ │ └── custom.ini │ │ └── docker-compose.yml ├── complete.zip └── complete │ ├── .idea │ ├── .gitignore │ ├── complete.iml │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ ├── php.xml │ └── vcs.xml │ ├── demoSetup.sh │ └── phptdd │ ├── .htaccess │ ├── codebase │ ├── .htaccess │ ├── behat │ │ ├── .gitignore │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── behat.iml │ │ │ ├── inspectionProfiles │ │ │ │ └── profiles_settings.xml │ │ │ ├── modules.xml │ │ │ ├── php-test-framework.xml │ │ │ ├── php.xml │ │ │ └── vcs.xml │ │ ├── behat.yml │ │ ├── composer.json │ │ ├── features │ │ │ ├── bootstrap │ │ │ │ ├── FeatureContext.php │ │ │ │ ├── HomeContext.php │ │ │ │ └── InventoryClerkRegistrationContext.php │ │ │ ├── home.feature │ │ │ └── inventory_clerk_registration.feature │ │ ├── runBehat.sh │ │ └── setup.sh │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── config │ │ ├── bundles.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── framework.yaml │ │ │ ├── routing.yaml │ │ │ ├── security.yaml │ │ │ ├── twig.yaml │ │ │ └── validator.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── feature │ │ └── homepage.feature │ │ ├── features │ │ └── bootstrap │ │ │ └── FeatureContext.php │ │ ├── migrations │ │ └── Version20220904012302.php │ │ ├── phpunit.xml.dist │ │ ├── public │ │ ├── .htaccess │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runPhpunit.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ ├── HomeController.php │ │ │ └── RegistrationController.php │ │ ├── Entity │ │ │ └── User.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Form │ │ │ └── RegistrationFormType.php │ │ ├── Kernel.php │ │ ├── Repository │ │ │ └── UserRepository.php │ │ └── Service │ │ │ └── ConsumptionService.php │ │ ├── symfony.lock │ │ ├── templates │ │ ├── base.html.twig │ │ ├── home │ │ │ └── index.html.twig │ │ └── registration │ │ │ └── register.html.twig │ │ └── tests │ │ ├── Functional │ │ └── Controller │ │ │ ├── HomeControllerTest.php │ │ │ └── RegistrationControllerTest.php │ │ ├── Unit │ │ └── CalculationTest.php │ │ └── bootstrap.php │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ └── docker-compose.yml ├── Chapter 8 ├── base.zip ├── base │ ├── .idea │ │ ├── .gitignore │ │ ├── base.iml │ │ ├── inspectionProfiles │ │ │ └── profiles_settings.xml │ │ ├── modules.xml │ │ ├── php.xml │ │ └── vcs.xml │ ├── demoSetup.sh │ └── phptdd │ │ ├── .htaccess │ │ ├── codebase │ │ ├── .htaccess │ │ ├── behat │ │ │ ├── .gitignore │ │ │ ├── .idea │ │ │ │ ├── .gitignore │ │ │ │ ├── behat.iml │ │ │ │ ├── inspectionProfiles │ │ │ │ │ └── profiles_settings.xml │ │ │ │ ├── modules.xml │ │ │ │ ├── php-test-framework.xml │ │ │ │ ├── php.xml │ │ │ │ └── vcs.xml │ │ │ ├── behat.yml │ │ │ ├── composer.json │ │ │ ├── features │ │ │ │ ├── bootstrap │ │ │ │ │ ├── FeatureContext.php │ │ │ │ │ ├── HomeContext.php │ │ │ │ │ └── InventoryClerkRegistrationContext.php │ │ │ │ ├── home.feature │ │ │ │ └── inventory_clerk_registration.feature │ │ │ ├── runBehat.sh │ │ │ └── setup.sh │ │ └── symfony │ │ │ ├── .env │ │ │ ├── .env.test │ │ │ ├── .gitignore │ │ │ ├── bin │ │ │ ├── console │ │ │ └── phpunit │ │ │ ├── composer.json │ │ │ ├── config │ │ │ ├── bundles.php │ │ │ ├── packages │ │ │ │ ├── cache.yaml │ │ │ │ ├── doctrine.yaml │ │ │ │ ├── doctrine_migrations.yaml │ │ │ │ ├── framework.yaml │ │ │ │ ├── routing.yaml │ │ │ │ ├── security.yaml │ │ │ │ ├── twig.yaml │ │ │ │ └── validator.yaml │ │ │ ├── preload.php │ │ │ ├── routes.yaml │ │ │ ├── routes │ │ │ │ └── framework.yaml │ │ │ └── services.yaml │ │ │ ├── feature │ │ │ └── homepage.feature │ │ │ ├── features │ │ │ └── bootstrap │ │ │ │ └── FeatureContext.php │ │ │ ├── migrations │ │ │ └── Version20220904012302.php │ │ │ ├── phpunit.xml │ │ │ ├── phpunit.xml.dist │ │ │ ├── public │ │ │ ├── .htaccess │ │ │ └── index.php │ │ │ ├── runCoverage.sh │ │ │ ├── runDebug.sh │ │ │ ├── runPhpunit.sh │ │ │ ├── setup.sh │ │ │ ├── src │ │ │ ├── Controller │ │ │ │ ├── HomeController.php │ │ │ │ └── RegistrationController.php │ │ │ ├── Entity │ │ │ │ └── User.php │ │ │ ├── Example │ │ │ │ └── Calculator.php │ │ │ ├── Form │ │ │ │ └── RegistrationFormType.php │ │ │ ├── Kernel.php │ │ │ ├── Repository │ │ │ │ └── UserRepository.php │ │ │ └── Service │ │ │ │ └── ConsumptionService.php │ │ │ ├── symfony.lock │ │ │ ├── templates │ │ │ ├── base.html.twig │ │ │ ├── home │ │ │ │ └── index.html.twig │ │ │ └── registration │ │ │ │ └── register.html.twig │ │ │ └── tests │ │ │ ├── Functional │ │ │ └── Controller │ │ │ │ ├── HomeControllerTest.php │ │ │ │ └── RegistrationControllerTest.php │ │ │ ├── Unit │ │ │ └── CalculationTest.php │ │ │ └── bootstrap.php │ │ └── docker │ │ ├── .env_example │ │ ├── Dockerfile │ │ ├── config │ │ └── custom.ini │ │ └── docker-compose.yml ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── .htaccess │ ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ ├── php.xml │ ├── phptdd.iml │ └── vcs.xml │ ├── codebase │ ├── .htaccess │ ├── behat │ │ ├── .gitignore │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── behat.iml │ │ │ ├── inspectionProfiles │ │ │ │ └── profiles_settings.xml │ │ │ ├── modules.xml │ │ │ ├── php-test-framework.xml │ │ │ ├── php.xml │ │ │ └── vcs.xml │ │ ├── behat.yml │ │ ├── composer.json │ │ ├── features │ │ │ ├── bootstrap │ │ │ │ ├── CreateToyCarRecordContext.php │ │ │ │ ├── FeatureContext.php │ │ │ │ ├── HomeContext.php │ │ │ │ ├── InventoryClerkRegistrationContext.php │ │ │ │ └── inventory_clerk_login.feature │ │ │ ├── create_toy_car_record.feature │ │ │ ├── home.feature │ │ │ └── inventory_clerk_registration.feature │ │ ├── runBehat.sh │ │ └── setup.sh │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── bundles.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── framework.yaml │ │ │ ├── routing.yaml │ │ │ ├── security.yaml │ │ │ ├── twig.yaml │ │ │ └── validator.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── feature │ │ └── homepage.feature │ │ ├── features │ │ └── bootstrap │ │ │ └── FeatureContext.php │ │ ├── migrations │ │ └── Version20220904012302.php │ │ ├── phpunit.xml │ │ ├── phpunit.xml.dist │ │ ├── public │ │ ├── .htaccess │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runPhpunit.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ ├── HomeController.php │ │ │ └── RegistrationController.php │ │ ├── DAL │ │ │ └── Writer │ │ │ │ └── WriterInterface.php │ │ ├── Entity │ │ │ └── User.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Form │ │ │ └── RegistrationFormType.php │ │ ├── Kernel.php │ │ ├── Model │ │ │ ├── CarManufacturer.php │ │ │ ├── ToyCar.php │ │ │ ├── ToyColor.php │ │ │ └── ValidationModel.php │ │ ├── Processor │ │ │ └── ToyCarCreator.php │ │ ├── Repository │ │ │ └── UserRepository.php │ │ └── Validator │ │ │ ├── NameValidator.php │ │ │ ├── StringValidatorInterface.php │ │ │ ├── ToyCarTooOldException.php │ │ │ ├── ToyCarValidationException.php │ │ │ ├── ToyCarValidator.php │ │ │ ├── ToyCarValidatorInterface.php │ │ │ ├── ValidatorInterface.php │ │ │ └── YearValidator.php │ │ ├── symfony.lock │ │ ├── templates │ │ ├── base.html.twig │ │ ├── home │ │ │ └── index.html.twig │ │ └── registration │ │ │ └── register.html.twig │ │ └── tests │ │ ├── Functional │ │ └── Controller │ │ │ ├── HomeControllerTest.php │ │ │ ├── InventoryAdminControllerTest.php │ │ │ └── RegistrationControllerTest.php │ │ ├── Integration │ │ └── Processor │ │ │ └── ToyCarCreatorTest.php │ │ ├── Unit │ │ ├── CalculationTest.php │ │ └── Validator │ │ │ ├── NameValidatorTest.php │ │ │ ├── ToyCarValidatorTest.php │ │ │ └── YearValidatorTest.php │ │ └── bootstrap.php │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ └── docker-compose.yml ├── Chapter 9 ├── complete.zip └── complete │ ├── demoSetup.sh │ └── phptdd │ ├── bitbucket-pipelines.yml │ ├── codebase │ ├── .htaccess │ ├── .idea │ │ ├── .gitignore │ │ ├── codebase.iml │ │ ├── inspectionProfiles │ │ │ └── profiles_settings.xml │ │ ├── modules.xml │ │ ├── php-test-framework.xml │ │ ├── php.xml │ │ └── vcs.xml │ ├── behat │ │ ├── .gitignore │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── behat.iml │ │ │ ├── inspectionProfiles │ │ │ │ └── profiles_settings.xml │ │ │ ├── modules.xml │ │ │ ├── php-test-framework.xml │ │ │ ├── php.xml │ │ │ └── vcs.xml │ │ ├── behat.yml │ │ ├── composer.json │ │ ├── features │ │ │ ├── bootstrap │ │ │ │ ├── CreateToyCarRecordContext.php │ │ │ │ ├── FeatureContext.php │ │ │ │ ├── HomeContext.php │ │ │ │ ├── InventoryClerkLoginContext.php │ │ │ │ └── InventoryClerkRegistrationContext.php │ │ │ ├── default │ │ │ │ └── home.feature │ │ │ ├── suite_a │ │ │ │ └── inventory_clerk_registration.feature │ │ │ ├── suite_b │ │ │ │ └── inventory_clerk_login.feature │ │ │ ├── suite_c │ │ │ │ └── create_toy_car_record.feature │ │ │ └── suite_d │ │ │ │ └── view_toy_car_table.feature │ │ ├── runBehatTests.sh │ │ ├── runDebugBehat.sh │ │ └── setup.sh │ └── symfony │ │ ├── .env │ │ ├── .env.test │ │ ├── .gitignore │ │ ├── bin │ │ ├── console │ │ └── phpunit │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── bundles.php │ │ ├── config_test.php │ │ ├── packages │ │ │ ├── cache.yaml │ │ │ ├── doctrine.yaml │ │ │ ├── doctrine_migrations.yaml │ │ │ ├── eloquent.yaml │ │ │ ├── framework.yaml │ │ │ ├── routing.yaml │ │ │ ├── security.yaml │ │ │ ├── translation.yaml │ │ │ ├── twig.yaml │ │ │ └── validator.yaml │ │ ├── preload.php │ │ ├── routes.yaml │ │ ├── routes │ │ │ └── framework.yaml │ │ └── services.yaml │ │ ├── feature │ │ └── homepage.feature │ │ ├── features │ │ └── bootstrap │ │ │ └── FeatureContext.php │ │ ├── migrations │ │ └── Version20221009235830.php │ │ ├── phpunit.xml │ │ ├── phpunit.xml.dist │ │ ├── public │ │ ├── .htaccess │ │ └── index.php │ │ ├── runCoverage.sh │ │ ├── runDebug.sh │ │ ├── runTests.sh │ │ ├── setup.sh │ │ ├── src │ │ ├── Controller │ │ │ ├── ClerkController.php │ │ │ ├── HomeController.php │ │ │ ├── LoginController.php │ │ │ ├── RegistrationController.php │ │ │ └── TableController.php │ │ ├── DAL │ │ │ ├── Reader │ │ │ │ ├── Doctrine │ │ │ │ │ ├── ColorReader.php │ │ │ │ │ ├── ManufacturerReader.php │ │ │ │ │ ├── ReaderBase.php │ │ │ │ │ └── ToyCarReader.php │ │ │ │ └── ReaderInterface.php │ │ │ └── Writer │ │ │ │ ├── Doctrine │ │ │ │ └── ToyCarWriter.php │ │ │ │ ├── WriterException.php │ │ │ │ └── WriterInterface.php │ │ ├── DataFixtures │ │ │ └── AppFixtures.php │ │ ├── Entity │ │ │ ├── Color.php │ │ │ ├── Manufacturer.php │ │ │ ├── ToyCar.php │ │ │ └── User.php │ │ ├── Example │ │ │ └── Calculator.php │ │ ├── Factory │ │ │ └── ToyCarValidatorFactory.php │ │ ├── Form │ │ │ └── RegistrationFormType.php │ │ ├── Kernel.php │ │ ├── Model │ │ │ ├── .gitignore │ │ │ ├── CarManufacturer.php │ │ │ ├── ModelInterface.php │ │ │ ├── ToyCar.php │ │ │ ├── ToyColor.php │ │ │ └── ValidationModel.php │ │ ├── Processor │ │ │ └── ToyCarCreator.php │ │ ├── Repository │ │ │ ├── ColorRepository.php │ │ │ ├── ManufacturerRepository.php │ │ │ ├── ToyCarRepository.php │ │ │ └── UserRepository.php │ │ └── Validator │ │ │ ├── NameValidator.php │ │ │ ├── StringValidatorInterface.php │ │ │ ├── ToyCarTooOldException.php │ │ │ ├── ToyCarValidationException.php │ │ │ ├── ToyCarValidator.php │ │ │ ├── ToyCarValidatorInterface.php │ │ │ ├── ValidatorInterface.php │ │ │ └── YearValidator.php │ │ ├── symfony.lock │ │ ├── templates │ │ ├── base.html.twig │ │ ├── clerk │ │ │ └── index.html.twig │ │ ├── home │ │ │ └── index.html.twig │ │ ├── login │ │ │ └── index.html.twig │ │ ├── registration │ │ │ └── register.html.twig │ │ └── table │ │ │ └── index.html.twig │ │ ├── tests │ │ ├── Functional │ │ │ └── Controller │ │ │ │ ├── ClerkControllerTest.php │ │ │ │ ├── HomeControllerTest.php │ │ │ │ ├── LoginControllerTest.php │ │ │ │ ├── RegistrationControllerTest.php │ │ │ │ └── TableControllerTest.php │ │ ├── Integration │ │ │ ├── DAL │ │ │ │ ├── Reader │ │ │ │ │ ├── ColorReaderTest.php │ │ │ │ │ ├── DataReaderTestBase.php │ │ │ │ │ ├── ManufacturerReaderTest.php │ │ │ │ │ └── ToyCarReaderTest.php │ │ │ │ └── Writer │ │ │ │ │ └── DoctrineToyCarWriterTest.php │ │ │ ├── Factory │ │ │ │ └── ToyCarValidatorFactoryTest.php │ │ │ └── Processor │ │ │ │ └── ToyCarCreatorTest.php │ │ ├── Unit │ │ │ ├── CalculationTest.php │ │ │ └── Validator │ │ │ │ ├── NameValidatorTest.php │ │ │ │ ├── ToyCarValidatorTest.php │ │ │ │ └── YearValidatorTest.php │ │ └── bootstrap.php │ │ └── translations │ │ └── .gitignore │ └── docker │ ├── .env_example │ ├── Dockerfile │ ├── config │ └── custom.ini │ └── docker-compose.yml ├── LICENSE └── README.md /Chapter 10/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 10/complete.zip -------------------------------------------------------------------------------- /Chapter 10/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/appspec.yml: -------------------------------------------------------------------------------- 1 | version: 0.0 2 | os: linux 3 | files: 4 | - source: / 5 | destination: /home/ec2-user/phptdd 6 | hooks: 7 | AfterInstall: 8 | - location: aws/codedeploy/containers_setup_php.sh 9 | timeout: 3600 10 | runas: ec2-user -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | paths: [ '%paths.base%/features/default' ] 5 | contexts: 6 | - HomeContext 7 | suite_a: 8 | paths: [ '%paths.base%/features/suite_a' ] 9 | contexts: 10 | - InventoryClerkRegistrationContext 11 | suite_b: 12 | paths: [ '%paths.base%/features/suite_b' ] 13 | contexts: 14 | - InventoryClerkLoginContext 15 | suite_c: 16 | paths: [ '%paths.base%/features/suite_c' ] 17 | contexts: 18 | - CreateToyCarRecordContext -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/behat/features/bootstrap/FeatureContext.php: -------------------------------------------------------------------------------- 1 | symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | .phpunit.result.cache 13 | ###< phpunit/phpunit ### 14 | 15 | ###> symfony/phpunit-bridge ### 16 | .phpunit.result.cache 17 | ###< symfony/phpunit-bridge ### 18 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | loadFromExtension('doctrine', array( 4 | 'dbal' => array( 5 | 'host' => 'localhost', 6 | 'dbname' => 'cars_test', 7 | 'user' => 'root', 8 | 'password' => 'mypassword', 9 | ), 10 | )); -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/eloquent.yaml: -------------------------------------------------------------------------------- 1 | wouterj_eloquent: 2 | driver: '%env(DB_CONNECTION)%' 3 | host: '%env(DB_HOST)%' 4 | port: '%env(DB_PORT)%' 5 | database: '%env(DB_DATABASE)%' 6 | username: '%env(DB_USERNAME)%' 7 | password: '%env(DB_PASSWORD)%' 8 | # Uncomment the following line to enable the Eloquent ORM 9 | #eloquent: null 10 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/translation.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | default_locale: en 3 | translator: 4 | default_path: '%kernel.project_dir%/translations' 5 | fallbacks: 6 | - en 7 | # providers: 8 | # crowdin: 9 | # dsn: '%env(CROWDIN_DSN)%' 10 | # loco: 11 | # dsn: '%env(LOCO_DSN)%' 12 | # lokalise: 13 | # dsn: '%env(LOKALISE_DSN)%' 14 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | form_themes: ['bootstrap_5_horizontal_layout.html.twig'] 4 | 5 | when@test: 6 | twig: 7 | strict_variables: true 8 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/packages/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | email_validation_mode: html5 4 | 5 | # Enables validator auto-mapping support. 6 | # For instance, basic validation constraints will be inferred from Doctrine's metadata. 7 | #auto_mapping: 8 | # App\Entity\: [] 9 | 10 | when@test: 11 | framework: 12 | validation: 13 | not_compromised_password: false 14 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | render('home/index.html.twig', [ 16 | 'controller_name' => 'HomeController', 17 | ]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/src/DAL/Reader/ReaderInterface.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 |

Clerk - Add Toy Car

8 | 9 | {{ form_start(clerk_form) }} 10 | {{ form_row(clerk_form.name) }} 11 | {{ form_row(clerk_form.year, { 12 | label: 'Year' 13 | }) }} 14 | 15 | {{ form_end(clerk_form) }} 16 | 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/templates/registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Register{% endblock %} 4 | 5 | {% block body %} 6 |
7 |

Register

8 | 9 | {{ form_start(registrationForm) }} 10 | {{ form_row(registrationForm.email) }} 11 | {{ form_row(registrationForm.plainPassword, { 12 | label: 'Password' 13 | }) }} 14 | {{ form_row(registrationForm.agreeTerms) }} 15 | 16 | 17 | {{ form_end(registrationForm) }} 18 |
19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Functional/Controller/ClerkControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/clerk'); 13 | $this->assertResponseRedirects(); 14 | } 15 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Functional/Controller/HomeControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/'); 13 | $this->assertResponseIsSuccessful(); 14 | $this->assertSelectorTextContains('h1', 'HomeController'); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Functional/Controller/LoginControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/login'); 13 | $this->assertResponseIsSuccessful(); 14 | } 15 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Functional/Controller/RegistrationControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/register'); 13 | 14 | $this->assertResponseIsSuccessful(); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Functional/Controller/TableControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/table'); 13 | $html = $crawler->html(); 14 | $url = $crawler->getBaseHref(); 15 | $this->assertResponseIsSuccessful(); 16 | } 17 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/Integration/Factory/ToyCarValidatorFactoryTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf(ToyCarValidator::class, $factory->build()); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/codebase/symfony/translations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 10/complete/phptdd/codebase/symfony/translations/.gitignore -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 10/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 10/complete/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 3/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 3/complete.zip -------------------------------------------------------------------------------- /Chapter 3/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/.idea/php8docker.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/codebase/index.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 10 | 11 | echo "MySQL: Connected successfully"; 12 | } catch(PDOException $e) { 13 | echo "Connection failed: " . $e->getMessage(); 14 | } 15 | 16 | // Show PHP info: 17 | phpinfo(); 18 | ?> -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 3/complete/phptdd/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1.3RC1-apache-buster 2 | RUN docker-php-ext-install mysqli pdo pdo_mysql 3 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 4 | -------------------------------------------------------------------------------- /Chapter 5/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 5/.idea/chapter5.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 5/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 5/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 5/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 5/base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 5/base.zip -------------------------------------------------------------------------------- /Chapter 5/base/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/.idea/phptdd.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/index.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 10 | 11 | echo "MySQL: Connected successfully"; 12 | } catch(PDOException $e) { 13 | echo "Connection failed: " . $e->getMessage(); 14 | } 15 | 16 | // Show PHP info: 17 | phpinfo(); 18 | ?> -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ###> symfony/framework-bundle ### 3 | /.env.local 4 | /.env.local.php 5 | /.env.*.local 6 | /config/secrets/prod/prod.decrypt.private.php 7 | /public/bundles/ 8 | /var/ 9 | /vendor/ 10 | ###< symfony/framework-bundle ### 11 | 12 | ###> phpunit/phpunit ### 13 | /phpunit.xml 14 | .phpunit.result.cache 15 | ###< phpunit/phpunit ### 16 | 17 | ###> symfony/phpunit-bridge ### 18 | .phpunit.result.cache 19 | /phpunit.xml 20 | ###< symfony/phpunit-bridge ### 21 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 8 | ]; 9 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: false 7 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | fail($myFailingMessage); 13 | } 14 | } -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 5/base/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 5/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 5/complete.zip -------------------------------------------------------------------------------- /Chapter 5/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/index.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 10 | 11 | echo "MySQL: Connected successfully"; 12 | } catch(PDOException $e) { 13 | echo "Connection failed: " . $e->getMessage(); 14 | } 15 | 16 | // Show PHP info: 17 | phpinfo(); 18 | ?> -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | DATABASE_URL="mysql://root:mypassword@server-mysql/coffee?serverVersion=8&charset=utf8mb4" -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ###> symfony/framework-bundle ### 3 | /.env.local 4 | /.env.local.php 5 | /.env.*.local 6 | /config/secrets/prod/prod.decrypt.private.php 7 | /public/bundles/ 8 | /var/ 9 | /vendor/ 10 | ###< symfony/framework-bundle ### 11 | 12 | ###> phpunit/phpunit ### 13 | /phpunit.xml 14 | .phpunit.result.cache 15 | ###< phpunit/phpunit ### 16 | 17 | ###> symfony/phpunit-bridge ### 18 | .phpunit.result.cache 19 | /phpunit.xml 20 | ###< symfony/phpunit-bridge ### 21 | -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 8 | ]; 9 | -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | fail($myFailingMessage); 13 | } 14 | } -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 5/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 5/complete/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 6/base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 6/base.zip -------------------------------------------------------------------------------- /Chapter 6/base/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/index.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 10 | 11 | echo "MySQL: Connected successfully"; 12 | } catch(PDOException $e) { 13 | echo "Connection failed: " . $e->getMessage(); 14 | } 15 | 16 | // Show PHP info: 17 | phpinfo(); 18 | ?> -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | DATABASE_URL="mysql://root:mypassword@server-mysql/coffee?serverVersion=8&charset=utf8mb4" -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ###> symfony/framework-bundle ### 3 | /.env.local 4 | /.env.local.php 5 | /.env.*.local 6 | /config/secrets/prod/prod.decrypt.private.php 7 | /public/bundles/ 8 | /var/ 9 | /vendor/ 10 | ###< symfony/framework-bundle ### 11 | 12 | ###> phpunit/phpunit ### 13 | /phpunit.xml 14 | .phpunit.result.cache 15 | ###< phpunit/phpunit ### 16 | 17 | ###> symfony/phpunit-bridge ### 18 | .phpunit.result.cache 19 | /phpunit.xml 20 | ###< symfony/phpunit-bridge ### 21 | -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 8 | ]; 9 | -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | fail($myFailingMessage); 13 | } 14 | } -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 6/base/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 6/base/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 6/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 6/complete.zip -------------------------------------------------------------------------------- /Chapter 6/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/.idea/phptdd.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext 6 | - HomeContext -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/behat/features/bootstrap/FeatureContext.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/instaclick/php-webdriver/lib'), 10 | 'Behat\\MinkExtension' => array($vendorDir . '/behat/mink-extension/src'), 11 | 'Behat\\Gherkin' => array($vendorDir . '/behat/gherkin/src'), 12 | ); 13 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | DATABASE_URL="mysql://root:mypassword@server-mysql/coffee?serverVersion=8&charset=utf8mb4" -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | ###> symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | /phpunit.xml 13 | .phpunit.result.cache 14 | ###< phpunit/phpunit ### 15 | 16 | ###> symfony/phpunit-bridge ### 17 | .phpunit.result.cache 18 | /phpunit.xml 19 | ###< symfony/phpunit-bridge ### 20 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 8 | ]; 9 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 6/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 6/complete/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 7/base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 7/base.zip -------------------------------------------------------------------------------- /Chapter 7/base/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext 6 | - HomeContext -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/behat/features/bootstrap/FeatureContext.php: -------------------------------------------------------------------------------- 1 | symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | /phpunit.xml 13 | .phpunit.result.cache 14 | ###< phpunit/phpunit ### 15 | 16 | ###> symfony/phpunit-bridge ### 17 | .phpunit.result.cache 18 | /phpunit.xml 19 | ###< symfony/phpunit-bridge ### 20 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 8 | ]; 9 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 7/base/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 7/base/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 7/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 7/complete.zip -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/complete.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 7/complete/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 7/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext 6 | - HomeContext 7 | suite_a: 8 | contexts: 9 | - InventoryClerkRegistrationContext -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/behat/features/bootstrap/FeatureContext.php: -------------------------------------------------------------------------------- 1 | symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | /phpunit.xml 13 | .phpunit.result.cache 14 | ###< phpunit/phpunit ### 15 | 16 | ###> symfony/phpunit-bridge ### 17 | .phpunit.result.cache 18 | /phpunit.xml 19 | ###< symfony/phpunit-bridge ### 20 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | render('home/index.html.twig', [ 15 | 'controller_name' => 'HomeController', 16 | ]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/src/Example/Calculator.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 | .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } 8 | .example-wrapper code { background: #F5F5F5; padding: 2px 6px; } 9 | 10 | 11 |
12 |

{{ controller_name }}

13 | 16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/templates/registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Register{% endblock %} 4 | 5 | {% block body %} 6 |

Register

7 | 8 | {{ form_start(registrationForm) }} 9 | {{ form_row(registrationForm.email) }} 10 | {{ form_row(registrationForm.plainPassword, { 11 | label: 'Password' 12 | }) }} 13 | {{ form_row(registrationForm.agreeTerms) }} 14 | 15 | 16 | {{ form_end(registrationForm) }} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/tests/Functional/Controller/HomeControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/'); 13 | 14 | $this->assertResponseIsSuccessful(); 15 | $this->assertSelectorTextContains('h1', 'Hello World'); 16 | } 17 | } -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/tests/Functional/Controller/RegistrationControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/register'); 13 | $html = $crawler->html(); 14 | $url = $crawler->getBaseHref(); 15 | 16 | $this->assertResponseIsSuccessful(); 17 | } 18 | } -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 7/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 7/complete/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 8/base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 8/base.zip -------------------------------------------------------------------------------- /Chapter 8/base/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 8/base/.idea/base.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/base/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 8/base/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/base/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 8/base/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 8/base/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext 6 | - HomeContext 7 | suite_a: 8 | contexts: 9 | - InventoryClerkRegistrationContext -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/behat/features/bootstrap/FeatureContext.php: -------------------------------------------------------------------------------- 1 | symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | .phpunit.result.cache 13 | ###< phpunit/phpunit ### 14 | 15 | ###> symfony/phpunit-bridge ### 16 | .phpunit.result.cache 17 | ###< symfony/phpunit-bridge ### 18 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | render('home/index.html.twig', [ 15 | 'controller_name' => 'HomeController', 16 | ]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/src/Example/Calculator.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 | .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } 8 | .example-wrapper code { background: #F5F5F5; padding: 2px 6px; } 9 | 10 | 11 |
12 |

{{ controller_name }}

13 | 16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/templates/registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Register{% endblock %} 4 | 5 | {% block body %} 6 |

Register

7 | 8 | {{ form_start(registrationForm) }} 9 | {{ form_row(registrationForm.email) }} 10 | {{ form_row(registrationForm.plainPassword, { 11 | label: 'Password' 12 | }) }} 13 | {{ form_row(registrationForm.agreeTerms) }} 14 | 15 | 16 | {{ form_end(registrationForm) }} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/tests/Functional/Controller/HomeControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/'); 13 | 14 | $this->assertResponseIsSuccessful(); 15 | $this->assertSelectorTextContains('h1', 'Hello World'); 16 | } 17 | } -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/tests/Functional/Controller/RegistrationControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/register'); 13 | $html = $crawler->html(); 14 | $url = $crawler->getBaseHref(); 15 | 16 | $this->assertResponseIsSuccessful(); 17 | } 18 | } -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 8/base/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 8/base/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 8/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 8/complete.zip -------------------------------------------------------------------------------- /Chapter 8/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/phptdd.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | contexts: 5 | - FeatureContext 6 | - HomeContext 7 | suite_a: 8 | contexts: 9 | - InventoryClerkRegistrationContext 10 | suite_create: 11 | contexts: 12 | - CreateToyCarRecordContext -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/features/create_toy_car_record.feature: -------------------------------------------------------------------------------- 1 | Feature: Clerk creates new toy car record 2 | In order to have a collection of toy car model records 3 | As an Inventory Clerk 4 | I need to be able to create a single record 5 | 6 | Scenario: Create new record 7 | Given I am in the inventory system page 8 | When I submit the form with correct details 9 | Then I should see a success message -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/features/home.feature: -------------------------------------------------------------------------------- 1 | Feature: Home page 2 | In order to welcome visitors 3 | As a visitor 4 | I need to be able to see the Symfony logo 5 | 6 | Scenario: See the Symfony logo 7 | Given I have access to the home page URL 8 | When I visit the home page 9 | Then I should see the Symfony Logo -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/runBehat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export XDEBUG_CONFIG="idekey=PHPSTORM" 3 | export PHP_IDE_CONFIG="serverName=behat" 4 | export XDEBUG_MODE="debug" 5 | 6 | XDEBUGOPT= 7 | if [ "x$NODEBUG" = "x" ]; then 8 | XDEBUGOPT="-d xdebug.start_with_request=yes" 9 | fi 10 | 11 | php $XDEBUGOPT vendor/bin/behat $@ 12 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/behat/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | composer install -d /var/www/html/behat/ -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | DATABASE_URL="mysql://root:mypassword@server-mysql/cars?serverVersion=8&charset=utf8mb4" -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | ###> symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | .phpunit.result.cache 13 | ###< phpunit/phpunit ### 14 | 15 | ###> symfony/phpunit-bridge ### 16 | .phpunit.result.cache 17 | ###< symfony/phpunit-bridge ### 18 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | render('home/index.html.twig', [ 15 | 'controller_name' => 'HomeController', 16 | ]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/src/DAL/Writer/WriterInterface.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 | .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } 8 | .example-wrapper code { background: #F5F5F5; padding: 2px 6px; } 9 | 10 | 11 |
12 |

{{ controller_name }}

13 | 16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/templates/registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Register{% endblock %} 4 | 5 | {% block body %} 6 |

Register

7 | 8 | {{ form_start(registrationForm) }} 9 | {{ form_row(registrationForm.email) }} 10 | {{ form_row(registrationForm.plainPassword, { 11 | label: 'Password' 12 | }) }} 13 | {{ form_row(registrationForm.agreeTerms) }} 14 | 15 | 16 | {{ form_end(registrationForm) }} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/tests/Functional/Controller/HomeControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/'); 13 | 14 | $this->assertResponseIsSuccessful(); 15 | $this->assertSelectorTextContains('h1', 'Hello World'); 16 | } 17 | } -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/tests/Functional/Controller/InventoryAdminControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/inventory-admin'); 13 | $this->assertResponseIsSuccessful(); 14 | } 15 | } -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/tests/Functional/Controller/RegistrationControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/register'); 13 | $html = $crawler->html(); 14 | $url = $crawler->getBaseHref(); 15 | 16 | $this->assertResponseIsSuccessful(); 17 | } 18 | } -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 8/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 8/complete/phptdd/docker/config/custom.ini -------------------------------------------------------------------------------- /Chapter 9/complete.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 9/complete.zip -------------------------------------------------------------------------------- /Chapter 9/complete/demoSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker "kill $(docker ps -q)" 3 | docker-compose -f ./phptdd/docker/docker-compose.yml build 4 | docker-compose -f ./phptdd/docker/docker-compose.yml up -d 5 | 6 | #List All Containers 7 | docker ps -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.htaccess: -------------------------------------------------------------------------------- 1 | DirectoryIndex symfony/public/index.php 2 | RewriteEngine On 3 | RewriteBase /symfony/ 4 | 5 | RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC] 6 | RewriteRule ^ %1 [L,NE,R=302] 7 | 8 | RewriteRule ^((?!public/).*)$ public/$1 [L,NC] -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | composer.lock -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.idea/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/behat.yml: -------------------------------------------------------------------------------- 1 | default: 2 | suites: 3 | default: 4 | paths: [ '%paths.base%/features/default' ] 5 | contexts: 6 | - HomeContext 7 | suite_a: 8 | paths: [ '%paths.base%/features/suite_a' ] 9 | contexts: 10 | - InventoryClerkRegistrationContext 11 | suite_b: 12 | paths: [ '%paths.base%/features/suite_b' ] 13 | contexts: 14 | - InventoryClerkLoginContext 15 | suite_c: 16 | paths: [ '%paths.base%/features/suite_c' ] 17 | contexts: 18 | - CreateToyCarRecordContext -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "behat/behat": "^3.11", 4 | "behat/mink-extension": "^2.3", 5 | "behat/mink-browserkit-driver": "^2.1", 6 | "behat/mink-selenium2-driver": "^1.6", 7 | "behat/mink-goutte-driver": "^2.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/features/default/home.feature: -------------------------------------------------------------------------------- 1 | Feature: Home page 2 | In order to welcome visitors 3 | As a visitor 4 | I need to be able to see the Symfony logo 5 | 6 | Scenario: See the Symfony logo 7 | Given I have access to the home page URL 8 | When I visit the home page 9 | Then I should see the HomeController text -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/features/suite_b/inventory_clerk_login.feature: -------------------------------------------------------------------------------- 1 | Feature: Inventory Clerk Login 2 | In order to access the inventory system 3 | As a registered user 4 | I need to be able to login 5 | 6 | Scenario: Login 7 | Given I am in the login "/login" path 8 | When I fill in Email "Email" with "clerk_email@phptdd.bdd" 9 | And I fill in Password "Password" with "password" 10 | And I click on the "login" button 11 | Then I should be able to access the clerk page -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/features/suite_c/create_toy_car_record.feature: -------------------------------------------------------------------------------- 1 | Feature: Clerk creates new toy car record 2 | In order to have a collection of toy car model records 3 | As an Inventory Clerk 4 | I need to be able to create a single record 5 | 6 | Scenario: Create new record 7 | Given I am in the inventory system page 8 | When I submit the form with correct details 9 | Then I should see the created record -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/features/suite_d/view_toy_car_table.feature: -------------------------------------------------------------------------------- 1 | Feature: User views toy car records 2 | In order to view stored toy car records 3 | Users should be able to 4 | View the toy car record data table 5 | 6 | Scenario: View the toy car table 7 | Given I am in the toy car table page 8 | When The page loads 9 | Then I should see the toy car table -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/runBehatTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export XDEBUG_CONFIG="idekey=PHPSTORM" 3 | export PHP_IDE_CONFIG="serverName=behat" 4 | export XDEBUG_MODE="off" 5 | 6 | XDEBUGOPT= 7 | if [ "x$NODEBUG" = "x" ]; then 8 | XDEBUGOPT="-d xdebug.start_with_request=yes" 9 | fi 10 | 11 | php $XDEBUGOPT /var/www/html/behat/vendor/bin/behat --config=/var/www/html/behat/behat.yml --colors $@ 12 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/runDebugBehat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export XDEBUG_CONFIG="idekey=PHPSTORM" 3 | export PHP_IDE_CONFIG="serverName=behat" 4 | export XDEBUG_MODE="debug" 5 | 6 | XDEBUGOPT= 7 | if [ "x$NODEBUG" = "x" ]; then 8 | XDEBUGOPT="-d xdebug.start_with_request=yes" 9 | fi 10 | 11 | php $XDEBUGOPT /var/www/html/behat/vendor/bin/behat $@ 12 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/behat/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | composer install -d /var/www/html/behat/ -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | PANTHER_APP_ENV=panther 6 | PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots 7 | DATABASE_URL="mysql://root:mypassword@server-mysql/cars?serverVersion=8&charset=utf8mb4" -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/.gitignore: -------------------------------------------------------------------------------- 1 | ###> symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /config/secrets/prod/prod.decrypt.private.php 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> phpunit/phpunit ### 12 | .phpunit.result.cache 13 | ###< phpunit/phpunit ### 14 | 15 | ###> symfony/phpunit-bridge ### 16 | .phpunit.result.cache 17 | ###< symfony/phpunit-bridge ### 18 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | loadFromExtension('doctrine', array( 4 | 'dbal' => array( 5 | 'host' => 'localhost', 6 | 'dbname' => 'cars_test', 7 | 'user' => 'root', 8 | 'password' => 'mypassword', 9 | ), 10 | )); -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | migrations_paths: 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations' 6 | enable_profiler: '%kernel.debug%' 7 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/eloquent.yaml: -------------------------------------------------------------------------------- 1 | wouterj_eloquent: 2 | driver: '%env(DB_CONNECTION)%' 3 | host: '%env(DB_HOST)%' 4 | port: '%env(DB_PORT)%' 5 | database: '%env(DB_DATABASE)%' 6 | username: '%env(DB_USERNAME)%' 7 | password: '%env(DB_PASSWORD)%' 8 | # Uncomment the following line to enable the Eloquent ORM 9 | #eloquent: null 10 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | utf8: true 4 | 5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. 6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands 7 | #default_uri: http://localhost 8 | 9 | when@prod: 10 | framework: 11 | router: 12 | strict_requirements: null 13 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/translation.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | default_locale: en 3 | translator: 4 | default_path: '%kernel.project_dir%/translations' 5 | fallbacks: 6 | - en 7 | # providers: 8 | # crowdin: 9 | # dsn: '%env(CROWDIN_DSN)%' 10 | # loco: 11 | # dsn: '%env(LOCO_DSN)%' 12 | # lokalise: 13 | # dsn: '%env(LOKALISE_DSN)%' 14 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | form_themes: ['bootstrap_5_horizontal_layout.html.twig'] 4 | 5 | when@test: 6 | twig: 7 | strict_variables: true 8 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/packages/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | email_validation_mode: html5 4 | 5 | # Enables validator auto-mapping support. 6 | # For instance, basic validation constraints will be inferred from Doctrine's metadata. 7 | #auto_mapping: 8 | # App\Entity\: [] 9 | 10 | when@test: 11 | framework: 12 | validation: 13 | not_compromised_password: false 14 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/config/preload.php: -------------------------------------------------------------------------------- 1 | render('home/index.html.twig', [ 16 | 'controller_name' => 'HomeController', 17 | ]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/src/DAL/Reader/ReaderInterface.php: -------------------------------------------------------------------------------- 1 | getDifference($a, $b); 20 | } 21 | 22 | private function getDifference(int $a, int $b): int 23 | { 24 | return $a - $b; 25 | } 26 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 |

Clerk - Add Toy Car

8 | 9 | {{ form_start(clerk_form) }} 10 | {{ form_row(clerk_form.name) }} 11 | {{ form_row(clerk_form.year, { 12 | label: 'Year' 13 | }) }} 14 | 15 | {{ form_end(clerk_form) }} 16 | 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/templates/registration/register.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Register{% endblock %} 4 | 5 | {% block body %} 6 |
7 |

Register

8 | 9 | {{ form_start(registrationForm) }} 10 | {{ form_row(registrationForm.email) }} 11 | {{ form_row(registrationForm.plainPassword, { 12 | label: 'Password' 13 | }) }} 14 | {{ form_row(registrationForm.agreeTerms) }} 15 | 16 | 17 | {{ form_end(registrationForm) }} 18 |
19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Functional/Controller/ClerkControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/clerk'); 13 | $this->assertResponseRedirects(); 14 | } 15 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Functional/Controller/HomeControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/'); 13 | $this->assertResponseIsSuccessful(); 14 | $this->assertSelectorTextContains('h1', 'HomeController'); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Functional/Controller/LoginControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/login'); 13 | $this->assertResponseIsSuccessful(); 14 | } 15 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Functional/Controller/RegistrationControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/register'); 13 | 14 | $this->assertResponseIsSuccessful(); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Functional/Controller/TableControllerTest.php: -------------------------------------------------------------------------------- 1 | request('GET', '/table'); 13 | $html = $crawler->html(); 14 | $url = $crawler->getBaseHref(); 15 | $this->assertResponseIsSuccessful(); 16 | } 17 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/Integration/Factory/ToyCarValidatorFactoryTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf(ToyCarValidator::class, $factory->build()); 15 | } 16 | } -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | bootEnv(dirname(__DIR__).'/.env'); 11 | } 12 | -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/codebase/symfony/translations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 9/complete/phptdd/codebase/symfony/translations/.gitignore -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/docker/.env_example: -------------------------------------------------------------------------------- 1 | APP_NAME=phptdd 2 | PORT_PHP_APP=8101 3 | PORT_PHP_MYADMIN=3333 4 | PORT_DB=3366 5 | 6 | MYSQL_ROOT_PASSWORD=secretpassword 7 | MYSQL_USER=app_user 8 | MYSQL_PASS=mypassword 9 | MYSQL_DB=mysql -------------------------------------------------------------------------------- /Chapter 9/complete/phptdd/docker/config/custom.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Test-Driven-Development-with-PHP-8/21ddc8252c6e3b6adbb4bb3c687db099abbbbd64/Chapter 9/complete/phptdd/docker/config/custom.ini --------------------------------------------------------------------------------