@@ -56,6 +56,92 @@ public function testGettingNoOption()
5656 $ this ->assertEquals (null , $ options ->get ('doesnotexist ' ));
5757 }
5858
59+ public function testSetters () {
60+ $ options = new Options ();
61+
62+ $ options ->setOptions ([
63+ 'whitespaceTextNode ' => false ,
64+ 'strict ' => false ,
65+ 'enforceEncoding ' => null ,
66+ 'cleanupInput ' => false ,
67+ 'removeScripts ' => false ,
68+ 'removeStyles ' => false ,
69+ 'preserveLineBreaks ' => false ,
70+ 'removeDoubleSpace ' => false ,
71+ 'removeSmartyScripts ' => false ,
72+ 'depthFirstSearch ' => false ,
73+ 'htmlSpecialCharsDecode ' => false ,
74+ ]);
75+
76+ $ options ->setWhitespaceTextNode (true );
77+ $ this ->assertTrue ($ options ->get ('whitespaceTextNode ' ));
78+
79+ $ options ->setStrict (true );
80+ $ this ->assertTrue ($ options ->get ('strict ' ));
81+
82+ $ options ->setEnforceEncoding ("utf8 " );
83+ $ this ->assertEquals ("utf8 " , $ options ->get ('enforceEncoding ' ));
84+
85+ $ options ->setCleanupInput (true );
86+ $ this ->assertTrue ($ options ->get ('cleanupInput ' ));
87+
88+ $ options ->setRemoveScripts (true );
89+ $ this ->assertTrue ($ options ->get ('removeScripts ' ));
90+
91+ $ options ->setRemoveStyles (true );
92+ $ this ->assertTrue ($ options ->get ('removeStyles ' ));
93+
94+ $ options ->setPreserveLineBreaks (true );
95+ $ this ->assertTrue ($ options ->get ('preserveLineBreaks ' ));
96+
97+ $ options ->setRemoveDoubleSpace (true );
98+ $ this ->assertTrue ($ options ->get ('removeDoubleSpace ' ));
99+
100+ $ options ->setRemoveSmartyScripts (true );
101+ $ this ->assertTrue ($ options ->get ('removeSmartyScripts ' ));
102+
103+ $ options ->setDepthFirstSearch (true );
104+ $ this ->assertTrue ($ options ->get ('depthFirstSearch ' ));
105+
106+ $ options ->setHtmlSpecialCharsDecode (true );
107+ $ this ->assertTrue ($ options ->get ('htmlSpecialCharsDecode ' ));
108+
109+ // now reset to false
110+
111+ $ options ->setWhitespaceTextNode (false );
112+ $ this ->assertFalse ($ options ->get ('whitespaceTextNode ' ));
113+
114+ $ options ->setStrict (false );
115+ $ this ->assertFalse ($ options ->get ('strict ' ));
116+
117+ $ options ->setEnforceEncoding (null );
118+ $ this ->assertNull ($ options ->get ('enforceEncoding ' ));
119+
120+ $ options ->setCleanupInput (false );
121+ $ this ->assertFalse ($ options ->get ('cleanupInput ' ));
122+
123+ $ options ->setRemoveScripts (false );
124+ $ this ->assertFalse ($ options ->get ('removeScripts ' ));
125+
126+ $ options ->setRemoveStyles (false );
127+ $ this ->assertFalse ($ options ->get ('removeStyles ' ));
128+
129+ $ options ->setPreserveLineBreaks (false );
130+ $ this ->assertFalse ($ options ->get ('preserveLineBreaks ' ));
131+
132+ $ options ->setRemoveDoubleSpace (false );
133+ $ this ->assertFalse ($ options ->get ('removeDoubleSpace ' ));
134+
135+ $ options ->setRemoveSmartyScripts (false );
136+ $ this ->assertFalse ($ options ->get ('removeSmartyScripts ' ));
137+
138+ $ options ->setDepthFirstSearch (false );
139+ $ this ->assertFalse ($ options ->get ('depthFirstSearch ' ));
140+
141+ $ options ->setHtmlSpecialCharsDecode (false );
142+ $ this ->assertFalse ($ options ->get ('htmlSpecialCharsDecode ' ));
143+ }
144+
59145 public function testUnknownOptionDom () {
60146 $ dom = new Dom ;
61147 $ dom ->setOptions ([
0 commit comments