/** @test **/ public function it_does_the_basics() { $config = new Configuration(); $config->setLoginUrl('http://www.reso.org/login'); // not a valid RETS server. just using for testing $config->setUsername('user'); $config->setPassword('pass'); $this->assertSame('http://www.reso.org/login', $config->getLoginUrl()); $this->assertSame('user', $config->getUsername()); $this->assertSame('pass', $config->getPassword()); }
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()); }