Skip to content

Commit 71573ae

Browse files
author
Bauffman
committed
Add test for compiling text tokens.
1 parent b5e8ca3 commit 71573ae

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

Tests/CompilerTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Spoon Library.
5+
*
6+
* (c) Davy Hellemans <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the license
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Spoon\Template\Tests;
13+
use Spoon\Template\Autoloader;
14+
use Spoon\Template\Environment;
15+
use Spoon\Template\Template;
16+
use Spoon\Template\Compiler;
17+
18+
require_once realpath(dirname(__FILE__) . '/../') . '/Autoloader.php';
19+
require_once 'PHPUnit/Framework/TestCase.php';
20+
21+
class CompilerTest extends \PHPUnit_Framework_TestCase
22+
{
23+
protected $path;
24+
25+
/**
26+
* @var Spoon\Template\Template
27+
*/
28+
protected $template;
29+
30+
protected function setUp()
31+
{
32+
Autoloader::register();
33+
$this->template = new Template(
34+
new Environment(
35+
array(
36+
'cache' => dirname(__FILE__) . '/cache'
37+
)
38+
)
39+
);
40+
$this->path = dirname(__FILE__) . '/templates';
41+
}
42+
43+
protected function tearDown()
44+
{
45+
$this->template = null;
46+
}
47+
48+
public function testCompileTextToken()
49+
{
50+
$compiler = new Compiler($this->template, $this->path . '/text_token.tpl');
51+
$compiler->write();
52+
$this->assertTrue(true);
53+
}
54+
}

Tests/templates/text_token.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Foobar is an expression that's often used as
2+
dummy content. This to ensure people know that
3+
this is test content and to avoid funky shizzle.

0 commit comments

Comments
 (0)