public function setUp() { $client = new GuzzleHttp\Client(); $watcher = new Gsaulmon\GuzzleRecorder\GuzzleRecorder(__DIR__ . '/Fixtures/Http'); $watcher->includeCookies(false); $client->getEmitter()->attach($watcher); \PHRETS\Http\Client::set($client); $config = new \PHRETS\Configuration(); $config->setLoginUrl('http://retsgw.flexmls.com/rets2_1/Login')->setUsername(getenv('PHRETS_TESTING_USERNAME'))->setPassword(getenv('PHRETS_TESTING_PASSWORD'))->setRetsVersion('1.7.2'); $this->session = new PHRETS\Session($config); $this->session->Login(); }
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()); }
/** @test **/ public function it_allows_overrides() { $gc = new GuzzleHttp\Client(); \PHRETS\Http\Client::set($gc); $this->assertSame($gc, \PHRETS\Http\Client::make()); }