Skip to content

Commit 9864665

Browse files
committed
improved tests
1 parent 77c1512 commit 9864665

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

tests/Bridges.Latte2/CacheMacro.cache.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (version_compare(Latte\Engine::VERSION, '3', '>')) {
1919
$latte = new Latte\Engine;
2020
$latte->setTempDirectory(getTempDir());
2121
$latte->addMacro('cache', new CacheMacro($latte->getCompiler()));
22-
$latte->addProvider('cacheStorage', new Nette\Caching\Storages\DevNullStorage);
22+
$latte->addProvider('cacheStorage', new Nette\Caching\Storages\MemoryStorage);
2323

2424
$params['title'] = 'Hello';
2525
$params['id'] = 456;
@@ -35,6 +35,13 @@ Assert::matchFile(
3535
$params
3636
)
3737
);
38+
Assert::matchFile(
39+
__DIR__ . '/expected/CacheMacro.cache.html',
40+
$latte->renderToString(
41+
__DIR__ . '/templates/cache.latte',
42+
$params
43+
)
44+
);
3845
Assert::matchFile(
3946
__DIR__ . '/expected/CacheMacro.cache.inc.php',
4047
file_get_contents($latte->getCacheFile(__DIR__ . strtr('/templates/include.cache.latte', '/', DIRECTORY_SEPARATOR)))

tests/Bridges.Latte3/{cache}.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (version_compare(Latte\Engine::VERSION, '3', '<')) {
1818

1919
$latte = new Latte\Engine;
2020
$latte->setTempDirectory(getTempDir());
21-
$latte->addExtension(new CacheExtension(new Nette\Caching\Storages\DevNullStorage));
21+
$latte->addExtension(new CacheExtension(new Nette\Caching\Storages\MemoryStorage));
2222

2323
$params['title'] = 'Hello';
2424
$params['id'] = 456;
@@ -34,6 +34,13 @@ Assert::matchFile(
3434
$params
3535
)
3636
);
37+
Assert::matchFile(
38+
__DIR__ . '/expected/cache.html',
39+
$latte->renderToString(
40+
__DIR__ . '/templates/cache.latte',
41+
$params
42+
)
43+
);
3744
Assert::matchFile(
3845
__DIR__ . '/expected/cache.inc.php',
3946
file_get_contents($latte->getCacheFile(__DIR__ . strtr('/templates/include.cache.latte', '/', DIRECTORY_SEPARATOR)))

0 commit comments

Comments
 (0)