speedmax / h2o-php

A beautiful template engine for PHP in Django style

This URL has Read+Write access

Jeff Long (author)
Sat Jun 06 18:39:57 -0700 2009
speedmax (committer)
Mon Aug 03 09:29:44 -0700 2009
h2o-php / spec / include_spec.php
100644 33 lines (29 sloc) 1.163 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
<?php
require_once 'spec_helper.php';
 
class Describe_include_tag extends SimpleSpec {
    function prepare() {
        $this->option = array('loader' => hash_loader(array(
            'page.html' =>
                "{% include '_header.html' %}{% block body %}layout text{% endblock %}{% include '_footer.html' %} ",
            '_menu.html' =>
                "<div id='menu'>page menu</div>",
            '_header.html' =>
                '<div id="header">{% include "_menu.html" %}</div>',
            '_footer.html' =>
                '<div id="footer">Page footer</div>'
        )));
    }
    
    function should_include_SubTemplate() {
        $h2o = new H2o('_header.html', $this->option);
        $result = $h2o->render();
        expects($result)->should_match('/page menu/');
    }
    
    function should_be_able_to_include_in_nested_fashion() {
        $h2o = new H2o('page.html', $this->option);
        $result = $h2o->render();
        expects($result)->should_match('/layout text/');
        expects($result)->should_match('/Page footer/');
        expects($result)->should_match('/page menu/');
    }
}
 
?>