/** @test **/ public function it_handles_ua_passwords() { $config = new Configuration(); $config->setUserAgent('PHRETS/2.0'); $config->setUserAgentPassword('test12345'); $this->assertSame('PHRETS/2.0', $config->getUserAgent()); $this->assertSame('test12345', $config->getUserAgentPassword()); }
public function __construct(Configuration $configuration) { // save the configuration along with this session $this->configuration = $configuration; // start up our Guzzle HTTP client $this->default_options = ['auth' => [$configuration->getUsername(), $configuration->getPassword(), $configuration->getHttpAuthenticationMethod()], 'headers' => ['User-Agent' => $configuration->getUserAgent(), 'RETS-Version' => $configuration->getRetsVersion()->asHeader(), 'Accept-Encoding' => 'gzip', 'Accept' => '*/*']]; if ($this->configuration->readOption('disable_follow_location')) { $this->default_options['allow_redirects'] = false; } $this->cookie_jar = new CookieJar(); $this->client = PHRETSClient::make(); // start up the Capabilities tracker and add Login as the first one $this->capabilities = new Capabilities(); $this->capabilities->add('Login', $configuration->getLoginUrl()); }
public function __construct(Configuration $configuration) { // save the configuration along with this session $this->configuration = $configuration; // start up our Guzzle HTTP client $this->client = PHRETSClient::make(); $this->cookie_jar = new CookieJar(); // set the authentication as defaults to use for the entire client $this->client->setDefaultOption('auth', [$configuration->getUsername(), $configuration->getPassword(), $configuration->getHttpAuthenticationMethod()]); $this->client->setDefaultOption('headers', ['User-Agent' => $configuration->getUserAgent(), 'RETS-Version' => $configuration->getRetsVersion()->asHeader(), 'Accept-Encoding' => 'gzip']); // disable following 'Location' header (redirects) automatically if ($this->configuration->readOption('disable_follow_location')) { $this->client->setDefaultOption('allow_redirects', false); } // start up the Capabilities tracker and add Login as the first one $this->capabilities = new Capabilities(); $this->capabilities->add('Login', $configuration->getLoginUrl()); }