* * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace CodeIgniter\HTTP; use CodeIgniter\Test\CIUnitTestCase; use Config\App; /** * @backupGlobals enabled * * @internal * * @group Others */ final class RequestTest extends CIUnitTestCase { private Request $request; protected function setUp(): void { parent::setUp(); $this->request = new Request(new App()); $_POST = []; $_GET = []; } public function testFetchGlobalsSingleValue() { $_POST['foo'] = 'bar'; $_GET['bar'] = 'baz'; $this->assertSame('bar', $this->request->fetchGlobal('post', 'foo')); $this->assertSame('baz', $this->request->fetchGlobal('get', 'bar')); } public function testFetchGlobalsReturnsNullWhenNotFound() { $this->assertNull($this->request->fetchGlobal('post', 'foo')); } public function testFetchGlobalsFiltersValues() { $this->request->setGlobal('post', [ 'foo' => 'bar