public function testGetAllCannotModify()
 {
     $key = $this->random->randomText();
     $value = $this->random->randomText();
     $mySession = [$key => $value];
     $sess = new MutableSuperglobal($mySession);
     $all = $sess->getAll();
     $this->assertEquals($value, $all[$key]);
     $all[$key] = 'somethingElse';
     $this->assertEquals('somethingElse', $all[$key]);
     $this->assertEquals($value, $sess->get($key, ''));
 }
 /**
  * @return array
  */
 private function randomArray()
 {
     $numberOfEntries = $this->random->randomNumber(10);
     $data = [];
     for ($i = 0; $i < $numberOfEntries; $i++) {
         array_push($data, $this->random->randomText());
     }
     return $data;
 }
Exemplo n.º 3
0
 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));
 }
 /**
  * @return array
  */
 private function randomArray()
 {
     return [$this->random->randomText()];
 }