@@ -838,18 +838,19 @@ public function testSetCheckboxWithValueZero()
838838 * @runInSeparateProcess
839839 * @preserveGlobalState disabled
840840 */
841- public function testSetRadio ()
841+ public function testSetRadioFromSessionOldInput ()
842842 {
843843 $ _SESSION = [
844844 '_ci_old_input ' => [
845845 'post ' => [
846- 'foo ' => 'bar ' ,
846+ 'foo ' => '< bar> ' ,
847847 ],
848848 ],
849849 ];
850850
851- $ this ->assertSame (' checked="checked" ' , set_radio ('foo ' , 'bar ' ));
851+ $ this ->assertSame (' checked="checked" ' , set_radio ('foo ' , '< bar> ' ));
852852 $ this ->assertSame ('' , set_radio ('foo ' , 'baz ' ));
853+
853854 unset($ _SESSION ['_ci_old_input ' ]);
854855 }
855856
@@ -860,9 +861,10 @@ public function testSetRadio()
860861 public function testSetRadioFromPost ()
861862 {
862863 $ _POST ['bar ' ] = 'baz ' ;
864+
863865 $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , 'baz ' ));
864866 $ this ->assertSame ('' , set_radio ('bar ' , 'boop ' ));
865- $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , 'boop ' , true ));
867+ $ this ->assertSame ('' , set_radio ('bar ' , 'boop ' , true ));
866868 }
867869
868870 /**
@@ -871,15 +873,17 @@ public function testSetRadioFromPost()
871873 */
872874 public function testSetRadioFromPostWithValueZero ()
873875 {
874- $ _POST ['bar ' ] = 0 ;
876+ $ _POST ['bar ' ] = '0 ' ;
877+
875878 $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , '0 ' ));
876879 $ this ->assertSame ('' , set_radio ('bar ' , 'boop ' ));
877880
878881 $ _POST = [];
882+
879883 $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , '0 ' , true ));
880884 }
881885
882- public function testSetRadioFromPostArray ()
886+ public function testSetRadioFromSessionOldInputPostArray ()
883887 {
884888 $ _SESSION = [
885889 '_ci_old_input ' => [
@@ -891,11 +895,12 @@ public function testSetRadioFromPostArray()
891895 ],
892896 ],
893897 ];
898+
894899 $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , 'boop ' ));
895900 $ this ->assertSame ('' , set_radio ('bar ' , 'baz ' ));
896901 }
897902
898- public function testSetRadioFromPostArrayWithValueZero ()
903+ public function testSetRadioFromSessionOldInputPostArrayWithValueZero ()
899904 {
900905 $ _SESSION = [
901906 '_ci_old_input ' => [
@@ -907,12 +912,16 @@ public function testSetRadioFromPostArrayWithValueZero()
907912 ],
908913 ],
909914 ];
915+
910916 $ this ->assertSame (' checked="checked" ' , set_radio ('bar ' , '0 ' ));
911917 $ this ->assertSame ('' , set_radio ('bar ' , 'baz ' ));
912918 }
913919
914920 public function testSetRadioDefault ()
915921 {
922+ $ _SESSION = [];
923+ $ _POST = [];
924+
916925 $ this ->assertSame (' checked="checked" ' , set_radio ('code ' , 'alpha ' , true ));
917926 $ this ->assertSame ('' , set_radio ('code ' , 'beta ' , false ));
918927 }
0 commit comments