-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Presenter: support for templates without /template folder
- Loading branch information
Showing
6 changed files
with
104 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ use Tester\Assert; | |
|
||
require __DIR__ . '/../bootstrap.php'; | ||
require __DIR__ . '/one/APresenter.php'; | ||
require __DIR__ . '/two/BPresenter.php'; | ||
require __DIR__ . '/one/sub/BPresenter.php'; | ||
require __DIR__ . '/two/CPresenter.php'; | ||
|
||
|
||
test('with subdir templates', function () { | ||
|
@@ -27,14 +28,26 @@ test('with subdir templates', function () { | |
}); | ||
|
||
|
||
test('without subdir templates', function () { | ||
test('with parent-dir templates', function () { | ||
$presenter = new BPresenter; | ||
$presenter->setParent(null, 'One'); | ||
$presenter->setLayout('my'); | ||
|
||
Assert::same([ | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@my.latte', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/[email protected]', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@my.latte', | ||
], $presenter->formatLayoutTemplateFiles()); | ||
}); | ||
|
||
|
||
test('without subdir templates', function () { | ||
$presenter = new CPresenter; | ||
$presenter->setParent(null, 'Two'); | ||
|
||
Assert::same([ | ||
__DIR__ . '/templates/Two/@layout.latte', | ||
__DIR__ . '/templates/[email protected]', | ||
__DIR__ . '/templates/@layout.latte', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'two/@layout.latte', | ||
__DIR__ . '/@layout.latte', | ||
], $presenter->formatLayoutTemplateFiles()); | ||
}); | ||
|
||
|
@@ -53,16 +66,29 @@ test('with module & subdir templates', function () { | |
}); | ||
|
||
|
||
test('with module & without subdir templates', function () { | ||
test('with module & parent-dir templates', function () { | ||
$presenter = new BPresenter; | ||
$presenter->setParent(null, 'Module:SubModule:Two'); | ||
$presenter->setParent(null, 'Module:SubModule:One'); | ||
|
||
Assert::same([ | ||
__DIR__ . '/templates/Two/@layout.latte', | ||
__DIR__ . '/templates/[email protected]', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@layout.latte', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/[email protected]', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@layout.latte', | ||
__DIR__ . '/templates/@layout.latte', | ||
dirname(__DIR__) . '/templates/@layout.latte', | ||
dirname(__DIR__, 2) . '/templates/@layout.latte', | ||
], $presenter->formatLayoutTemplateFiles()); | ||
}); | ||
|
||
|
||
test('with module & without subdir templates', function () { | ||
$presenter = new CPresenter; | ||
$presenter->setParent(null, 'Module:SubModule:Two'); | ||
|
||
Assert::same([ | ||
__DIR__ . DIRECTORY_SEPARATOR . 'two/@layout.latte', | ||
__DIR__ . '/@layout.latte', | ||
dirname(__DIR__) . '/@layout.latte', | ||
dirname(__DIR__, 2) . '/@layout.latte', | ||
], $presenter->formatLayoutTemplateFiles()); | ||
}); | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
class BPresenter extends Nette\Application\UI\Presenter | ||
{ | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
class CPresenter extends Nette\Application\UI\Presenter | ||
{ | ||
} |