added Logger and config
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
18ec014f0b
commit
b862611433
|
@ -26,7 +26,7 @@ class DomainRepositoryTest extends TestCase
|
||||||
private string $localZonesDir;
|
private string $localZonesDir;
|
||||||
private string $namedConfLocalFile;
|
private string $namedConfLocalFile;
|
||||||
|
|
||||||
private $log;
|
private Logger $log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|string $dataName
|
* @param int|string $dataName
|
||||||
|
@ -38,7 +38,7 @@ class DomainRepositoryTest extends TestCase
|
||||||
{
|
{
|
||||||
parent::__construct(name: $name, data: $data, dataName: $dataName);
|
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%
|
$output = "%datetime% %channel%.%level_name% %message%\n"; // %context% %extra%
|
||||||
$formatter = new LineFormatter(format: $output, dateFormat: $dateFormat);
|
$formatter = new LineFormatter(format: $output, dateFormat: $dateFormat);
|
||||||
|
|
||||||
|
@ -61,6 +61,13 @@ class DomainRepositoryTest extends TestCase
|
||||||
$containerBuilder = new ContainerBuilder();
|
$containerBuilder = new ContainerBuilder();
|
||||||
$containerBuilder->addDefinitions([
|
$containerBuilder->addDefinitions([
|
||||||
DatabaseConnection::class => autowire()->constructorParameter(parameter: 'config', value: $config),
|
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();
|
$this->container = $containerBuilder->build();
|
||||||
|
|
||||||
|
@ -89,7 +96,9 @@ class DomainRepositoryTest extends TestCase
|
||||||
$this->domainRepository->insert(domain: $domain);
|
$this->domainRepository->insert(domain: $domain);
|
||||||
$this->domainController->createZoneFile(domain: $domain);
|
$this->domainController->createZoneFile(domain: $domain);
|
||||||
|
|
||||||
|
// now get the persisted domain with id
|
||||||
$domainTest = $this->domainRepository->findByName(name: 'inserttest.org');
|
$domainTest = $this->domainRepository->findByName(name: 'inserttest.org');
|
||||||
|
|
||||||
$this->assertIsNotBool(actual: $domainTest);
|
$this->assertIsNotBool(actual: $domainTest);
|
||||||
$this->assertEquals(expected: 'inserttest.org', actual: $domainTest->getName());
|
$this->assertEquals(expected: 'inserttest.org', actual: $domainTest->getName());
|
||||||
|
|
||||||
|
@ -111,7 +120,7 @@ class DomainRepositoryTest extends TestCase
|
||||||
|
|
||||||
|
|
||||||
// clean up
|
// 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
|
// domain is valid and created
|
||||||
|
|
||||||
// now delete and check for cleanup
|
// now delete and check for cleanup
|
||||||
$this->domainRepository->delete(id: $domainTest->getId());
|
$this->domainRepository->delete(domain: $domainTest);
|
||||||
|
|
||||||
$this->domainController->deleteZone(domain: $domainTest);
|
$this->domainController->deleteZone(domain: $domainTest);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue