fenom/tests/cases/Cytro/ScopeTest.php

33 lines
1.2 KiB
PHP
Raw Normal View History

2013-02-20 18:12:44 +04:00
<?php
2013-04-04 10:56:44 +04:00
namespace Cytro;
2013-02-20 18:12:44 +04:00
class ScopeTest extends TestCase {
public function openTag($tokenizer, $scope) {
2013-04-04 10:56:44 +04:00
$this->assertInstanceOf('Cytro\Tokenizer', $tokenizer);
$this->assertInstanceOf('Cytro\Scope', $scope);
2013-02-20 18:12:44 +04:00
$scope["value"] = true;
return "open-tag";
}
public function closeTag($tokenizer, $scope) {
2013-04-04 10:56:44 +04:00
$this->assertInstanceOf('Cytro\Tokenizer', $tokenizer);
$this->assertInstanceOf('Cytro\Scope', $scope);
2013-02-20 18:12:44 +04:00
$this->assertTrue($scope["value"]);
return "close-tag";
}
public function testBlock() {
2013-04-28 18:08:57 +04:00
/*$scope = new Scope($this->cytro, new Template($this->cytro), 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-02-20 18:12:44 +04:00
}
}