Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
tests: add aliases for private services
Browse files Browse the repository at this point in the history
  • Loading branch information
mhujer committed Feb 21, 2018
1 parent f9e04c3 commit b9cd107
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/DependencyInjection/MonologTracyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Nella\MonologTracy\BlueScreenHandler;
use Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;

Expand Down Expand Up @@ -272,11 +273,18 @@ public function testCollapsePaths()
public function testHandlerInstance()
{
$this->load();

// alias private service with public alias so it can be fetched from container
$this->container->setAlias(
'bluescreenhandler',
new Alias(MonologTracyExtension::BLUESCREEN_HANDLER_SERVICE_ID, TRUE)
);

$this->compile();

@mkdir($this->container->getParameter(MonologTracyExtension::LOG_DIRECTORY_PARAMETER), 0777, TRUE);

$handler = $this->container->get(MonologTracyExtension::BLUESCREEN_HANDLER_SERVICE_ID);
$handler = $this->container->get('bluescreenhandler');
$this->assertInstanceOf(BlueScreenHandler::class, $handler);
}

Expand All @@ -285,11 +293,18 @@ public function testHandlerInstanceWithPanel()
$this->load([], [
'sectionPanels.yml',
]);

// alias private service with public alias so it can be fetched from container
$this->container->setAlias(
'bluescreenhandler',
new Alias(MonologTracyExtension::BLUESCREEN_HANDLER_SERVICE_ID, TRUE)
);

$this->compile();

@mkdir($this->container->getParameter(MonologTracyExtension::LOG_DIRECTORY_PARAMETER), 0777, TRUE);

$handler = $this->container->get(MonologTracyExtension::BLUESCREEN_HANDLER_SERVICE_ID);
$handler = $this->container->get('bluescreenhandler');
$this->assertInstanceOf(BlueScreenHandler::class, $handler);
}

Expand Down

0 comments on commit b9cd107

Please sign in to comment.