Skip to content

Commit

Permalink
removed extra services-test-config, use class imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrx committed Feb 6, 2024
1 parent 102bec6 commit 6b233f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
15 changes: 0 additions & 15 deletions src/Resources/config/services_test.xml

This file was deleted.

25 changes: 14 additions & 11 deletions tests/BundleInitializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Shivas\VersioningBundle\Tests;

use Nyholm\BundleTest\TestKernel;
use Shivas\VersioningBundle\Formatter\FormatterInterface;
use Shivas\VersioningBundle\Formatter\GitDescribeFormatter;
use Shivas\VersioningBundle\Provider\GitRepositoryProvider;
Expand All @@ -16,30 +17,32 @@
use Shivas\VersioningBundle\Writer\VersionWriter;
use Shivas\VersioningBundle\Writer\WriterInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\KernelInterface;

/**
* @covers \Shivas\VersioningBundle\ShivasVersioningBundle
*/
class BundleInitializationTest extends KernelTestCase
{
protected function setUp(): void
{
parent::setUp();
}

protected static function getKernelClass(): string
{
return \Nyholm\BundleTest\TestKernel::class;
return TestKernel::class;
}

protected static function createKernel(array $options = []): \Symfony\Component\HttpKernel\KernelInterface
protected static function createKernel(array $options = []): KernelInterface
{
/**
* @var \Nyholm\BundleTest\TestKernel $kernel
*/
/** @var TestKernel $kernel */
$kernel = parent::createKernel($options);
$kernel->addTestConfig($kernel->getProjectDir().'/src/Resources/config/services_test.xml');
$kernel->addTestBundle(ShivasVersioningBundle::class);
$kernel->addTestCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
{
// Service would be removed because it's unused.
$container->findDefinition('shivas_versioning.twig.version')->setPublic(true);
}
});
$kernel->handleOptions($options);

return $kernel;
Expand Down

0 comments on commit 6b233f5

Please sign in to comment.