turnOn() public static method

public static turnOn ( string $cassette ) : GuzzleHttp\HandlerStack
$cassette string fixture path
return GuzzleHttp\HandlerStack
Exemplo n.º 1
0
 public function testExisting()
 {
     $vcr = \Dshafik\GuzzleHttp\VcrHandler::turnOn(__DIR__ . '/fixtures/test-existing.json');
     $client = new \GuzzleHttp\Client(['handler' => $vcr]);
     $response = $client->get('/test');
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertArrayHasKey('X-VCR-Recording', $response->getHeaders());
     $this->assertEquals("1440121471", $response->getHeader('X-VCR-Recording')[0]);
     $this->assertEquals('Hello World', (string) $response->getBody());
 }
 public function setUp()
 {
     if (!file_exists(__DIR__ . '/fixtures')) {
         mkdir(__DIR__ . '/fixtures');
     }
     $handler = new \Akamai\NetStorage\Handler\Authentication();
     $handler->setSigner((new \Akamai\NetStorage\Authentication())->setKey($this->key, $this->keyName));
     $stack = \Dshafik\GuzzleHttp\VcrHandler::turnOn(__DIR__ . '/fixtures/' . lcfirst(substr($this->getName(), 4)) . '.json');
     $stack->push($handler, 'netstorage-handler');
     $client = new \Akamai\Open\EdgeGrid\Client(['base_uri' => $this->host, 'handler' => $stack]);
     $adapter = new \Akamai\NetStorage\FileStoreAdapter($client, $this->cpCode);
     $this->fs = new \League\Flysystem\Filesystem($adapter);
 }
Exemplo n.º 3
0
 protected function getClient()
 {
     $vcr = VcrHandler::turnOn(__DIR__ . '/fixtures/' . $this->getName() . '.json');
     $rev = new Rev(getenv('REV_CLIENT_API_KEY'), getenv('REV_USER_API_KEY'), Rev::SANDBOX_HOST, array('handler' => $vcr));
     return $rev;
 }