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)); }
/** * Determines that the provided url is member of a url blacklist. * * @param string $uri * * @return bool True if the provided url is blacklisted, flase otherwise. */ protected function isBlacklisted($uri) { foreach (static::$configuration->getBlackList() as $path) { if (strpos($uri, $path) !== false) { return true; } } return false; }
/** * Returns a list of callbacks to configured request matchers. * * @return array List of callbacks to configured request matchers. */ protected function getRequestMatchers() { return $this->config->getRequestMatchers(); }