-
-
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.
- Loading branch information
1 parent
eb33c89
commit b7dbde8
Showing
5 changed files
with
74 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Phug; | ||
|
||
use Phug\Util\AbstractModule; | ||
use Phug\Util\ModulesContainerInterface; | ||
|
||
class CompilerModule extends AbstractModule implements CompilerModuleInterface | ||
{ | ||
public function injectCompiler(Compiler $compiler) | ||
{ | ||
return $compiler; | ||
} | ||
|
||
public function plug(ModulesContainerInterface $parent) | ||
{ | ||
parent::plug($this->injectCompiler($parent)); | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace Phug; | ||
|
||
use Phug\Util\ModuleInterface; | ||
|
||
interface CompilerModuleInterface extends ModuleInterface | ||
{ | ||
public function injectCompiler(Compiler $compiler); | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace Phug\Test; | ||
|
||
use Phug\Compiler; | ||
use Phug\CompilerModule; | ||
|
||
/** | ||
* @coversDefaultClass Phug\CompilerModule | ||
*/ | ||
class CompilerModuleTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @covers ::<public> | ||
*/ | ||
public function testModule() | ||
{ | ||
$copy = null; | ||
$module = new CompilerModule(); | ||
$module->onPlug(function ($_compiler) use (&$copy) { | ||
$copy = $_compiler; | ||
}); | ||
$compiler = new Compiler([ | ||
'modules' => [$module], | ||
]); | ||
self::assertSame($compiler, $copy); | ||
} | ||
} |