File tree Expand file tree Collapse file tree 3 files changed +65
-22
lines changed Expand file tree Collapse file tree 3 files changed +65
-22
lines changed Original file line number Diff line number Diff line change @@ -156,26 +156,4 @@ public function testGetElementsByClass()
156156 $ dom ->load ('<div class="all"><p>Hey bro, <a href="google.com" id="78">click here</a></div><br /> ' );
157157 $ this ->assertEquals ('<p>Hey bro, <a href="google.com" id="78">click here</a></p> ' , $ dom ->getElementsByClass ('all ' )[0 ]->innerHtml );
158158 }
159-
160- public function testConfigGlobalNoWhitespaceTextNode ()
161- {
162- $ dom = new Dom ;
163- $ dom ->setOptions ([
164- 'whitespaceTextNode ' => false ,
165- ]);
166- $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' );
167- $ this ->assertEquals ('Ya you! ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
168- }
169-
170- public function testConfigLocalOverride ()
171- {
172- $ dom = new Dom ;
173- $ dom ->setOptions ([
174- 'whitespaceTextNode ' => false ,
175- ]);
176- $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' , [
177- 'whitespaceTextNode ' => true ,
178- ]);
179- $ this ->assertEquals (' ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
180- }
181159}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use PHPHtmlParser \Dom ;
4+
5+ class WhitespaceTextNodeTest extends PHPUnit_Framework_TestCase {
6+
7+ public function testConfigGlobalNoWhitespaceTextNode ()
8+ {
9+ $ dom = new Dom ;
10+ $ dom ->setOptions ([
11+ 'whitespaceTextNode ' => false ,
12+ ]);
13+ $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' );
14+ $ this ->assertEquals ('Ya you! ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
15+ }
16+
17+ public function testConfigLocalOverride ()
18+ {
19+ $ dom = new Dom ;
20+ $ dom ->setOptions ([
21+ 'whitespaceTextNode ' => false ,
22+ ]);
23+ $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' , [
24+ 'whitespaceTextNode ' => true ,
25+ ]);
26+ $ this ->assertEquals (' ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use PHPHtmlParser \Options ;
4+
5+ class OptionsTest extends PHPUnit_Framework_TestCase {
6+
7+ public function testDefaultWhitespaceTextNode ()
8+ {
9+ $ options = new Options ;
10+
11+ $ this ->assertTrue ($ options ->whitespaceTextNode );
12+ }
13+
14+ public function testAddingOption ()
15+ {
16+ $ options = new Options ;
17+ $ options ->setOptions ([
18+ 'test ' => true ,
19+ ]);
20+
21+ $ this ->assertTrue ($ options ->test );
22+ }
23+
24+ public function testAddingOver ()
25+ {
26+ $ options = new Options ;
27+ $ options ->setOptions ([
28+ 'test ' => false ,
29+ ])->setOptions ([
30+ 'test ' => true ,
31+ 'whitespaceTextNode ' => false ,
32+ ]);
33+
34+ $ this ->assertFalse ($ options ->get ('whitespaceTextNode ' ));
35+ }
36+ }
37+
You can’t perform that action at this time.
0 commit comments