UlTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 5
Bugs 4 Features 1
Metric Value
wmc 5
c 5
b 4
f 1
lcom 1
cbo 8
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A largeDocument() 0 22 3
A test100() 0 6 1
A test2000() 0 6 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