/** * Gets url from config. Prepends root url. * Traverses config by class namespace under Csfd. * @param string $key * @param array $args * @throws \Csfd\InternalException * @return string url */ protected function getUrl($key, array $args = NULL) { if (!$this->urlBuilder) { throw new InternalException('UrlBuilder not set, call self::setUrlBuilder.'); } $path = $this->getConfigKeys(); array_push($path, $key); return $this->urlBuilder->get($path, $args); }
public function setUp() { $this->parser = new Movie(); $builder = UrlBuilder::factory(__DIR__ . '/../../../src/Csfd/urls.yml'); $url = $builder->get(['entities', 'movie', 'default'], ['entityId' => self::ID]); $factory = $this->getRequestFactory(); $this->html = $factory->create($url)->getContent(); }
public function setUp() { $this->parser = new User(); $this->builder = UrlBuilder::factory(__DIR__ . '/../../../src/Csfd/urls.yml'); $auth = $this->getAuthenticator(); $account = $this->getConfig()['account']; $auth->setCredentials($account['username'], $account['password']); $factory = $this->getRequestFactory(); $url = $this->builder->get(['entities', 'user', 'profile'], ['entityId' => $account['id']]); $this->html = $factory->create($url, NULL, NULL, $auth->getCookie())->getContent(); }
protected function getUrlBuilder() { return $this->getSingleton(__METHOD__, function () { return UrlBuilder::factory(__DIR__ . '/../src/Csfd/urls.yml'); }); }
/** * @covers Csfd\Networking\UrlBuilder::replacePlaceholders() * @expectedException Csfd\InternalException */ public function testReplacePlaceholders_unsetMap() { $builder = UrlBuilder::factory($this->getUrlsFile()); $builder->get(['foo', 'qaz']); }