File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ public function get(string $key)
4646 return $ this ->get [$ key ] ?? null ;
4747 }
4848
49+ public function setGet (string $ key , string $ value ): void
50+ {
51+ $ this ->get [$ key ] = $ value ;
52+ $ _GET [$ key ] = $ value ;
53+ }
54+
4955 public function setGetArray (array $ array ): void
5056 {
5157 $ 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 <admin@codeigniter.com>
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