@@ -5,13 +5,19 @@ final class editHtmldocTest extends \PHPUnit\Framework\TestCase {
55
66 public function testCanAppendHtml () {
77 $ obj = new htmldoc ();
8- $ obj ->load ('<h1>Appended</h1> ' );
8+ $ obj ->load ('Data to <span>append</span> here ' );
99 $ tests = [
1010 [
1111 'input ' => '<!DOCTYPE html><html><body></body></html> ' ,
1212 'find ' => 'body ' ,
13- 'append ' => '<h1>Appended</h1> ' ,
14- 'output ' => '<!DOCTYPE html><html><body><h1>Appended</h1></body></html> ' ,
13+ 'append ' => 'Data to <span>append</span> here ' ,
14+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>append</span> here</body></html> ' ,
15+ ],
16+ [
17+ 'input ' => '<!DOCTYPE html><html><body></body></html> ' ,
18+ 'find ' => 'body ' ,
19+ 'append ' => $ obj ,
20+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>append</span> here</body></html> ' ,
1521 ],
1622 [
1723 'input ' => '<ul><li></li><li></li><li></li><li></li></ul> ' ,
@@ -31,12 +37,6 @@ public function testCanAppendHtml() {
3137 'append ' => '<h3>Appended</h3><p>Test <span>this</span></p> ' ,
3238 'output ' => '<div><div><h3>Appended</h3><p>Test <span>this</span></p></div><h3>Appended</h3><p>Test <span>this</span></p></div> ' ,
3339 ],
34- [
35- 'input ' => '<!DOCTYPE html><html><body></body></html> ' ,
36- 'find ' => 'body ' ,
37- 'append ' => $ obj ,
38- 'output ' => '<!DOCTYPE html><html><body><h1>Appended</h1></body></html> ' ,
39- ],
4040 ];
4141
4242 $ doc = new htmldoc ();
@@ -49,19 +49,19 @@ public function testCanAppendHtml() {
4949
5050 public function testCanPrependHtml () {
5151 $ obj = new htmldoc ();
52- $ obj ->load ('<h1>Prepended</h1> ' );
52+ $ obj ->load ('Data to <span>prepend</span> here ' );
5353 $ tests = [
5454 [
5555 'input ' => '<!DOCTYPE html><html><body></body></html> ' ,
5656 'find ' => 'body ' ,
57- 'prepend ' => '<h1>Prepended</h1> ' ,
58- 'output ' => '<!DOCTYPE html><html><body><h1>Prepended</h1> </body></html> ' ,
57+ 'prepend ' => 'Data to <span>prepend</span> here ' ,
58+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>prepend</span> here </body></html> ' ,
5959 ],
6060 [
6161 'input ' => '<!DOCTYPE html><html><body></body></html> ' ,
6262 'find ' => 'body ' ,
6363 'prepend ' => $ obj ,
64- 'output ' => '<!DOCTYPE html><html><body><h1>Prepended</h1> </body></html> ' ,
64+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>prepend</span> here </body></html> ' ,
6565 ],
6666 [
6767 'input ' => '<ul><li></li><li></li><li></li><li></li></ul> ' ,
@@ -92,19 +92,19 @@ public function testCanPrependHtml() {
9292
9393 public function testCanInserHtmlBefore () {
9494 $ obj = new htmldoc ();
95- $ obj ->load ('<h1>Insert Before</h1> ' );
95+ $ obj ->load ('Data to <span>insert</span> before ' );
9696 $ tests = [
9797 [
9898 'input ' => '<!DOCTYPE html><html><body><p>Test</p></body></html> ' ,
9999 'find ' => 'p ' ,
100- 'before ' => '<h1>Insert Before</h1> ' ,
101- 'output ' => '<!DOCTYPE html><html><body><h1>Insert Before</h1> <p>Test</p></body></html> ' ,
100+ 'before ' => 'Data to <span>insert</span> before ' ,
101+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>insert</span> before <p>Test</p></body></html> ' ,
102102 ],
103103 [
104104 'input ' => '<!DOCTYPE html><html><body><p>Test</p></body></html> ' ,
105105 'find ' => 'p ' ,
106106 'before ' => $ obj ,
107- 'output ' => '<!DOCTYPE html><html><body><h1>Insert Before</h1> <p>Test</p></body></html> ' ,
107+ 'output ' => '<!DOCTYPE html><html><body>Data to <span>insert</span> before <p>Test</p></body></html> ' ,
108108 ],
109109 [
110110 'input ' => '<div><p>Test</p><p>Test</p><p>Test</p></div> ' ,
@@ -135,19 +135,19 @@ public function testCanInserHtmlBefore() {
135135
136136 public function testCanInserHtmlAfter () {
137137 $ obj = new htmldoc ();
138- $ obj ->load ('<h1>Insert After</h1> ' );
138+ $ obj ->load ('Data to <span>insert</span> after ' );
139139 $ tests = [
140140 [
141141 'input ' => '<!DOCTYPE html><html><body><p>Test</p></body></html> ' ,
142142 'find ' => 'p ' ,
143- 'after ' => '<h1>Insert After</h1> ' ,
144- 'output ' => '<!DOCTYPE html><html><body><p>Test</p><h1>Insert After</h1> </body></html> ' ,
143+ 'after ' => 'Data to <span>insert</span> after ' ,
144+ 'output ' => '<!DOCTYPE html><html><body><p>Test</p>Data to <span>insert</span> after </body></html> ' ,
145145 ],
146146 [
147147 'input ' => '<!DOCTYPE html><html><body><p>Test</p></body></html> ' ,
148148 'find ' => 'p ' ,
149149 'after ' => $ obj ,
150- 'output ' => '<!DOCTYPE html><html><body><p>Test</p><h1>Insert After</h1> </body></html> ' ,
150+ 'output ' => '<!DOCTYPE html><html><body><p>Test</p>Data to <span>insert</span> after </body></html> ' ,
151151 ],
152152 [
153153 'input ' => '<div><p>Test</p><p>Test</p><p>Test</p></div> ' ,
0 commit comments