Visithor\Model\UrlChain::addUrl PHP Method

addUrl() public method

Add url
public addUrl ( Url $url )
$url Url Url
    public function addUrl(Url $url)
    {
        $this->urls[] = $url;
        return $this;
    }

Usage Example

Esempio n. 1
0
 /**
  * Test final result given first partial results
  *
  * @dataProvider dataExecute
  */
 public function testExecute($firstStatusCode, $expectedResult)
 {
     /**
      * @var ClientInterface|ObjectProphecy $client
      */
     $client = $this->prophesize('Visithor\\Client\\Interfaces\\ClientInterface');
     $client->getResponseHTTPCode(Argument::any())->willReturn(200);
     $client->buildClient(Argument::any())->willReturn(Argument::any());
     $client->destroyClient(Argument::any())->willReturn(Argument::any());
     $urlChain = new UrlChain();
     $urlChain->addUrl(new Url('', $firstStatusCode, []))->addUrl(new Url('', [200], []))->addUrl(new Url('', [200], []));
     $executor = new Executor($client->reveal());
     $result = $executor->execute($urlChain, $this->prophesize('Visithor\\Renderer\\Interfaces\\RendererInterface')->reveal(), $this->prophesize('Symfony\\Component\\Console\\Output\\OutputInterface')->reveal());
     $this->assertEquals($expectedResult, $result);
 }