-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #120 from carbontwelve/issue-118-test-kernel-plates
Issue 118 test kernel plates
- Loading branch information
Showing
7 changed files
with
98 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Tapestry\Tests; | ||
|
||
use Symfony\Component\Finder\SplFileInfo; | ||
use Tapestry\Entities\ContentType; | ||
use Tapestry\Entities\File; | ||
use Tapestry\Modules\ContentTypes\ContentTypeFactory; | ||
|
||
class KernelTest extends CommandTestBase | ||
{ | ||
public function testSiteKernelLoading() | ||
{ | ||
$this->copyDirectory('assets/build_test_28/src', '_tmp'); | ||
$output = $this->runCommand('build', '--quiet'); | ||
|
||
$this->assertEquals('', trim($output->getDisplay())); | ||
$this->assertEquals(0, $output->getStatusCode()); | ||
|
||
$this->assertFileEquals( | ||
__DIR__.'/assets/build_test_28/check/index.html', | ||
__DIR__.'/_tmp/build_local/index.html', | ||
'', | ||
true | ||
); | ||
} | ||
} |
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 @@ | ||
hello world! |
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,6 @@ | ||
<?php | ||
|
||
return [ | ||
'debug' => false, | ||
'kernel' => \SiteTwentyEight\Kernel::class, | ||
]; |
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,45 @@ | ||
<?php | ||
|
||
namespace SiteTwentyEight; | ||
|
||
use Tapestry\Modules\Kernel\KernelInterface; | ||
use Tapestry\Plates\Engine; | ||
use Tapestry\Tapestry; | ||
use TapestryCloud\Lib\TestPlatesExtension; | ||
|
||
class Kernel implements KernelInterface | ||
{ | ||
/** | ||
* @var Tapestry | ||
*/ | ||
private $tapestry; | ||
|
||
public function __construct() | ||
{ | ||
$this->tapestry = Tapestry::getInstance(); | ||
} | ||
|
||
/** | ||
* This method is executed by Tapestry when the Kernel is registered. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
include (__DIR__ . '/lib/TestPlatesExtension.php'); | ||
|
||
/** @var Engine $engine */ | ||
$engine = $this->tapestry->getContainer()->get(Engine::class); | ||
$engine->loadExtension($this->tapestry->getContainer()->get(TestPlatesExtension::class)); | ||
} | ||
|
||
/** | ||
* This method of executed by Tapestry as part of the build process. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// TODO: Implement boot() method. | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/assets/build_test_28/src/lib/TestPlatesExtension.php
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,17 @@ | ||
<?php namespace TapestryCloud\Lib; | ||
|
||
use League\Plates\Engine; | ||
use League\Plates\Extension\ExtensionInterface; | ||
|
||
class TestPlatesExtension implements ExtensionInterface | ||
{ | ||
public function register(Engine $engine) | ||
{ | ||
$engine->registerFunction('test', [$this, 'test']); | ||
} | ||
|
||
public function test() | ||
{ | ||
return 'hello world!'; | ||
} | ||
} |
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 @@ | ||
<?= $this->test() ?> |