-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,18 @@ | |
use ReflectionClass; | ||
|
||
use function assert; | ||
use function str_replace; | ||
use function trim; | ||
|
||
use const DIRECTORY_SEPARATOR; | ||
|
||
class FileLoaderTest extends TestCase | ||
{ | ||
public function getInjector(): Injector | ||
{ | ||
return new Injector(new TwigFileLoaderTestModule([__DIR__ . '/Fake/src/Resource'])); | ||
$path = str_replace('/', DIRECTORY_SEPARATOR, __DIR__ . '/Fake/src/Resource/'); | ||
|
||
return new Injector(new TwigFileLoaderTestModule([$path])); | ||
} | ||
|
||
public function testRenderer(): void | ||
|
@@ -38,11 +43,12 @@ public function testRenderer(): void | |
public function testTwigOptions(): void | ||
{ | ||
/** @var TwigRenderer $renderer */ | ||
$renderer = (new Injector(new TwigFileLoaderTestModule([__DIR__ . '/Fake/src/Resource'], ['debug' => true])))->getInstance(TwigRenderer::class); | ||
$path = str_replace('/', DIRECTORY_SEPARATOR, __DIR__ . '/Fake/src/Resource/'); | ||
Check failure on line 46 in tests/FileLoaderTest.php
|
||
$renderer = (new Injector(new TwigFileLoaderTestModule([$path], ['debug' => true])))->getInstance(TwigRenderer::class); | ||
$this->assertTrue($renderer->twig->isDebug()); | ||
|
||
/** @var TwigRenderer $renderer */ | ||
$renderer = (new Injector(new TwigFileLoaderTestModule([__DIR__ . '/Fake/src/Resource'], ['debug' => false])))->getInstance(TwigRenderer::class); | ||
$renderer = (new Injector(new TwigFileLoaderTestModule([$path], ['debug' => false])))->getInstance(TwigRenderer::class); | ||
$this->assertFalse($renderer->twig->isDebug()); | ||
} | ||
|
||
|
@@ -155,7 +161,8 @@ public function testRedirectOnPost(): void | |
|
||
public function testRedirectOnPostNoRedirectTemplate(): void | ||
{ | ||
$injector = new Injector(new TwigFileLoaderTestModule([__DIR__ . '/Fake/src/ResourceNoTemplate'])); | ||
$path = str_replace('/', DIRECTORY_SEPARATOR, __DIR__ . '/Fake/src/ResourceNoTemplate/'); | ||
$injector = new Injector(new TwigFileLoaderTestModule([$path])); | ||
$ro = $injector->getInstance(RedirectNoTemplate::class); | ||
$ro->onPost(); | ||
$view = (string) $ro; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters