Exemplo n.º 1
0
 public function addStats(TransferStats $stats)
 {
     $request = $stats->getRequest();
     $data = isset($this->history[$request]) ? $this->history[$request] : [];
     $data['info'] = $stats->getHandlerStats();
     $this->history->attach($request, $data);
 }
 public function testHasData()
 {
     $request = new Psr7\Request('GET', 'http://foo.com');
     $response = new Psr7\Response();
     $stats = new TransferStats($request, $response, 10.5, null, ['foo' => 'bar']);
     $this->assertSame($request, $stats->getRequest());
     $this->assertSame($response, $stats->getResponse());
     $this->assertTrue($stats->hasResponse());
     $this->assertEquals(['foo' => 'bar'], $stats->getHandlerStats());
     $this->assertEquals('bar', $stats->getHandlerStat('foo'));
     $this->assertSame($request->getUri(), $stats->getEffectiveUri());
     $this->assertEquals(10.5, $stats->getTransferTime());
     $this->assertNull($stats->getHandlerErrorData());
 }