File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ public function get(string $key)
46
46
return $ this ->get [$ key ] ?? null ;
47
47
}
48
48
49
+ public function setGet (string $ key , string $ value ): void
50
+ {
51
+ $ this ->get [$ key ] = $ value ;
52
+ $ _GET [$ key ] = $ value ;
53
+ }
54
+
49
55
public function setGetArray (array $ array ): void
50
56
{
51
57
$ this ->get = $ array ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of CodeIgniter 4 framework.
5
+ *
6
+ * (c) CodeIgniter Foundation <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view
9
+ * the LICENSE file that was distributed with this source code.
10
+ */
11
+
12
+ namespace CodeIgniter ;
13
+
14
+ use CodeIgniter \Test \CIUnitTestCase ;
15
+
16
+ /**
17
+ * @internal
18
+ *
19
+ * @group Others
20
+ */
21
+ final class SuperglobalsTest extends CIUnitTestCase
22
+ {
23
+ public function testSetGet ()
24
+ {
25
+ $ globals = new Superglobals ([], []);
26
+
27
+ $ globals ->setGet ('test ' , 'value1 ' );
28
+
29
+ $ this ->assertSame ('value1 ' , $ globals ->get ('test ' ));
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments