Skip to content

Commit

Permalink
Merge pull request #14 from dotkernel/issue-13
Browse files Browse the repository at this point in the history
Issue #13: Fixed incorrect config value lookup.
  • Loading branch information
arhimede authored Jul 19, 2023
2 parents c3ebcf8 + dbdeffb commit 7559142
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/Factory/DebugBarExtensionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function __invoke(ContainerInterface $container): DebugBarExtension
) {
throw new Exception(DebugBarFactory::MESSAGE_MISSING_PACKAGE_CONFIG);
}
$config = $config[DebugBar::class];

if (
! array_key_exists('application', $config)
Expand Down
6 changes: 3 additions & 3 deletions test/CommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ trait CommonTrait
'ipv4Whitelist' => [],
'ipv6Whitelist' => [],
'javascript_renderer' => [],
'application' => [
'url' => 'https://example.com',
],
],
'application' => [
'url' => 'https://example.com',
],
];
}
14 changes: 7 additions & 7 deletions test/Extension/DebugBarExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testConstructor(): void
public function testGetFunctions(): void
{
$dotDebugBar = $this->createMock(DebugBar::class);
$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$functions = $extension->getFunctions();
$this->assertIsArray($functions);
$this->assertCount(3, $functions);
Expand All @@ -50,7 +50,7 @@ public function testRenderDebugBarEnabledReturnsTrueWhenEnabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->enable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$this->assertTrue($extension->renderDebugBarEnabled());
}

Expand All @@ -64,7 +64,7 @@ public function testRenderDebugBarEnabledReturnsFalseWhenDisabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->disable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$this->assertFalse($extension->renderDebugBarEnabled());
}

Expand All @@ -78,7 +78,7 @@ public function testWillNotRenderDebugBarCssWhenDisabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->disable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$this->assertNull($extension->renderDebugBarCss());
}

Expand All @@ -92,7 +92,7 @@ public function testWillRenderDebugBarCssWhenEnabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->enable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$html = $extension->renderDebugBarCss();
$this->assertStringContainsString('dotkernel.css', $html);
$this->assertStringContainsString('debugbar.css', $html);
Expand All @@ -108,7 +108,7 @@ public function testWillNotRenderDebugBarJsWhenDisabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->disable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$this->assertNull($extension->renderDebugBarJs());
}

Expand All @@ -122,7 +122,7 @@ public function testWillRenderDebugBarJsWhenEnabled(): void
$dotDebugBar = new DebugBar($configuration, []);
$dotDebugBar->enable();

$extension = new DebugBarExtension($dotDebugBar, $this->config[DebugBar::class]['application']['url']);
$extension = new DebugBarExtension($dotDebugBar, $this->config['application']['url']);
$html = $extension->renderDebugBarJs();
$this->assertStringContainsString('var phpdebugbar = new PhpDebugBar.DebugBar();', $html);
$this->assertStringContainsString('debugbar.js', $html);
Expand Down

0 comments on commit 7559142

Please sign in to comment.