예제 #1
0
 /**
  * getBuilder() のテストです.
  * 返り値の Builder に対する変更が, グローバル Helper に適用されることを確認します.
  * 
  * @covers Peach\Markup\Html::getBuilder
  */
 public function testGetBuilder()
 {
     $builder = Html::getBuilder();
     $builder->setRenderer("html");
     $builder->setIndent(new Indent(0, "  ", Indent::LF));
     $result = Html::tag(TestUtil::getTestNode())->write();
     $this->assertSame(TestUtil::getCustomBuildResult(), $result);
 }
예제 #2
0
 /**
  * @covers Peach\Markup\DefaultContext::__construct
  * @covers Peach\Markup\DefaultContext::getResult
  */
 public function testGetResult()
 {
     $test = TestUtil::getTestNode();
     $expect1 = TestUtil::getDefaultBuildResult();
     $obj1 = $this->object;
     $obj1->handle($test);
     $this->assertSame($expect1, $obj1->getResult());
     $expect2 = TestUtil::getCustomBuildResult();
     $indent = new Indent(0, "  ", Indent::LF);
     $obj2 = new DefaultContext(SgmlRenderer::getInstance(), $indent);
     $obj2->handle($test);
     $this->assertSame($expect2, $obj2->getResult());
 }
예제 #3
0
 /**
  * Builder にセットした設定が, build 時に適用されることを確認します.
  * @todo   BreakControl が適用されるかどうかのテスト
  * @covers Peach\Markup\DefaultBuilder::createContext
  * @covers Peach\Markup\Builder::build
  */
 public function testBuild()
 {
     $builder = $this->object;
     $node = TestUtil::getTestNode();
     $this->assertSame(TestUtil::getDefaultBuildResult(), $builder->build($node));
     $builder->setIndent(new Indent(0, "  ", Indent::LF));
     $builder->setRenderer("HTML");
     $this->assertSame(TestUtil::getCustomBuildResult(), $builder->build($node));
 }