Skip to content

Commit

Permalink
[All] fix split test
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoiriert committed Jun 28, 2024
1 parent f2e4d58 commit 54bf22d
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Draw\Component\Application\Tests\DependencyInjection;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use Draw\Component\Application\Configuration\DoctrineConfigurationRegistry;
use Draw\Component\Application\Configuration\Entity\Config;
use Draw\Component\Application\DependencyInjection\ConfigurationIntegration;
Expand Down Expand Up @@ -49,7 +48,7 @@ public function testPrependNoDoctrineExtension(): void
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new DoctrineExtension());
$containerBuilder->registerExtension($this->mockExtension('doctrine'));

$this->integration->prepend(
$containerBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Draw\Component\Application\Tests\DependencyInjection;

use Draw\Bundle\FrameworkExtraBundle\DependencyInjection\DrawFrameworkExtraExtension;
use Draw\Component\Application\DependencyInjection\SystemMonitoringIntegration;
use Draw\Component\Application\SystemMonitoring\Action\PingAction;
use Draw\Component\Application\SystemMonitoring\Bridge\Doctrine\DBALConnectionStatusProvider;
Expand Down Expand Up @@ -45,7 +44,7 @@ public function getDefaultConfiguration(): array
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new DrawFrameworkExtraExtension());
$containerBuilder->registerExtension($this->mockExtension('draw_framework_extra'));

$this->integration->prepend(
$containerBuilder,
Expand Down
3 changes: 2 additions & 1 deletion packages/application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"draw/dependency-injection": "^0.11",
"draw/tester": "^0.11",
"symfony/cache": "^6.4.0",
"symfony/console": "^6.4.0"
"symfony/console": "^6.4.0",
"symfony/messenger": "^6.4.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Draw\Component\Console\Tests\DependencyInjection;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use Draw\Component\Console\Command\GenerateDocumentationCommand;
use Draw\Component\Console\Command\PurgeExecutionCommand;
use Draw\Component\Console\DependencyInjection\ConsoleIntegration;
Expand Down Expand Up @@ -60,7 +59,7 @@ public function testPrependNoDoctrineExtension(): void
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new DoctrineExtension());
$containerBuilder->registerExtension($this->mockExtension('doctrine'));

$this->integration->prepend(
$containerBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private static function getDefaultExcludedDirectories(): array
'Resources/',
'Stamp/',
'Tests/',
'vendor/',
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

abstract class IntegrationTestCase extends TestCase
Expand All @@ -24,6 +25,22 @@ abstract public function getDefaultConfiguration(): array;

abstract public static function provideTestLoad(): iterable;

protected function mockExtension(string $name): ExtensionInterface
{
$extension = $this->createMock(ExtensionInterface::class);

$extension->expects(static::any())
->method('getAlias')
->willReturn($name);

$extension
->expects(static::any())
->method('getNamespace')
->willReturn($name);

return $extension;
}

protected function setUp(): void
{
$this->integration = $this->createIntegration();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Draw\Component\DependencyInjection\Tests\DependencyInjection;

use Draw\Component\DependencyInjection\DependencyInjection\DependencyInjectionIntegration;
use Draw\Component\DependencyInjection\Integration\IntegrationInterface;
use Draw\Component\DependencyInjection\Integration\Test\IntegrationTestCase;

class DependencyInjectionIntegrationTest extends IntegrationTestCase
{
public function createIntegration(): IntegrationInterface
{
return new DependencyInjectionIntegration();
}

public function getConfigurationSectionName(): string
{
return 'dependency_injection';
}

public function getDefaultConfiguration(): array
{
return [];
}

public static function provideTestLoad(): iterable
{
yield [];
}
}
3 changes: 2 additions & 1 deletion packages/dependency-injection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"require": {
"php": ">=8.1",
"symfony/config": "^6.4.0"
"symfony/config": "^6.4.0",
"symfony/dependency-injection": "^6.4.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
Expand Down
4 changes: 3 additions & 1 deletion packages/log/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
},
"require-dev": {
"draw/dependency-injection": "^0.11",
"draw/user-bundle": "^0.11",
"monolog/monolog": "^3.5.0",
"phpunit/phpunit": "^9.0 || ^10.0",
"symfony/event-dispatcher": "^6.4.0",
"symfony/http-foundation": "^6.4.0",
"symfony/http-kernel": "^6.4.0"
"symfony/http-kernel": "^6.4.0",
"symfony/security-core": "^6.4.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
use Draw\Component\Mailer\EventListener\EmailSubjectFromHtmlTitleListener;
use Draw\Component\Mailer\Twig\TranslationExtension;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
use Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

Expand Down Expand Up @@ -68,8 +66,8 @@ public function testPrependNoFrameworkExtension(): void
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new FrameworkExtension());
$containerBuilder->registerExtension(new TwigExtension());
$containerBuilder->registerExtension($this->mockExtension('framework'));
$containerBuilder->registerExtension($this->mockExtension('twig'));

$this->integration->prepend(
$containerBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function load(array $config, PhpFileLoader $loader, ContainerBuilder $con
'Resources',
'SerializerEventDispatcher',
'Tests',
'vendor',
'Versioning',
];

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

namespace Draw\Component\Messenger\Tests\DependencyInjection;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
use Draw\Bundle\SonataIntegrationBundle\DependencyInjection\DrawSonataIntegrationExtension;
use Draw\Component\DependencyInjection\Integration\IntegrationInterface;
use Draw\Component\DependencyInjection\Integration\Test\IntegrationTestCase;
use Draw\Component\DependencyInjection\Integration\Test\ServiceConfiguration;
Expand Down Expand Up @@ -39,7 +37,6 @@
use Draw\Contracts\Messenger\EnvelopeFinderInterface;
use Draw\Contracts\Messenger\TransportRepositoryInterface;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -404,9 +401,9 @@ function (Definition $definition): void {
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new DoctrineExtension());
$containerBuilder->registerExtension(new FrameworkExtension());
$containerBuilder->registerExtension(new DrawSonataIntegrationExtension());
$containerBuilder->registerExtension($this->mockExtension('doctrine'));
$containerBuilder->registerExtension($this->mockExtension('framework'));
$containerBuilder->registerExtension($this->mockExtension('draw_sonata_integration'));

$this->integration->prepend(
$containerBuilder,
Expand Down
1 change: 1 addition & 0 deletions packages/open-api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"draw/dependency-injection": "^0.11",
"draw/tester": "^0.11",
"doctrine/common": "^3.1",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/orm": "^2.11",
"phpunit/phpunit": "^9.0 || ^10.0",
"sensio/framework-extra-bundle": "^5.6 || ^6.2"
Expand Down
3 changes: 2 additions & 1 deletion packages/validator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"require-dev": {
"phpunit/phpunit": "^9.0 || ^10.0",
"doctrine/persistence": "^2.2 || ^3.0"
"doctrine/persistence": "^2.2 || ^3.0",
"draw/dependency-injection": "^0.11"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down

0 comments on commit 54bf22d

Please sign in to comment.