mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 01:20:59 +00:00
[Symfony 6] Remove setting services for test as public
This commit is contained in:
parent
e95b96ff49
commit
a49d879e3d
6 changed files with 12 additions and 18 deletions
|
|
@ -20,12 +20,6 @@ final class Symfony6PrivateServicesPass implements CompilerPassInterface
|
|||
$this->makeServicePublic('security.csrf.token_manager', $container);
|
||||
$this->makeServicePublic('security.token_storage', $container);
|
||||
$this->makeServicePublic('validator', $container);
|
||||
|
||||
if (str_starts_with((string) $container->getParameter('kernel.environment'), 'test')) {
|
||||
$this->makeServicePublic('filesystem', $container);
|
||||
$this->makeServicePublic('session.factory', $container);
|
||||
$this->makeServicePublic('sylius.command_bus', $container);
|
||||
}
|
||||
}
|
||||
|
||||
private function makeServicePublic(string $serviceId, ContainerBuilder $container): void
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class OrdersTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -74,7 +74,7 @@ final class OrdersTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -99,7 +99,7 @@ final class OrdersTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -123,7 +123,7 @@ final class OrdersTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -162,7 +162,7 @@ final class OrdersTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue, 'en_US');
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -62,7 +62,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue, 'en_US');
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
@ -95,7 +95,7 @@ final class PaymentMethodsTest extends JsonApiTestCase
|
|||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue, 'en_US');
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ final class ShippingMethodsTest extends JsonApiTestCase
|
|||
private function getCartAndPutItemForCustomer(string $tokenValue, string $customer): void
|
||||
{
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue, 'en_US');
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ trait OrderPlacerTrait
|
|||
protected function placeOrder(string $tokenValue, string $email = 'sylius@example.com'): void
|
||||
{
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = $this->get('sylius.command_bus');
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue, 'en_US');
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ abstract class SessionAwareAjaxTest extends JsonApiTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$requestStack = self::$kernel->getContainer()->get('request_stack');
|
||||
$requestStack = self::getContainer()->get('request_stack');
|
||||
try {
|
||||
$requestStack->getSession();
|
||||
} catch (SessionNotFoundException) {
|
||||
$session = self::$kernel->getContainer()->get('session.factory')->createSession();
|
||||
$session = self::getContainer()->get('session.factory')->createSession();
|
||||
$request = new Request();
|
||||
$request->setSession($session);
|
||||
$requestStack->push($request);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue