getBodyDecorated() public method

public getBodyDecorated ( )
Esempio n. 1
0
 public function testConstructor()
 {
     $document = new Document(new SplFileInfo(__FILE__, '.', '.'));
     $this->assertSame(file_get_contents(__FILE__), $document->getBody());
     $this->assertSame(file_get_contents(__FILE__), $document->getBodyDecorated());
     $this->assertSame('DocumentTest.php', $document->getPath());
 }
Esempio n. 2
0
    /**
     * @dataProvider getPostRenderWithLayoutTests
     */
    public function testPostRenderWithLayout($layout)
    {
        $document = new Document();
        $document->setBody('Hello {{ name }}');
        $document->setLayout($layout);
        $document->setVars(array('key' => 'value', 'currentPath' => 'should not appear'));
        $template = <<<EOL
"{{ carew.document.body }}"
"{{ carew.relativeRoot }}"
"{{ carew.currentPath }}"
"{{ carew.extra.foo }}"
"{{ carew.extra.key }}"
EOL;
        $this->twigLoader->setTemplate('default.html.twig', $template);
        $event = new CarewEvent(array($document));
        $this->getTwigGlobals()->fromArray(array('foo' => 'bar', 'relativeRoot' => 'should not appear'));
        $this->twigListenner->postRender($event);
        $expected = <<<EOL
"Hello {{ name }}"
"."
""
"bar"
"value"
EOL;
        $this->assertSame($expected, $document->getBodyDecorated());
    }
Esempio n. 3
0
 public function write(Document $document, $webDir)
 {
     $target = $webDir . '/' . $document->getPath();
     $this->filesystem->mkdir(dirname($target));
     file_put_contents($target, $document->getBodyDecorated());
 }