/**
     * @covers Veles\Tools\SnippetBuilder::build
     */
    public function testBuild()
    {
        $expected = <<<EOF
<!DOCTYPE html>
<html>
<head>
\t<title>Veles is a fast PHP framework</title>
</head>
<body>
\t<div id="main_wrapper">
\t\tTest complete!
\t</div>
\t<div id="footer_wrapper">
\t\tHello World!
\t</div>
</body>
</html>

EOF;
        $vars = ['a' => 'Test', 'b' => 'complete', 'c' => 'Hello'];
        $obj = new SnippetBuilder($vars);
        $path = realpath(__DIR__ . '/../Project/View/Frontend/index.phtml');
        $result = $obj->build($path);
        $msg = 'SnippetBuilder::build() returns wrong result!';
        $this->assertSame($expected, $result, $msg);
    }
Example #2
0
 /**
  * Pagination rendering
  */
 public function __toString()
 {
     $this->first_link = false;
     $this->last_link = false;
     $this->index = 1;
     if ($this->curr_page > 4) {
         $this->first_link = 1;
         $this->index = $this->curr_page - 3;
     }
     if ($this->page_nums > $this->curr_page + 3) {
         $this->last_link = $this->page_nums;
         $this->page_nums = $this->curr_page + 3;
     }
     $builder = new SnippetBuilder($this);
     return $builder->build($this->template);
 }