Exemple #1
0
 /**
  * Returns currently used SOAP library hook.
  *
  * If no library hook is set, a new one is created.
  *
  * @return SoapHook SOAP library hook.
  */
 protected function getLibraryHook()
 {
     if (empty($this->soapHook)) {
         $this->soapHook = VCRFactory::get('VCR\\LibraryHooks\\SoapHook');
     }
     return $this->soapHook;
 }
Exemple #2
0
 /**
  * @dataProvider storageProvider
  */
 public function testCreateStorage($storage, $className)
 {
     vfsStream::setup('test');
     VCRFactory::get('VCR\\Configuration')->setStorage($storage);
     VCRFactory::get('VCR\\Configuration')->setCassettePath(vfsStream::url('test/'));
     $instance = VCRFactory::get('Storage', array(rand()));
     $this->assertInstanceOf($className, $instance);
 }
 public function testHandleRequestRecordsRequest()
 {
     $request = new Request('GET', 'http://example.com', array('User-Agent' => 'Unit-Test'));
     $response = new Response(200, array(), 'example response');
     $client = $this->getClientMock($request, $response);
     $configuration = new Configuration();
     $configuration->enableLibraryHooks(array());
     $proxy = new ProxyBuilder('\\VCR\\Videorecorder');
     $videorecorder = $proxy->setConstructorArgs(array($configuration, $client, VCRFactory::getInstance()))->setProperties(array('cassette', 'client'))->getProxy();
     $videorecorder->client = $client;
     $videorecorder->cassette = $this->getCassetteMock($request, $response);
     $this->assertEquals($response, $videorecorder->handleRequest($request));
 }