Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ services:
evaisse\SimpleHttpBundle\Controller\ReplayController:
arguments:
$debug: '%kernel.debug%'
public: true
tags:
- { name: controller.service_arguments }
evaisse\SimpleHttpBundle\Service\ReplayRequestResolver: ~
evaisse\SimpleHttpBundle\Service\ReplayRequestSignature:
arguments:
Expand Down
46 changes: 46 additions & 0 deletions Tests/Unit/ReplayControllerWiringTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace evaisse\SimpleHttpBundle\Tests\Unit;

use evaisse\SimpleHttpBundle\Controller\ReplayController;
use evaisse\SimpleHttpBundle\DependencyInjection\SimpleHttpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

class ReplayControllerWiringTest extends TestCase
{
public function testReplayControllerIsRegisteredAsCallableControllerService(): void
{
$container = new ContainerBuilder();
$container->setParameter('kernel.debug', true);
$container->setParameter('kernel.secret', 'test-secret');
$container->setParameter('kernel.root_dir', sys_get_temp_dir());
$container->setParameter('kernel.environment', 'test');

$container->register('event_dispatcher', EventDispatcher::class);
$container->setAlias(EventDispatcherInterface::class, 'event_dispatcher')->setPublic(true);
$container->register('debug.stopwatch', Stopwatch::class);
$container->register('twig.loader', \stdClass::class);

$extension = new SimpleHttpExtension();
$extension->load([], $container);

$definition = $container->getDefinition(ReplayController::class);

$this->assertTrue(
$definition->isPublic(),
'ReplayController must stay public so Symfony can fetch it from the container.'
);
$this->assertNotEmpty(
$definition->getTag('controller.service_arguments'),
'ReplayController must be tagged as controller.service_arguments.'
);

$container->compile();

$this->assertInstanceOf(ReplayController::class, $container->get(ReplayController::class));
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"homepage": "https://github.com/evaisse/SimpleHttpBundle",
"require": {
"php": "^8.1",
"react/promise": "^2.2 || ^3.0",
"react/promise": "^2.11",
"twig/twig": "^3.27",
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
Expand All @@ -28,6 +28,7 @@
"symfony/security-csrf": "^5.4 || ^6.0 || ^7.0",
"symfony/security-http": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"symfony/mime": "^5.4 || ^6.0 || ^7.0",
"ext-dom": "*",
"ext-json": "*",
Expand Down
Loading