@@ -40,5 +40,91 @@ public function testGettingNoOption()
4040 $ options = new Options ;
4141 $ this ->assertEquals (null , $ options ->get ('doesnotexist ' ));
4242 }
43+
44+ public function testSetters () {
45+ $ options = new Options ();
46+
47+ $ options ->setOptions ([
48+ 'whitespaceTextNode ' => false ,
49+ 'strict ' => false ,
50+ 'enforceEncoding ' => null ,
51+ 'cleanupInput ' => false ,
52+ 'removeScripts ' => false ,
53+ 'removeStyles ' => false ,
54+ 'preserveLineBreaks ' => false ,
55+ 'removeDoubleSpace ' => false ,
56+ 'removeSmartyScripts ' => false ,
57+ 'depthFirstSearch ' => false ,
58+ 'htmlSpecialCharsDecode ' => false ,
59+ ]);
60+
61+ $ options ->setWhitespaceTextNode (true );
62+ $ this ->assertTrue ($ options ->get ('whitespaceTextNode ' ));
63+
64+ $ options ->setStrict (true );
65+ $ this ->assertTrue ($ options ->get ('strict ' ));
66+
67+ $ options ->setEnforceEncoding ("utf8 " );
68+ $ this ->assertEquals ("utf8 " , $ options ->get ('enforceEncoding ' ));
69+
70+ $ options ->setCleanupInput (true );
71+ $ this ->assertTrue ($ options ->get ('cleanupInput ' ));
72+
73+ $ options ->setRemoveScripts (true );
74+ $ this ->assertTrue ($ options ->get ('removeScripts ' ));
75+
76+ $ options ->setRemoveStyles (true );
77+ $ this ->assertTrue ($ options ->get ('removeStyles ' ));
78+
79+ $ options ->setPreserveLineBreaks (true );
80+ $ this ->assertTrue ($ options ->get ('preserveLineBreaks ' ));
81+
82+ $ options ->setRemoveDoubleSpace (true );
83+ $ this ->assertTrue ($ options ->get ('removeDoubleSpace ' ));
84+
85+ $ options ->setRemoveSmartyScripts (true );
86+ $ this ->assertTrue ($ options ->get ('removeSmartyScripts ' ));
87+
88+ $ options ->setDepthFirstSearch (true );
89+ $ this ->assertTrue ($ options ->get ('depthFirstSearch ' ));
90+
91+ $ options ->setHtmlSpecialCharsDecode (true );
92+ $ this ->assertTrue ($ options ->get ('htmlSpecialCharsDecode ' ));
93+
94+ // now reset to false
95+
96+ $ options ->setWhitespaceTextNode (false );
97+ $ this ->assertFalse ($ options ->get ('whitespaceTextNode ' ));
98+
99+ $ options ->setStrict (false );
100+ $ this ->assertFalse ($ options ->get ('strict ' ));
101+
102+ $ options ->setEnforceEncoding (null );
103+ $ this ->assertNull ($ options ->get ('enforceEncoding ' ));
104+
105+ $ options ->setCleanupInput (false );
106+ $ this ->assertFalse ($ options ->get ('cleanupInput ' ));
107+
108+ $ options ->setRemoveScripts (false );
109+ $ this ->assertFalse ($ options ->get ('removeScripts ' ));
110+
111+ $ options ->setRemoveStyles (false );
112+ $ this ->assertFalse ($ options ->get ('removeStyles ' ));
113+
114+ $ options ->setPreserveLineBreaks (false );
115+ $ this ->assertFalse ($ options ->get ('preserveLineBreaks ' ));
116+
117+ $ options ->setRemoveDoubleSpace (false );
118+ $ this ->assertFalse ($ options ->get ('removeDoubleSpace ' ));
119+
120+ $ options ->setRemoveSmartyScripts (false );
121+ $ this ->assertFalse ($ options ->get ('removeSmartyScripts ' ));
122+
123+ $ options ->setDepthFirstSearch (false );
124+ $ this ->assertFalse ($ options ->get ('depthFirstSearch ' ));
125+
126+ $ options ->setHtmlSpecialCharsDecode (false );
127+ $ this ->assertFalse ($ options ->get ('htmlSpecialCharsDecode ' ));
128+ }
43129}
44130
0 commit comments