Skip to content

Commit

Permalink
partially fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericges committed Apr 4, 2024
1 parent 53def0a commit bc67a3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/EventListener/RenderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public function createTestInstance(array $parameters = [], ?MockBuilder $mockBui

if ($mockBuilder) {
$instance = $mockBuilder->setConstructorArgs([
$container,
$parameters['templateLocator'],
$parameters['eventDispatcher'],
$parameters['requestStack'],
Expand All @@ -85,7 +84,6 @@ public function createTestInstance(array $parameters = [], ?MockBuilder $mockBui
])->getMock();
} else {
$instance = new RenderListener(
$container,
$parameters['templateLocator'],
$parameters['eventDispatcher'],
$parameters['requestStack'],
Expand All @@ -96,6 +94,8 @@ public function createTestInstance(array $parameters = [], ?MockBuilder $mockBui
);
}

$instance->setContainer($container);

return $instance;
}

Expand Down
23 changes: 15 additions & 8 deletions tests/Filesystem/TwigTemplateLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use HeimrichHannot\TwigSupportBundle\Filesystem\TwigTemplateLocator;
use PHPUnit\Framework\MockObject\MockBuilder;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
Expand Down Expand Up @@ -64,6 +65,10 @@ public function createTestInstance(array $parameter = [], ?MockBuilder $mockBuil
$parameter['cache'] = $this->createMock(FilesystemAdapter::class);
}

if (!isset($parameter['parameterBag'])) {
$parameter['parameterBag'] = $this->createMock(ParameterBagInterface::class);
}

$contaoFramework = $parameter['framework'] ?? $this->mockContaoFramework([
ThemeModel::class => $this->mockAdapter(['findAll']),
]);
Expand All @@ -77,18 +82,20 @@ public function createTestInstance(array $parameter = [], ?MockBuilder $mockBuil
$this->createMock(Stopwatch::class),
$parameter['cache'],
$contaoFramework,
$parameter['parameterBag'],
])->getMock();
}

return new TwigTemplateLocator(
$parameter['kernel'],
$parameter['resource_finder'],
$parameter['request_stack'],
$parameter['scope_matcher'],
$this->createMock(Stopwatch::class),
$parameter['cache'],
$contaoFramework
);
$parameter['kernel'],
$parameter['resource_finder'],
$parameter['request_stack'],
$parameter['scope_matcher'],
$this->createMock(Stopwatch::class),
$parameter['cache'],
$contaoFramework,
$parameter['parameterBag'],
);
}

public function testGetTemplateGroup()
Expand Down

0 comments on commit bc67a3a

Please sign in to comment.