-
-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathPresenter.formatTemplateFiles.phpt
More file actions
66 lines (49 loc) · 1.72 KB
/
Presenter.formatTemplateFiles.phpt
File metadata and controls
66 lines (49 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* Test: Presenter::formatTemplateFiles.
*/
declare(strict_types=1);
use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/one/Presenter1.php';
require __DIR__ . '/two/Presenter2.php';
test(function () { // with subdir templates
$presenter = new Presenter1;
$presenter->setParent(null, 'One');
$presenter->setView('view');
Assert::same([
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/view.latte',
], $presenter->formatTemplateFiles());
});
test(function () { // without subdir templates
$presenter = new Presenter2;
$presenter->setParent(null, 'Two');
$presenter->setView('view');
Assert::same([
__DIR__ . '/templates/Two/view.latte',
__DIR__ . '/templates/Two.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'two/templates/view.latte',
], $presenter->formatTemplateFiles());
});
test(function () { // with module & subdir templates
$presenter = new Presenter1;
$presenter->setParent(null, 'Module:One');
$presenter->setView('view');
Assert::same([
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/view.latte',
], $presenter->formatTemplateFiles());
});
test(function () { // with module & without subdir templates
$presenter = new Presenter2;
$presenter->setParent(null, 'Module:Two');
$presenter->setView('view');
Assert::same([
__DIR__ . '/templates/Two/view.latte',
__DIR__ . '/templates/Two.view.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'two/templates/view.latte',
], $presenter->formatTemplateFiles());
});