run() public method

public run ( Scenario $scenario ) : Result
$scenario Scenario
return Result
 private function extract()
 {
     $player = new Player(new Client());
     $scenario = new Scenario();
     $scenario->endpoint('http://londonbusroutes.net')->visit("url('/changes.htm')")->expect('status_code() == 200')->extract('table_count', 'css("table").count()');
     $r = $player->run($scenario);
     return $r['table_count'];
 }
Ejemplo n.º 2
0
 public function testFoo()
 {
     $scenario = new Scenario();
     $scenario->visit('url("/")');
     $mock = new MockHandler([new Response(200, ['X-Foo' => 'Bar']), new Response(202, ['Content-Length' => 0]), new RequestException('Error Communicating with Server', new Request('GET', 'test'))]);
     $handler = HandlerStack::create($mock);
     $guzzle = new GuzzleClient(['handler' => $handler]);
     $player = new Player($guzzle);
     $player->run($scenario);
 }