fenom/tests/cases/Fenom/ScopeTest.php

37 lines
1.2 KiB
PHP
Raw Normal View History

2013-02-20 18:12:44 +04:00
<?php
2013-06-28 11:53:53 +04:00
namespace Fenom;
2013-02-20 18:12:44 +04:00
2013-07-29 14:58:14 +04:00
class ScopeTest extends TestCase
{
public function openTag($tokenizer, $scope)
{
2013-06-28 11:53:53 +04:00
$this->assertInstanceOf('Fenom\Tokenizer', $tokenizer);
$this->assertInstanceOf('Fenom\Scope', $scope);
2013-02-20 18:12:44 +04:00
$scope["value"] = true;
return "open-tag";
}
2013-07-29 14:58:14 +04:00
public function closeTag($tokenizer, $scope)
{
2013-06-28 11:53:53 +04:00
$this->assertInstanceOf('Fenom\Tokenizer', $tokenizer);
$this->assertInstanceOf('Fenom\Scope', $scope);
2013-02-20 18:12:44 +04:00
$this->assertTrue($scope["value"]);
return "close-tag";
}
2013-07-29 14:58:14 +04:00
public function testBlock()
{
2013-06-28 11:53:53 +04:00
/*$scope = new Scope($this->fenom, new Template($this->fenom), 1, array(
2013-02-20 18:12:44 +04:00
"open" => array($this, "openTag"),
"close" => array($this, "closeTag")
), 0);
$tokenizer = new Tokenizer("1+1");
2013-02-27 20:55:08 +04:00
$this->assertSame("open-tag /*#{$scope->id}#* /", $scope->open($tokenizer));
2013-02-20 18:12:44 +04:00
$this->assertSame("close-tag", $scope->close($tokenizer));
2013-02-27 20:55:08 +04:00
$content = " some ?> content\n\nwith /*#9999999#* / many\n\tlines";
2013-02-20 18:12:44 +04:00
$scope->tpl->_body = "start <?php ".$scope->open($tokenizer)." ?>".$content;
2013-02-27 20:55:08 +04:00
$this->assertSame($content, $scope->getContent());*/
2013-07-29 14:58:14 +04:00
}
2013-02-20 18:12:44 +04:00
}