Пример #1
0
 /**
  * Method compare two sites and generate Benchmark of loading performance
  *
  * @param string $comparingUri
  * @param string $competitorUri
  *
  * @return BenchmarkResult
  */
 public function compare($comparingUri, $competitorUri)
 {
     list($comparingStats, $competitorStats) = $this->timer->watchConcurrent($comparingUri, $competitorUri);
     return new BenchmarkResult($comparingStats, $competitorStats);
 }
Пример #2
0
 /**
  * Test correct execution for watchConcurrent() when we testing two websites
  *
  * @depends      testClassExists
  * @dataProvider watchConcurrentDataProvider
  *
  * @param Response $comperingResponse
  * @param Response $competitorResponse
  */
 public function testWatchConcurrent(Response $comperingResponse, Response $competitorResponse)
 {
     $mock = new MockHandler([$comperingResponse, $competitorResponse]);
     $handler = HandlerStack::create($mock);
     $client = new GuzzleClient(['handler' => $handler]);
     $timer = new Timer($client);
     list($comperingStats, $competitorStats) = $timer->watchConcurrent('http://example.com', 'http://dummy.com');
     $this->assertInstanceOf(TransferStats::class, $comperingStats);
     $this->assertInstanceOf(TransferStats::class, $competitorStats);
 }