Skip to content

Commit

Permalink
Refactor naming and paths
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaGallinari committed Nov 27, 2023
1 parent 1fac1e2 commit 1be3b32
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 43 deletions.
12 changes: 6 additions & 6 deletions src/Command/ServiceChangesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($class !== null && class_exists($class)) {
$decoratedServicesAssociation[$alias] = $class;
$this->outputVerbose(sprintf('Sylius service "%s" has been replaced with "%s"', $decoratedServiceId, $alias));
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' %s", $class));
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' strategy: %s", $class));

continue;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$decoratedServicesAssociation[$definitionClass] = $decoratedDefClass;
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->outputVerbose(sprintf('Sylius service "%s" has been replaced with "%s"', $alias, $definitionClass));
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' %s", $decoratedDefClass));
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' strategy: %s", $decoratedDefClass));
}

continue;
Expand All @@ -179,7 +179,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (class_exists($alias)) {
$decoratedServicesAssociation[$definitionClass] = $alias;
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->outputVerbose(sprintf("\tFound classpath by alias %s", $alias));
$this->outputVerbose(sprintf("\tFound classpath by 'alias' strategy: %s", $alias));
}

continue;
Expand All @@ -190,7 +190,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$class = $decoratedDefintion['definition']?->getClass();
if ($class !== null && class_exists($class)) {
$decoratedServicesAssociation[$definitionClass] = $class;
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' %s", $class));
$this->outputVerbose(sprintf("\tFound classpath by 'decorated definitions' strategy: %s", $class));

continue;
}
Expand All @@ -201,7 +201,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// $class = str_replace('Interface', '', $alias);
// if (class_exists($class)) {
// $decoratedServicesAssociation[$definitionClass] = $class;
// $this->outputVerbose(sprintf("\tFound classpath with 'Interface substitution' %s", $class));
// $this->outputVerbose(sprintf("\tFound classpath by 'Interface substitution' strategy: %s", $class));
//
// continue;
// }
Expand All @@ -215,7 +215,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$class = $decoratedDefintion['definition']?->getClass();
if ($class !== null && class_exists($class)) {
$decoratedServicesAssociation[$definitionClass] = $class;
$this->outputVerbose(sprintf("\tFound classpath with '.inner substitution' %s", $class));
$this->outputVerbose(sprintf("\tFound classpath by '.inner substitution' strategy: %s", $class));

continue;
}
Expand Down
42 changes: 21 additions & 21 deletions tests/Application/config/services_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,59 @@ services:

### ServiceChangesCommandTest ###

## test_it_detects_directly_decorated_services_that_changed
## test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed
# decorate via alias
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_directly_decorated_services_that_changed.decorate_new_shop_based:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed\DecorateNewShopBased
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed.decorate_new_shop_based:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed\DecorateNewShopBased
decorates: sylius.context.cart.new_shop_based

# decorate via class
# NOTE: This case does not exist in "sylius/sylius". It is only by interface or by alias.
# webgriffe_sylius_upgrade.service_changes_command.test_it_detects_directly_decorated_services_that_changed.decorate_minimum_price_distributor:
# class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed\DecorateMinimumPriceDistributor
# webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed.decorate_minimum_price_distributor:
# class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed\DecorateMinimumPriceDistributor
# decorates: Sylius\Component\Core\Distributor\MinimumPriceDistributor

# decorate via interface
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_directly_decorated_services_that_changed.decorate_order_email_manager:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed\DecorateOrderEmailManagerInterface
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed.decorate_order_email_manager:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed\DecorateOrderEmailManagerInterface
decorates: 'Sylius\Bundle\AdminBundle\EmailManager\OrderEmailManagerInterface'

# decorated BUT not changed
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
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed.decorate_customer_unique_address_adder:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_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:
## test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_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
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_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:
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_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
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_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
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed.decorate_customer_order_addresses_saver:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_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
## test_it_detects_with_alias_strategy_those_decorated_services_that_changed
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_alias_strategy_those_decorated_services_that_changed.decorate_send_order_confirmation:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_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
webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_alias_strategy_those_decorated_services_that_changed.decorate_send_shipment_confirmation_email_handler:
class: Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_decorated_services_that_changed\DecorateSendShipmentConfirmationEmailHandler
decorates: Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendShipmentConfirmationEmailHandler
16 changes: 8 additions & 8 deletions tests/Integration/Command/ServiceChangesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function tearDown(): void
}
}

public function test_it_detects_directly_decorated_services_that_changed(): void
public function test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed(): void
{
Git::$diffToReturn = file_get_contents(self::FIXTURE_DIR . $this->getName() . '/git.diff');

Expand All @@ -53,15 +53,15 @@ public function test_it_detects_directly_decorated_services_that_changed(): void
$output = $this->commandTester->getDisplay();
$expectedOutput = <<<TXT
Computing modified services between 1.11.0 and 1.12.0
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
Service "Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\\test_it_detects_with_inner_substitution_strategy_those_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_with_inner_substitution_strategy_those_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
public function test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed(): void
{
Git::$diffToReturn = file_get_contents(self::FIXTURE_DIR . $this->getName() . '/git.diff');

Expand All @@ -79,15 +79,15 @@ public function test_it_detects_with_decorated_definition_strategy_those_directl
$output = $this->commandTester->getDisplay();
$expectedOutput = <<<TXT
Computing modified services between 1.11.0 and 1.12.0
Service "webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed.decorate_province_naming_provider" must be checked because the service that it decorates "Sylius\Component\Addressing\Provider\ProvinceNamingProvider" has changed between given versions
Service "webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed.decorate_order_payment_processor" must be checked because the service that it decorates "Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor" has changed between given versions
Service "webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed.decorate_province_naming_provider" must be checked because the service that it decorates "Sylius\Component\Addressing\Provider\ProvinceNamingProvider" has changed between given versions
Service "webgriffe_sylius_upgrade.service_changes_command.test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed.decorate_order_payment_processor" must be checked because the service that it decorates "Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor" has changed between given versions
TXT;

self::assertEquals($expectedOutput, $output);
}

public function test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed(): void
public function test_it_detects_with_alias_strategy_those_decorated_services_that_changed(): void
{
Git::$diffToReturn = file_get_contents(self::FIXTURE_DIR . $this->getName() . '/git.diff');

Expand All @@ -105,7 +105,7 @@ public function test_it_detects_with_alias_strategy_those_directly_decorated_ser
$output = $this->commandTester->getDisplay();
$expectedOutput = <<<TXT
Computing modified services between 1.11.0 and 1.12.0
Service "Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\\test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed\DecorateSendOrderConfirmationHandler" must be checked because the service that it decorates "Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendOrderConfirmationHandler" has changed between given versions
Service "Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\\test_it_detects_with_alias_strategy_those_decorated_services_that_changed\DecorateSendOrderConfirmationHandler" must be checked because the service that it decorates "Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendOrderConfirmationHandler" has changed between given versions
TXT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_decorated_services_that_changed;

final class DecorateSendOrderConfirmationHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_alias_strategy_those_decorated_services_that_changed;

final class DecorateSendShipmentConfirmationEmailHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed;

use Sylius\Component\Core\Customer\OrderAddressesSaverInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed;

use Sylius\Component\Order\Processor\OrderProcessorInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_decorated_definition_strategy_those_decorated_services_that_changed;

use Sylius\Component\Addressing\Provider\ProvinceNamingProvider as BaseProvinceNamingProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed;

final class DecorateCustomerUniqueAddressAdder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_directly_decorated_services_that_changed;
namespace Tests\Webgriffe\SyliusUpgradePlugin\Stub\ServiceChangesCommand\test_it_detects_with_inner_substitution_strategy_those_decorated_services_that_changed;

final class DecorateNewShopBased
{
Expand Down
Loading

0 comments on commit 1be3b32

Please sign in to comment.