Skip to content

Commit 7f38d7d

Browse files
author
Emmanuel ROECKER
committed
add new functionnal test to getsummary
1 parent ebc8927 commit 7f38d7d

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

tests/GlHtmlTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ public function testRecursiveHtml()
7272
$this->assertEquals(1, $summary[3]->getLevel());
7373
}
7474

75+
public function testRecursiveHtml2()
76+
{
77+
$html = file_get_contents(__DIR__ . '/testsummary.html');
78+
79+
$dom = new GlHtml($html);
80+
$summary = $dom->getSummary();
81+
82+
$this->assertEquals("Compatibilité", $summary[10]->getNode()->getText());
83+
$this->assertEquals(2, $summary[10]->getLevel());
84+
}
85+
7586
public function testDiv()
7687
{
7788
$html = <<<EOD

tests/testsummary.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<head>
3+
4+
</head>
5+
<body>
6+
<h2>Présentation</h2>
7+
<div>contenu du chapitre 1</div>
8+
<h2>Description</h2>
9+
<div>contenu du descriptif</div>
10+
<h2>Code</h2>
11+
<div>contenu du code</div>
12+
<h3>Initialisation</h3>
13+
<div>init</div>
14+
<h3>Affichage des images</h3>
15+
<div>text1</div>
16+
<h4>Etape 1</h4>
17+
<h4>Etape 2</h4>
18+
<h4>Etape 3</h4>
19+
<h4>Etape 4</h4>
20+
<h4>Etape 5</h4>
21+
<h2>Compatibilité</h2>
22+
<div>text2</div>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)