Skip to content

Commit 1c3aefb

Browse files
committed
Update test application to be compatible with Sylius 2.0
1 parent e33a3e2 commit 1c3aefb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+225
-358
lines changed

src/Resources/config/services.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<imports>
6-
<import resource="services/block_event_listener.xml"/>
76
<import resource="services/command.xml"/>
87
<import resource="services/constraint.xml"/>
98
<import resource="services/event_listener.xml"/>

src/Resources/config/services/block_event_listener.xml

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/Application/.env

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
2121
JWT_PASSPHRASE=acme_plugin_development
2222
###< lexik/jwt-authentication-bundle ###
2323

24-
###> symfony/swiftmailer-bundle ###
25-
# For Gmail as a transport, use: "gmail://username:password@localhost"
26-
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
27-
# Delivery is disabled by default via "null://localhost"
28-
MAILER_URL=smtp://localhost
29-
###< symfony/swiftmailer-bundle ###
24+
###> symfony/mailer ###
25+
MAILER_DSN=null://null
26+
###< symfony/mailer ###
27+
28+
###> symfony/messenger ###
29+
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=doctrine://default
30+
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default?queue_name=main_failed
31+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default?queue_name=catalog_promotion_removal
32+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default?queue_name=catalog_promotion_removal_failed
33+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=doctrine://default?queue_name=payment_request
34+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=doctrine://default?queue_name=payment_request_failed
35+
###< symfony/messenger ###
3036

3137
###> algolia/search-bundle ###
3238
ALGOLIA_APP_ID=

tests/Application/.env.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
APP_SECRET='ch4mb3r0f5ecr3ts'
22

33
KERNEL_CLASS='Tests\Setono\SyliusRedirectPlugin\Application\Kernel'
4+
5+
###> symfony/messenger ###
6+
# Sync transport turned for testing env for the ease of testing
7+
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync://
8+
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
9+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
10+
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
11+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=sync://
12+
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=sync://
13+
###< symfony/messenger ###

tests/Application/Kernel.php

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,10 @@
44

55
namespace Tests\Setono\SyliusRedirectPlugin\Application;
66

7-
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
87
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
9-
use Symfony\Component\Config\Loader\LoaderInterface;
10-
use Symfony\Component\Config\Resource\FileResource;
11-
use Symfony\Component\DependencyInjection\ContainerBuilder;
12-
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
138
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
14-
use Symfony\Component\Routing\RouteCollectionBuilder;
159

1610
final class Kernel extends BaseKernel
1711
{
1812
use MicroKernelTrait;
19-
20-
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
21-
22-
public function getCacheDir(): string
23-
{
24-
return $this->getProjectDir() . '/var/cache/' . $this->environment;
25-
}
26-
27-
public function getLogDir(): string
28-
{
29-
return $this->getProjectDir() . '/var/log';
30-
}
31-
32-
public function registerBundles(): iterable
33-
{
34-
foreach ($this->getConfigurationDirectories() as $confDir) {
35-
yield from $this->registerBundlesFromFile($confDir . '/bundles.php');
36-
}
37-
}
38-
39-
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
40-
{
41-
foreach ($this->getConfigurationDirectories() as $confDir) {
42-
$container->addResource(new FileResource($confDir . '/bundles.php'));
43-
}
44-
45-
$container->setParameter('container.dumper.inline_class_loader', true);
46-
47-
foreach ($this->getConfigurationDirectories() as $confDir) {
48-
$this->loadContainerConfiguration($loader, $confDir);
49-
}
50-
}
51-
52-
protected function configureRoutes(RouteCollectionBuilder $routes): void
53-
{
54-
foreach ($this->getConfigurationDirectories() as $confDir) {
55-
$this->loadRoutesConfiguration($routes, $confDir);
56-
}
57-
}
58-
59-
protected function getContainerBaseClass(): string
60-
{
61-
if ($this->isTestEnvironment()) {
62-
return MockerContainer::class;
63-
}
64-
65-
return parent::getContainerBaseClass();
66-
}
67-
68-
private function isTestEnvironment(): bool
69-
{
70-
return 0 === strpos($this->getEnvironment(), 'test');
71-
}
72-
73-
private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
74-
{
75-
$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
76-
$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
77-
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
78-
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
79-
}
80-
81-
private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir): void
82-
{
83-
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
84-
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
85-
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
86-
}
87-
88-
/**
89-
* @return BundleInterface[]
90-
*/
91-
private function registerBundlesFromFile(string $bundlesFile): iterable
92-
{
93-
$contents = require $bundlesFile;
94-
foreach ($contents as $class => $envs) {
95-
if (isset($envs['all']) || isset($envs[$this->environment])) {
96-
yield new $class();
97-
}
98-
}
99-
}
100-
101-
/**
102-
* @return string[]
103-
*/
104-
private function getConfigurationDirectories(): iterable
105-
{
106-
yield $this->getProjectDir() . '/config';
107-
}
10813
}

tests/Application/assets/admin/entry.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/Application/assets/admin/entrypoint.js

Whitespace-only changes.

tests/Application/assets/shop/entry.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../../../../assets/shop/entrypoint';

tests/Application/config/api_platform/.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)