Exemple #1
0
 public function testRunnerWithoutValidator()
 {
     $urlProvider = new UrlProvider(['urls' => ['google' => ['url' => 'https://www.google.fr', 'method' => 'GET', 'headers' => [], 'timeout' => 1, 'validator' => [], 'status_code' => 200]]]);
     $client = GuzzleClient::createClient($this->io, ['handler' => $this->mockClient()]);
     $runner = new Runner($urlProvider, $client);
     $resultCollection = $runner->run();
     $this->assertCount(1, $urlProvider->getUrls());
     $this->assertInstanceOf(UrlInfo::class, $urlProvider->getUrls()['google']);
     $this->assertInstanceOf(ResultCollection::class, $resultCollection);
     $this->assertInstanceOf(Result::class, $resultCollection['google']);
     $this->assertEquals(new Result($this->createUrlInfo(false), 200, 0, null, null), $resultCollection['google']);
 }
Exemple #2
0
 /**
  * testClientModifiedOptions.
  */
 public function testClientModifiedOptions()
 {
     $client = GuzzleClient::createClient($this->io, ['allow_redirects' => true, 'handler' => new MockHandler()]);
     $this->assertSame(true, $client->getConfig()['allow_redirects']);
     $this->assertInstanceOf(MockHandler::class, $client->getConfig()['handler']);
 }