public function testChaining() { $request = $this->randomArray(); $session = $this->randomArray(); $server = $this->randomArray(); $cookies = $this->randomArray(); $files = $this->randomArray(); $env = $this->randomArray(); $this->builder->withRequest($request)->withSession($session)->withServer($server)->withCookies($cookies)->withFiles($files)->withEnv($env); $this->assertEquals($request, $this->builder->request()->getAll()); $this->assertEquals($session, $this->builder->session()->getAll()); $this->assertEquals($server, $this->builder->server()->getAll()); $this->assertEquals($cookies, $this->builder->cookies()->getAll()); $this->assertEquals($files, $this->builder->files()->getAll()); $this->assertEquals($env, $this->builder->env()->getAll()); }
public function testSuperglobals() { $envVariableName = $this->random->randomText(); $envVariableValue = $this->random->randomText(); $env = [$envVariableName => $envVariableValue]; $builder = new RequestParamBuilder(); $builder->withEnv($env); $requestParams = new RequestParams($builder); $actual = $this->object->handle('/a/y', 'GET', $requestParams); $this->assertEquals($envVariableValue, $actual->parameters()->env()->get($envVariableName, null)); }
public function testMutableCookiesSet() { $cookie = $this->randomArray(); $builder = new RequestParamBuilder(); $builder->withCookies($cookie); $requestParams = new RequestParams($builder); $testKey = $this->random->randomText(); $testValue = $this->random->randomText(); $requestParams->cookies()->set($testKey, $testValue); $this->assertTrue($requestParams->cookies()->has($testKey)); $this->assertTrue(array_key_exists($testKey, $cookie)); }