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 5a48855
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 7 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 @@ -60,7 +60,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

0 comments on commit 5a48855

Please sign in to comment.