@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | private $_dangling = array(); |
19 | 19 | |
20 | 20 | |
21 | + /** |
|
22 | + * @param integer $level |
|
23 | + */ |
|
21 | 24 | private function &_getParent($level) |
22 | 25 | { |
23 | 26 | while (--$level >= 0) { |
@@ -42,6 +45,10 @@ discard block |
||
42 | 45 | return $clone->textContent; |
43 | 46 | } |
44 | 47 | |
48 | + /** |
|
49 | + * @param string $id |
|
50 | + * @param integer $level |
|
51 | + */ |
|
45 | 52 | private function &_newNode($id, $text, $level) |
46 | 53 | { |
47 | 54 | $node = array( |
@@ -62,6 +69,9 @@ discard block |
||
62 | 69 | return $node; |
63 | 70 | } |
64 | 71 | |
72 | + /** |
|
73 | + * @param DOMDocument $doc |
|
74 | + */ |
|
65 | 75 | private function _processDocument($doc) |
66 | 76 | { |
67 | 77 | $this->_tree =& $this->_newNode(self::$prefix, '', 0); |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | |
23 | 23 | public function testHtml() |
24 | 24 | { |
25 | - $tocifier = new Tocifier(file_get_contents(__DIR__ . '/test1')); |
|
25 | + $tocifier = new Tocifier(file_get_contents(__DIR__.'/test1')); |
|
26 | 26 | $this->assertEquals($tocifier->getHtml(), ''); |
27 | 27 | $this->assertTrue($tocifier->process()); |
28 | - $this->assertStringEqualsFile(__DIR__ . '/html1', $tocifier->getHtml()); |
|
28 | + $this->assertStringEqualsFile(__DIR__.'/html1', $tocifier->getHtml()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function testTOC() |
32 | 32 | { |
33 | - $tocifier = new Tocifier(file_get_contents(__DIR__ . '/test1')); |
|
33 | + $tocifier = new Tocifier(file_get_contents(__DIR__.'/test1')); |
|
34 | 34 | $this->assertEquals($tocifier->getTOC(), array()); |
35 | 35 | $this->assertTrue($tocifier->process()); |
36 | 36 | $this->assertNotNull($tocifier->getTOC()); |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | ob_start(); |
39 | 39 | $tocifier->dumpTOC(); |
40 | 40 | $returned = ob_get_clean(); |
41 | - $this->assertStringEqualsFile(__DIR__ . '/toc1', $returned); |
|
41 | + $this->assertStringEqualsFile(__DIR__.'/toc1', $returned); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function testDataHideFromTOC() |
45 | 45 | { |
46 | - $tocifier = new Tocifier(file_get_contents(__DIR__ . '/test2')); |
|
46 | + $tocifier = new Tocifier(file_get_contents(__DIR__.'/test2')); |
|
47 | 47 | $this->assertEquals($tocifier->getHtml(), ''); |
48 | 48 | $this->assertTrue($tocifier->process()); |
49 | 49 | |
50 | 50 | // Check the augmented HTML is equal to the original one |
51 | - $this->assertStringEqualsFile(__DIR__ . '/test2', $tocifier->getHtml()); |
|
51 | + $this->assertStringEqualsFile(__DIR__.'/test2', $tocifier->getHtml()); |
|
52 | 52 | |
53 | 53 | ob_start(); |
54 | 54 | $tocifier->dumpTOC(); |
@@ -8,8 +8,8 @@ |
||
8 | 8 | spl_autoload_register(function ($class) { |
9 | 9 | switch ($class) { |
10 | 10 | |
11 | - case 'Tocifier': |
|
12 | - require_once __DIR__ . '/../code/Tocifier.php'; |
|
13 | - break; |
|
11 | + case 'Tocifier': |
|
12 | + require_once __DIR__ . '/../code/Tocifier.php'; |
|
13 | + break; |
|
14 | 14 | } |
15 | 15 | }); |
@@ -5,11 +5,11 @@ |
||
5 | 5 | * phpunit --bootstrap tests/Bootstrap.php tests/ |
6 | 6 | */ |
7 | 7 | |
8 | -spl_autoload_register(function ($class) { |
|
8 | +spl_autoload_register(function($class) { |
|
9 | 9 | switch ($class) { |
10 | 10 | |
11 | 11 | case 'Tocifier': |
12 | - require_once __DIR__ . '/../code/Tocifier.php'; |
|
12 | + require_once __DIR__.'/../code/Tocifier.php'; |
|
13 | 13 | break; |
14 | 14 | } |
15 | 15 | }); |