Skip to content

Commit

Permalink
renamed all test files
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 8, 2022
1 parent 999228a commit 8a98191
Show file tree
Hide file tree
Showing 332 changed files with 95 additions and 91 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,14 +10,14 @@ require __DIR__ . '/../bootstrap.php';

$latte = new Latte\Engine;

$template = $latte->createTemplate(__DIR__ . '/templates/general.latte');
$template = $latte->createTemplate(__DIR__ . '/templates/block.latte');
Assert::type(Latte\Runtime\Template::class, $template);
Assert::null($template->getReferringTemplate());
Assert::null($template->getReferenceType());
Assert::same(['menu'], $template->getBlockNames());


$template = $latte->createTemplate(__DIR__ . '/templates/general.latte');
$template = $latte->createTemplate(__DIR__ . '/templates/block.latte');
Assert::type(Latte\Runtime\Template::class, $template);
Assert::null($template->getReferringTemplate());
Assert::null($template->getReferenceType());
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -12,7 +12,7 @@ use Tester\Assert;
require __DIR__ . '/../bootstrap.php';

test('', function () {
$template = __DIR__ . '/templates/general.latte';
$template = __DIR__ . '/templates/block.latte';

$latte = new Latte\Engine;
$latte->setTempDirectory(getTempDir());
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -33,17 +33,17 @@ Assert::exception(function () {


$loader = new FileLoader(dirname(__DIR__));
Assert::same(file_get_contents(__FILE__), $loader->getContent('Latte/' . basename(__FILE__)));
Assert::same(file_get_contents(__FILE__), $loader->getContent('common/' . basename(__FILE__)));

Assert::exception(function () use ($loader) {
$loader->getContent('Latte/.././../file');
}, Latte\RuntimeException::class, "Template '%a%Latte/.././../file' is not within the allowed path '%a%'.");
$loader->getContent('common/.././../file');
}, Latte\RuntimeException::class, "Template '%a%common/.././../file' is not within the allowed path '%a%'.");

Assert::false($loader->isExpired('Latte/' . basename(__FILE__), filemtime(__FILE__) + 1));
Assert::true($loader->isExpired('Latte/' . basename(__FILE__), filemtime(__FILE__) - 1));
Assert::false($loader->isExpired('common/' . basename(__FILE__), filemtime(__FILE__) + 1));
Assert::true($loader->isExpired('common/' . basename(__FILE__), filemtime(__FILE__) - 1));

Assert::same('Latte' . DIRECTORY_SEPARATOR . 'new', $loader->getReferredName('new', 'Latte/file'));
Assert::same('Latte', $loader->getReferredName('Latte', 'file'));
Assert::same('common' . DIRECTORY_SEPARATOR . 'new', $loader->getReferredName('new', 'common/file'));
Assert::same('common', $loader->getReferredName('common', 'file'));
Assert::same('..' . DIRECTORY_SEPARATOR . 'tests', $loader->getReferredName('../tests', 'file'));
Assert::same('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests', $loader->getReferredName('../tests', '../file'));
Assert::same(str_repeat('..' . DIRECTORY_SEPARATOR, 7) . 'tests', $loader->getReferredName('../../../../tests', '../../../file'));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/common/templates/block.latte
@@ -0,0 +1,4 @@
{block menu}
<ul>
</ul>
{/block}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -72,13 +72,13 @@ $params['hello'] = 'Hello World';
$params['date'] = strtotime('2008-01-02');

Assert::matchFile(
__DIR__ . '/expected/filters.general.phtml',
$latte->compile(__DIR__ . '/templates/filters.general.latte')
__DIR__ . '/expected/general.phtml',
$latte->compile(__DIR__ . '/templates/general.latte')
);
Assert::matchFile(
__DIR__ . '/expected/filters.general.html',
__DIR__ . '/expected/general.html',
$latte->renderToString(
__DIR__ . '/templates/filters.general.latte',
__DIR__ . '/templates/general.latte',
$params
)
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -27,7 +27,7 @@ $template = <<<'XX'
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.breaking.phtml',
__DIR__ . '/expected/breaking.phtml',
$latte->compile($template)
);
Assert::match(
Expand Down
Expand Up @@ -43,10 +43,10 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.dynamicblock.phtml',
__DIR__ . '/expected/block.dynamic.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.dynamicblock.html',
__DIR__ . '/expected/block.dynamic.html',
$latte->renderToString($template)
);
Expand Up @@ -44,10 +44,10 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.local.dynamic.phtml',
__DIR__ . '/expected/block.local.dynamic.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.local.dynamic.html',
__DIR__ . '/expected/block.local.dynamic.html',
$latte->renderToString($template)
);
File renamed without changes.
File renamed without changes.
Expand Up @@ -51,10 +51,10 @@ $template = <<<'XX'
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.vars.phtml',
__DIR__ . '/expected/vars.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.vars.html',
__DIR__ . '/expected/vars.html',
$latte->renderToString($template)
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -35,11 +35,11 @@ d) {include test null}
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args1.phtml',
__DIR__ . '/expected/define.args1.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args1.html',
__DIR__ . '/expected/define.args1.html',
$latte->renderToString($template, ['hello' => 'world'])
);

Expand All @@ -53,7 +53,7 @@ $template = <<<'XX'
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.typehints.phtml',
__DIR__ . '/expected/define.typehints.phtml',
$latte->compile($template)
);

Expand All @@ -76,11 +76,11 @@ d) {include test, var2 => 1, 2} // invalid
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args2.phtml',
__DIR__ . '/expected/define.args2.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args2.html',
__DIR__ . '/expected/define.args2.html',
$latte->renderToString($template, ['var3' => 'outer'])
);

Expand All @@ -101,7 +101,7 @@ c) {include test, hello => 1}
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args3.phtml',
__DIR__ . '/expected/define.args3.phtml',
$latte->compile($template)
);

Expand All @@ -126,11 +126,11 @@ c) {include test, hello => 1}',
]));

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args4.phtml',
__DIR__ . '/expected/define.args4.phtml',
$latte->compile('main')
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args4.html',
__DIR__ . '/expected/define.args4.html',
$latte->renderToString('main', ['var3' => 'outer'])
);

Expand All @@ -150,10 +150,10 @@ b) {include test, var1 => 1}
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args5.phtml',
__DIR__ . '/expected/define.args5.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.args5.html',
__DIR__ . '/expected/define.args5.html',
$latte->renderToString($template)
);
Expand Up @@ -29,10 +29,10 @@ $template = <<<'XX'
XX;

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.phtml',
__DIR__ . '/expected/define.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/BlockMacros.define.html',
__DIR__ . '/expected/define.html',
$latte->renderToString($template)
);
File renamed without changes.
File renamed without changes.
Expand Up @@ -365,6 +365,6 @@ $latte->setLoader(new Latte\Loaders\StringLoader([
]));

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.embed.block.phtml',
__DIR__ . '/expected/embed.block.phtml',
$latte->compile('main')
);
Expand Up @@ -739,6 +739,6 @@ $latte->setLoader(new Latte\Loaders\StringLoader([
]));

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.embed.file.phtml',
__DIR__ . '/expected/embed.file.phtml',
$latte->compile('main')
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -11,4 +11,4 @@
pre
</textarea>

Parent: BlockMacros.include.latte/include
Parent: include.latte/include
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -23,6 +23,6 @@ content
';

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.extendsCheck.phtml',
__DIR__ . '/expected/extendsCheck.phtml',
$latte->compile($template)
);
Expand Up @@ -44,10 +44,10 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.first-sep-last.phtml',
__DIR__ . '/expected/first-sep-last.phtml',
$latte->compile($template)
);
Assert::matchFile(
__DIR__ . '/expected/CoreMacros.first-sep-last.html',
__DIR__ . '/expected/first-sep-last.html',
$latte->renderToString($template, ['people' => ['John', 'Mary', 'Paul']])
);
2 changes: 1 addition & 1 deletion tests/Latte/CoreMacros.for.phpt → tests/tags/for.phpt
Expand Up @@ -31,6 +31,6 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.for.phtml',
__DIR__ . '/expected/for.phtml',
$latte->compile($template)
);
Expand Up @@ -53,7 +53,7 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.foreach.breaking.phtml',
__DIR__ . '/expected/foreach.breaking.phtml',
$latte->compile($template)
);

Expand Down Expand Up @@ -105,7 +105,7 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.foreach.breaking.attr.phtml',
__DIR__ . '/expected/foreach.breaking.attr.phtml',
$latte->compile($template)
);

Expand Down
Expand Up @@ -17,7 +17,7 @@ $latte->setLoader(new Latte\Loaders\StringLoader);


Assert::matchFile(
__DIR__ . '/expected/CoreMacros.foreach.else.phtml',
__DIR__ . '/expected/foreach.else.phtml',
$latte->compile('
{foreach [a] as $item}
item
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -31,7 +31,7 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.foreach2.phtml',
__DIR__ . '/expected/foreach2.phtml',
$latte->compile($template)
);

Expand Down
Expand Up @@ -26,11 +26,11 @@ $params['el'] = new Html("<div title='1/2\"'></div>");
$params['el2'] = Nette\Utils\Html::el('span', ['title' => '/"'])->setText('foo');

Assert::matchFile(
__DIR__ . '/expected/macros.general.html.phtml',
__DIR__ . '/expected/general.html.phtml',
$latte->compile(__DIR__ . '/templates/general.latte')
);
Assert::matchFile(
__DIR__ . '/expected/macros.general.html.html',
__DIR__ . '/expected/general.html.html',
$latte->renderToString(
__DIR__ . '/templates/general.latte',
$params
Expand Down
Expand Up @@ -17,11 +17,11 @@ $latte = new Latte\Engine;
$params['people'] = ['John', 'Mary', 'Paul'];

Assert::matchFile(
__DIR__ . '/expected/macros.n-attributes.phtml',
__DIR__ . '/expected/general.n-attributes.phtml',
$latte->compile(__DIR__ . '/templates/n-attributes.latte')
);
Assert::matchFile(
__DIR__ . '/expected/macros.n-attributes.html',
__DIR__ . '/expected/general.n-attributes.html',
$latte->renderToString(
__DIR__ . '/templates/n-attributes.latte',
$params
Expand Down
Expand Up @@ -27,11 +27,11 @@ $params['el'] = new Html("<div title='1/2\"'></div>");
$params['el2'] = Nette\Utils\Html::el('span', ['title' => '/"'])->setText('foo');

Assert::matchFile(
__DIR__ . '/expected/macros.general.xhtml.phtml',
__DIR__ . '/expected/general.xhtml.phtml',
$latte->compile(__DIR__ . '/templates/general.latte')
);
Assert::matchFile(
__DIR__ . '/expected/macros.general.xhtml.html',
__DIR__ . '/expected/general.xhtml.html',
$latte->renderToString(
__DIR__ . '/templates/general.latte',
$params
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/Latte/CoreMacros.if2.phpt → tests/tags/if2.phpt
Expand Up @@ -56,7 +56,7 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.if2.phtml',
__DIR__ . '/expected/if2.phtml',
$latte->compile($template)
);

Expand Down
Expand Up @@ -42,7 +42,7 @@ $template = <<<'EOD'
EOD;

Assert::matchFile(
__DIR__ . '/expected/CoreMacros.ifchanged.phtml',
__DIR__ . '/expected/ifchanged.phtml',
$latte->compile($template)
);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -31,7 +31,7 @@ $latte->setLoader(new Latte\Loaders\StringLoader([
]));

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.import.phtml',
__DIR__ . '/expected/import.phtml',
$latte->compile('main')
);
Assert::match(
Expand Down
File renamed without changes.
Expand Up @@ -55,6 +55,6 @@ Assert::error(function () use ($latte) {
}, PHP_VERSION_ID < 80000 ? E_NOTICE : E_WARNING, 'Undefined variable%a%');

Assert::matchFile(
__DIR__ . '/expected/BlockMacros.include.block.from.phtml',
__DIR__ . '/expected/include.block.from.phtml',
$latte->compile('main5')
);
File renamed without changes.
File renamed without changes.

0 comments on commit 8a98191

Please sign in to comment.