diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml index 9c2c7c0..be6d76e 100644 --- a/tests/Application/config/services_test.yaml +++ b/tests/Application/config/services_test.yaml @@ -41,3 +41,38 @@ services: webgriffe_sylius_upgrade.service_changes_command.test_it_detects_directly_decorated_services_that_changed.decorate_customer_unique_address_adder: class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed\DecorateCustomerUniqueAddressAdder decorates: sylius.customer_unique_address_adder + + + ## test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed + webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed.decorate_province_naming_provider: + public: true + class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed\DecorateProvinceNamingProvider + decorates: sylius.province_naming_provider + arguments: + - '@.inner' + + webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed.decorate_order_payment_processor: + public: true + class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed\DecorateOrderPaymentProcessor + decorates: sylius.order_processing.order_payment_processor.after_checkout + decoration_priority: 100 + arguments: + - '@.inner' + + # decorated BUT not changed + webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed.decorate_customer_order_addresses_saver: + class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed\DecorateCustomerOrderAddressesSaver + decorates: sylius.customer_order_addresses_saver + arguments: + - '@.inner' + + + ## test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed + webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed.decorate_send_order_confirmation: + class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed\DecorateSendOrderConfirmationHandler + decorates: Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendOrderConfirmationHandler + + # decorated BUT not changed + webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed.decorate_send_shipment_confirmation_email_handler: + class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed\DecorateSendShipmentConfirmationEmailHandler + decorates: Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendShipmentConfirmationEmailHandler diff --git a/tests/Integration/Command/ServiceChangesCommandTest.php b/tests/Integration/Command/ServiceChangesCommandTest.php index 9d47796..203972a 100644 --- a/tests/Integration/Command/ServiceChangesCommandTest.php +++ b/tests/Integration/Command/ServiceChangesCommandTest.php @@ -56,6 +56,57 @@ public function test_it_detects_directly_decorated_services_that_changed(): void Service "Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\\test_it_detects_directly_decorated_services_that_changed\DecorateOrderEmailManagerInterface" must be checked because the service that it decorates "Sylius\Bundle\AdminBundle\EmailManager\OrderEmailManager" has changed between given versions Service "Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\\test_it_detects_directly_decorated_services_that_changed\DecorateNewShopBased" must be checked because the service that it decorates "Sylius\Component\Core\Cart\Context\ShopBasedCartContext" has changed between given versions +TXT; + + self::assertEquals($expectedOutput, $output); + } + + public function test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed(): void + { + Git::$diffToReturn = file_get_contents(self::FIXTURE_DIR . $this->getName() . '/git.diff'); + + $result = $this->commandTester->execute( + [ + ServiceChangesCommand::FROM_VERSION_ARGUMENT_NAME => '1.11.0', + ServiceChangesCommand::TO_VERSION_ARGUMENT_NAME => '1.12.0', + '--' . ServiceChangesCommand::NAMESPACE_PREFIX_OPTION_NAME => 'Tests', + '--' . ServiceChangesCommand::ALIAS_PREFIX_OPTION_NAME => 'webgriffe_sylius_upgrade', + ], + ); + + self::assertEquals(0, $result); + + $output = $this->commandTester->getDisplay(); + $expectedOutput = <<getName() . '/git.diff'); + + $result = $this->commandTester->execute( + [ + ServiceChangesCommand::FROM_VERSION_ARGUMENT_NAME => '1.11.0', + ServiceChangesCommand::TO_VERSION_ARGUMENT_NAME => '1.12.0', + '--' . ServiceChangesCommand::NAMESPACE_PREFIX_OPTION_NAME => 'Tests', + '--' . ServiceChangesCommand::ALIAS_PREFIX_OPTION_NAME => 'webgriffe_sylius_upgrade', + ], + ); + + self::assertEquals(0, $result); + + $output = $this->commandTester->getDisplay(); + $expectedOutput = <<