public function test_getCookieParams()
 {
     $parser = new ServerRequest();
     $testArray = array('a' => 'test1', 'b' => 'test2', 'c' => 'test3');
     $parser->withCookieParams($testArray);
     $this->assertEquals($testArray, $parser->getCookieParams());
 }
Example #2
0
 protected function initHttpParser($client)
 {
     $parser = \WebUtil\Parser\RequestFactory::create();
     $parser->setOnParsedCallback(function ($data) use($client) {
         $request = ServerRequest::createFromArray($data, $this->serverPram);
         $callback = $this->anyCallback;
         if ($this->nRoutes) {
             $match = $this->route->match($request->getMethod(), $request->getUri()->getPath());
             if ($match) {
                 foreach ($match[1] as $key => $value) {
                     $request->withAttribute($key, $value);
                 }
                 $callback = $match[0];
             }
         }
         $this->serverRequest($client, $request, $callback);
     });
     $client->parser = $parser;
 }