Initial commit

This commit is contained in:
pcm-internal
2025-11-27 13:22:07 +00:00
commit 2a82b5c0b1
18 changed files with 496 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Pcm\ExampleBundle\Tests\Config;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\Processor;
/**
* This file tests the config to ensure that the config validation is working as expected.
*/
class ConfigurationTest extends TestCase
{
private Configuration $configuration;
private Processor $processor;
protected function setUp(): void
{
$this->configuration = new Configuration(true);
$this->processor = new Processor();
}
public function testThrowsIfNameIsEmpty()
{
$config = $this->getValidConfig();
$config['name'] = '';
$this->expectException(\Exception::class);
$this->validateConfig($config);
}
private function validateConfig(array $config): array
{
return $this->processor->processConfiguration($this->configuration, [$config]);
}
private function getValidConfig(): array
{
return [
'name' => 'Boris',
];
}
}

26
tests/TestKernel.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Pcm\ExampleBundle\Tests;
use Pcm\ExampleBundle\PcmExampleBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
final class TestKernel extends Kernel
{
public function registerBundles(): array
{
return [
new PcmExampleBundle()
];
}
public function registerContainerConfiguration(LoaderInterface $loader): void
{
// Ignore this
// $loader->load(__DIR__.'/../config/packages/pcm_example.yaml');
}
}