コード例 #1
0
 /**
  * @test
  * @dataProvider getAuthenticationFullData
  */
 public function shouldAuthenticateUsingAllGivenParameters($login, $password, $method)
 {
     $client = new TestHttpClient();
     $client->authenticate($login, $password, $method);
     $this->assertCount(2, $client->listeners);
     $this->assertInstanceOf('Github\\HttpClient\\Listener\\AuthListener', $client->listeners['Github\\HttpClient\\Listener\\AuthListener']);
 }
コード例 #2
0
ファイル: HttpClientTest.php プロジェクト: alnutile/drunatra
 /**
  * @test
  * @dataProvider getAuthenticationFullData
  */
 public function shouldAuthenticateUsingAllGivenParameters($login, $password, $method)
 {
     $client = new GuzzleClient();
     $listeners = $client->getEventDispatcher()->getListeners('request.before_send');
     $this->assertCount(1, $listeners);
     $httpClient = new TestHttpClient(array(), $client);
     $httpClient->authenticate($login, $password, $method);
     $listeners = $client->getEventDispatcher()->getListeners('request.before_send');
     $this->assertCount(2, $listeners);
     $authListener = $listeners[1][0];
     $this->assertInstanceOf('Github\\HttpClient\\Listener\\AuthListener', $authListener);
 }