File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 11<?php
22namespace PHPHtmlParser \Dom ;
33
4- use PHPHtmlParser \Exceptions \UnkownChildTypeException ;
4+ use PHPHtmlParser \Exceptions \UnknownChildTypeException ;
55use PHPHtmlParser \Exceptions \ChildNotFoundException ;
66
77class HtmlNode extends AbstractNode {
Original file line number Diff line number Diff line change 11<?php
22namespace PHPHtmlParser \Exceptions ;
33
4- final class UnkownChildTypeException extends \Exception {}
4+ final class UnknownChildTypeException extends \Exception {}
Original file line number Diff line number Diff line change 22
33use PHPHtmlParser \Dom \HtmlNode ;
44use PHPHtmlParser \Dom \TextNode ;
5+ use PHPHtmlParser \Dom \MockNode ;
56use PHPHtmlParser \Dom \Tag ;
67
78class NodeHtmlTest extends PHPUnit_Framework_TestCase {
@@ -65,6 +66,39 @@ public function testInnerHtmlTwice()
6566 $ this ->assertEquals ($ inner , $ parent ->innerHtml ());
6667 }
6768
69+ /**
70+ * @expectedException PHPHtmlParser\Exceptions\UnknownChildTypeException
71+ */
72+ public function testInnerHtmlUnkownChild ()
73+ {
74+ $ div = new Tag ('div ' );
75+ $ div ->setAttributes ([
76+ 'class ' => [
77+ 'value ' => 'all ' ,
78+ 'doubleQuote ' => true ,
79+ ],
80+ ]);
81+ $ a = new Tag ('a ' );
82+ $ a ->setAttributes ([
83+ 'href ' => [
84+ 'value ' => 'http://google.com ' ,
85+ 'doubleQuote ' => false ,
86+ ],
87+ ]);
88+ $ br = new Tag ('br ' );
89+ $ br ->selfClosing ();
90+
91+ $ parent = new HtmlNode ($ div );
92+ $ childa = new HtmlNode ($ a );
93+ $ childbr = new MockNode ($ br );
94+ $ parent ->addChild ($ childa );
95+ $ parent ->addChild ($ childbr );
96+ $ childa ->addChild (new TextNode ('link ' ));
97+
98+ $ inner = $ parent ->innerHtml ();
99+ $ this ->assertEquals ($ inner , $ parent ->innerHtml ());
100+ }
101+
68102 public function testInnerHtmlMagic ()
69103 {
70104 $ parent = new HtmlNode ('div ' );
You can’t perform that action at this time.
0 commit comments