Example #1
0
 /**
  * Get all of the received requests
  *
  * @param bool $hydrate Set to TRUE to turn the messages into
  *      actual {@see RequestInterface} objects.  If $hydrate is FALSE,
  *      requests will be returned as strings.
  *
  * @return array
  * @throws \RuntimeException
  */
 public static function received($hydrate = false)
 {
     $response = TestServer::received();
     if ($hydrate) {
         $c = new Client();
         $factory = new MessageFactory();
         $response = array_map(function ($message) use($factory, $c) {
             return RingBridge::fromRingRequest($message);
         }, $response);
     }
     return $response;
 }
Example #2
0
 public function testCreatesRequestFromRing()
 {
     $request = RingBridge::fromRingRequest(['http_method' => 'GET', 'uri' => '/', 'headers' => ['foo' => ['bar'], 'host' => ['foo.com']], 'body' => 'test', 'version' => '1.0']);
     $this->assertEquals('GET', $request->getMethod());
     $this->assertEquals('http://foo.com/', $request->getUrl());
     $this->assertEquals('1.0', $request->getProtocolVersion());
     $this->assertEquals('test', (string) $request->getBody());
     $this->assertEquals('bar', $request->getHeader('foo'));
 }