forked from featherforums/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatherCompilerTest.php
More file actions
46 lines (33 loc) · 1.39 KB
/
Copy pathFeatherCompilerTest.php
File metadata and controls
46 lines (33 loc) · 1.39 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
<?php
use Mockery as m;
use Feather\Presenter\Compilers\FeatherCompiler;
class FeatherCompilerTest extends TestCase {
public function testAssignmentsAreCompiled()
{
$compiler = new FeatherCompiler($this->getFiles(), __DIR__);
$this->assertEquals('<?php $foo = \'bar\'; ?>', $compiler->compileString('@assign($foo, \'bar\')'));
$this->assertEquals('<?php $foo = $bar; ?>', $compiler->compileString('@assign($foo, $bar)'));
}
public function testExtensionEventsAreCompiled()
{
$compiler = new FeatherCompiler($this->getFiles(), __DIR__);
$expected = '<?php echo Feather\Extension::fire(\'foo\'); ?>';
$this->assertEquals($expected, $compiler->compileString('@event(\'foo\')'));
}
public function testInlineErrorsAreCompiled()
{
$compiler = new FeatherCompiler($this->getFiles(), __DIR__);
$expected = '<?php echo $errors->has(\'foo\') ? view("feather::errors.inline", array("error" => $errors->first(\'foo\'))) : null; ?>';
$this->assertEquals($expected, $compiler->compileString('@error(\'foo\')'));
}
public function testErrorsAreCompiled()
{
$compiler = new FeatherCompiler($this->getFiles(), __DIR__);
$expected = '<?php echo $errors->all() ? view("feather::errors.page", array("errors" => $errors->all())) : null; ?>';
$this->assertEquals($expected, $compiler->compileString('@errors'));
}
public function getFiles()
{
return m::mock('Illuminate\Filesystem');
}
}