UlTest::largeDocument()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 3 Features 0
Metric Value
c 3
b 3
f 0
dl 0
loc 22
rs 9.2
cc 3
eloc 14
nc 4
nop 1
1
<?php
2
3
use hemio\html\Str;
4
use hemio\html\Document;
5
use hemio\html\P;
6
use hemio\html\Ul;
7
use hemio\html\Li;
8
9
class UlTest extends Helpers
10
{
11
12
    /**
13
     * @param integer $n
14
     */
15
    private function largeDocument($n)
16
    {
17
        $doc  = new Document(new Str('My Title'));
18
        $html = $doc->getHtml();
19
        $body = $html->getBody();
20
21
22
        for ($i = 0; $i < $n; $i++) {
23
            $p = new P;
24
            $p->addChild(new Str('test'));
25
            $body->addChild($p);
26
        }
27
28
        for ($i = 0; $i < $n; $i++) {
29
            $ul = new Ul();
30
            $li = $ul->addChild(new Li);
31
            $li->addChild(new Str('test'));
32
            $body->addChild($ul);
33
        }
34
35
        return $doc;
36
    }
37
38
    public function test100()
39
    {
40
        $doc = $this->largeDocument(100);
41
42
        $this->_assertEqualsXmlFile($doc, 'ul100.html');
43
    }
44
45
    public function test2000()
46
    {
47
        $doc = $this->largeDocument(2000);
48
49
        $this->_assertEqualsXmlFile($doc, 'ul2000.html');
50
    }
51
}
52