setBody() 공개 메소드

public setBody ( $body )
예제 #1
0
파일: TocTest.php 프로젝트: carew/carew
 public function testOnDocumentDoesNotLinkWithDoubleQuote()
 {
     $document = new Document();
     $document->setPath('index.html');
     $body = '<a href="https://google.com">"google.com"</a>';
     $document->setBody($body);
     $event = new CarewEvent($document);
     $toc = new Toc();
     $toc->onDocument($event);
     $this->assertSame($body, $document->getBody());
 }
예제 #2
0
 /**
  * @expectedException LogicException
  * @expectedExceptionMessage Could not process "Body": "Exception message".
  */
 public function testProcessDocumentDecorationWithExceptionWithoutFile()
 {
     $this->eventDispatcher->addListener(Events::DOCUMENT_DECORATION, function () {
         throw new \Exception('Exception message');
     });
     $document = new Document();
     $document->setBody('Body');
     $this->processor->processDocumentDecoration($document);
 }
예제 #3
0
파일: TwigTest.php 프로젝트: carew/carew
    /**
     * @expectedException RuntimeException
     * @expectedExceptionMessage Unexpected "}" in a string template line 1.
     */
    public function testPreRenderThrowExceptionOnRender()
    {
        $document = new Document();
        $document->setLayout('default');
        $document->setBody(<<<EOL
Hello

{{ foobar }}

{% set text = '{{ foobar }' %}

{{ template_from_string(text) }}
EOL
);
        $event = new CarewEvent(array($document));
        $this->twigListenner->preRender($event);
        $this->assertSame('foobar', $document->getBody());
    }