setBody() public method

public setBody ( $body )
Esempio n. 1
0
 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());
 }
Esempio n. 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);
 }
Esempio n. 3
0
    /**
     * @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());
    }