Completed
Push — master ( 974133...f3d891 )
by Marc
05:38
created

XmlRendererTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 1
c 4
b 0
f 2
lcom 0
cbo 1
dl 0
loc 47
rs 10
1
<?php
2
3
namespace Kaloa\Tests;
4
5
use PHPUnit_Framework_TestCase;
6
use Kaloa\Renderer\Config;
7
use Kaloa\Renderer\Factory;
8
9
class XmlRendererTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testIntegrity()
12
    {
13
        // Environment
14
        $contentToRender = file_get_contents(__DIR__ . '/examples/xml/mvc.xml');
15
        $resourceBasePath = __DIR__ . '/examples/xml/mvc';
16
17
        #$contentToRender = file_get_contents('./examples/xml/kaloa_renderer.xml');
18
        #$resourceBasePath = './examples/xml/kaloa_renderer';
19
20
        $config = new Config($resourceBasePath);
21
22
        $renderer = Factory::createRenderer('xml', $config);
23
24
        /* Simulate run of preSave hook */
25
        $contentToRender = $renderer->firePreSaveEvent($contentToRender);
26
27
        $renderer->render($contentToRender);
28
29
        $ctr = '<k:toc/>
30
            <h2>Test</h2>
31
            <h3>Foo</h3>
32
            <img src="test.png" />
33
            <img src="http://test.png" />
34
            <a href="foo">link</a>
35
            <a href="https://example.org">link</a>
36
            <listing>1+1=2</listing>
37
            <h4>Bar</h4>
38
            <youtube id="dQw4w9WgXcQ" />
39
            <p>Test.<footnote>bla</footnote></p>
40
            <h2>Quz</h2>
41
            <p>Qux.<footnote><strong>Test</strong></footnote></p>
42
            <p>Qix.<footnote name="x">Qix</footnote></p>
43
            <p>Qaz.<footnote name="x">Qaz</footnote></p>
44
            <p>Quz.<footnote name="x">Quz</footnote></p>
45
            <p>Quz.<footnote name="fn:5">Quz</footnote></p>
46
            <p>Quz.<footnote name="fn:6">Quz</footnote></p>
47
            <p>Quz.<footnote name="fn:7">Quz</footnote></p>
48
            <h3>Foo</h3>
49
            <h4>Bar</h4>';
50
51
        $ctr = $renderer->firePreSaveEvent($ctr);
52
53
        $renderer->render($ctr);
54
    }
55
}
56