added Logger and config

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-06 17:41:04 +01:00
parent 18ec014f0b
commit b862611433
1 changed files with 13 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class DomainRepositoryTest extends TestCase
private string $localZonesDir;
private string $namedConfLocalFile;
private $log;
private Logger $log;
/**
* @param int|string $dataName
@ -38,7 +38,7 @@ class DomainRepositoryTest extends TestCase
{
parent::__construct(name: $name, data: $data, dataName: $dataName);
$dateFormat = "Y:m:d H:i:s";
$dateFormat = "Y-m-d H:i:s";
$output = "%datetime% %channel%.%level_name% %message%\n"; // %context% %extra%
$formatter = new LineFormatter(format: $output, dateFormat: $dateFormat);
@ -61,6 +61,13 @@ class DomainRepositoryTest extends TestCase
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions([
DatabaseConnection::class => autowire()->constructorParameter(parameter: 'config', value: $config),
DomainController::class => autowire()
->constructorParameter(parameter: 'config', value: $config)
->constructorParameter(parameter: 'log', value: $this->log),
DomainRepository::class => autowire()
->constructorParameter(parameter: 'config', value: $config)
->constructorParameter(parameter: 'log', value: $this->log),
]);
$this->container = $containerBuilder->build();
@ -89,7 +96,9 @@ class DomainRepositoryTest extends TestCase
$this->domainRepository->insert(domain: $domain);
$this->domainController->createZoneFile(domain: $domain);
// now get the persisted domain with id
$domainTest = $this->domainRepository->findByName(name: 'inserttest.org');
$this->assertIsNotBool(actual: $domainTest);
$this->assertEquals(expected: 'inserttest.org', actual: $domainTest->getName());
@ -111,7 +120,7 @@ class DomainRepositoryTest extends TestCase
// clean up
$this->domainRepository->delete(id: $domainTest->getId());
$this->domainRepository->delete(domain: $domainTest);
}
@ -132,7 +141,7 @@ class DomainRepositoryTest extends TestCase
// domain is valid and created
// now delete and check for cleanup
$this->domainRepository->delete(id: $domainTest->getId());
$this->domainRepository->delete(domain: $domainTest);
$this->domainController->deleteZone(domain: $domainTest);