mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[CS][DX] Refactor
This commit is contained in:
parent
99ea2ba572
commit
9bbc2b3341
2 changed files with 20 additions and 9 deletions
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility;
|
||||
|
|
@ -19,12 +28,13 @@ final class CancelOrderStateMachineCallbackPass implements CompilerPassInterface
|
|||
$smConfigs = $container->getParameter('sm.configs');
|
||||
|
||||
if (isset($smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'])) {
|
||||
trigger_error(
|
||||
sprintf('Callback "%s" was renamed to "%s". The old name will be removed in Sylius 2.0, use the new name to override it.',
|
||||
@trigger_error(
|
||||
sprintf(
|
||||
'Callback "%s" was renamed to "%s". The old name will be removed in Sylius 2.0, use the new name to override it.',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylis_cancel_order',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylius_cancel_order'
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylius_cancel_order',
|
||||
),
|
||||
\E_USER_DEPRECATED
|
||||
\E_USER_DEPRECATED,
|
||||
);
|
||||
|
||||
$smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order'] = $smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'];
|
||||
|
|
|
|||
|
|
@ -79,9 +79,10 @@ class CancelOrderStateMachineCallbackPassTest extends AbstractCompilerPassTestCa
|
|||
$this->setParameter('sm.configs', $this->smConfigs);
|
||||
|
||||
$this->expectDeprecation();
|
||||
$this->expectDeprecationMessage(sprintf('Callback "%s" was renamed to "%s". The old name will be removed in Sylius 2.0, use the new name to override it.',
|
||||
$this->expectDeprecationMessage(sprintf(
|
||||
'Callback "%s" was renamed to "%s". The old name will be removed in Sylius 2.0, use the new name to override it.',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylis_cancel_order',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylius_cancel_order'
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylius_cancel_order',
|
||||
));
|
||||
|
||||
$this->compile();
|
||||
|
|
@ -96,16 +97,16 @@ class CancelOrderStateMachineCallbackPassTest extends AbstractCompilerPassTestCa
|
|||
$smConfigs = $this->container->getParameter('sm.configs');
|
||||
$this->assertFalse(
|
||||
isset($smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order']),
|
||||
'State machine "sylius_order" should not have "sylis_cancel_order" callback configured.'
|
||||
'State machine "sylius_order" should not have "sylis_cancel_order" callback configured.',
|
||||
);
|
||||
$this->assertTrue(
|
||||
isset($smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order']),
|
||||
'State machine "sylius_order" should have "sylius_cancel_order" callback configured.'
|
||||
'State machine "sylius_order" should have "sylius_cancel_order" callback configured.',
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'],
|
||||
$smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order'],
|
||||
'State machine "sylius_order" should have the "sylis_cancel_order" callback moved to "sylius_cancel_order".'
|
||||
'State machine "sylius_order" should have the "sylis_cancel_order" callback moved to "sylius_cancel_order".',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue