Skip to content

Commit

Permalink
Test LoggerHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed May 29, 2019
1 parent 21ef59f commit abb0a40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/Unit/DI/MonologExtensionTest.php
Expand Up @@ -4,6 +4,7 @@

use Contributte\Monolog\DI\MonologExtension;
use Contributte\Monolog\Exception\Logic\InvalidStateException;
use Contributte\Monolog\LoggerHolder;
use Contributte\Monolog\LoggerManager;
use Monolog\Logger;
use Nette\DI\Compiler;
Expand All @@ -19,6 +20,9 @@ public function testRegistration(): void
{
$container = $this->createContainer(__DIR__ . '/config.neon');

// Needed for LoggerHolder
$container->initialize();

/** @var Logger $default */
$default = $container->getByType(LoggerInterface::class);
$this->assertInstanceOf(Logger::class, $default);
Expand All @@ -39,6 +43,8 @@ public function testRegistration(): void

$this->assertTrue($manager->has('foo'));
$this->assertSame($foo, $manager->get('foo'));

$this->assertInstanceOf(LoggerInterface::class, LoggerHolder::getInstance()->getLogger());
}

public function testRegistrationNoDefault(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/DI/config.neon
Expand Up @@ -8,3 +8,5 @@ monolog:
- Monolog\Handler\NullHandler
manager:
enabled: true
holder:
enabled: true

0 comments on commit abb0a40

Please sign in to comment.