public function testCreateInvalidTransporter()
 {
     $this->swapConfig(['trucker::error_handler.driver' => 'invalid']);
     Config::setApp($this->app);
     $this->setExpectedException('ReflectionException');
     $this->setExpectedException('InvalidArgumentException');
     $foo = ErrorHandlerFactory::build();
 }
 public function testCreateInvalidQueryConditionDriver()
 {
     $this->swapConfig(['trucker::query_condition.driver' => 'invalid']);
     Config::setApp($this->app);
     $this->setExpectedException('ReflectionException');
     $this->setExpectedException('InvalidArgumentException');
     $foo = ConditionFactory::build();
 }
 public function testCreateInvalidRequest()
 {
     $this->swapConfig(['trucker::request.driver' => 'invalid']);
     Config::setApp($this->app);
     $this->setExpectedException('ReflectionException');
     $this->setExpectedException('InvalidArgumentException');
     $foo = RequestFactory::build();
 }
 /**
  * Helper function to setup for testing requests that leverage
  * the Request class and guzzle
  * 
  * @param  array  $config config overrides
  * @return Guzzle\Http\Client
  */
 protected function &initGuzzleRequestTest($config = array())
 {
     $this->swapConfig($config);
     Config::setApp($this->app);
     $client = RequestFactory::getClient();
     $this->trackHistory($client);
     return $client;
 }
 public function testSetsAuthOnRequest()
 {
     $this->swapConfig(['trucker::auth.driver' => 'basic', 'trucker::auth.basic.username' => 'myUsername', 'trucker::auth.basic.password' => 'myPassword']);
     Config::setApp($this->app);
     $request = m::mock('Guzzle\\Http\\Message\\Request');
     $request->shouldReceive('setAuth')->with('myUsername', 'myPassword')->once();
     $auth = new BasicAuthenticator($this->app);
     $auth->authenticateRequest($request);
 }
 public function setUp()
 {
     parent::setUp();
     $this->swapConfig([]);
     Config::setApp($this->app);
 }
示例#7
0
 /**
  * Swap the current config
  *
  * @param  array $config
  *
  * @return void
  */
 protected function swapConfig($config)
 {
     $this->app['config'] = $this->getConfig($config);
     Config::setApp($this->app);
 }
示例#8
0
 public function testGetIdentityProperty()
 {
     $u = Trucker::newInstance();
     $this->assertEquals('id', $u->getIdentityProperty());
     $this->swapConfig(['trucker::resource.identity_property' => 'user_id']);
     Config::setApp($this->app);
     $u = Trucker::newInstance();
     $this->assertEquals('user_id', $u->getIdentityProperty());
 }