Initial commit

This commit is contained in:
pcm-libraries
2024-08-07 15:04:23 +00:00
commit a4f4e1990c
17 changed files with 450 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;
/**
* Test to make sure 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',
];
}
}