Exemplo n.º 1
0
 protected function getApiMock()
 {
     $httpClient = $this->getMock('Guzzle\\Http\\Client', array('send'));
     $httpClient->expects($this->any())->method('send');
     $mock = $this->getMock('Github\\HttpClient\\HttpClient', array(), array(array(), $httpClient));
     $client = new \Github\Client($mock);
     $client->setHttpClient($mock);
     return $this->getMockBuilder($this->getApiClass())->setMethods(array('get', 'post', 'postRaw', 'patch', 'delete', 'put'))->setConstructorArgs(array($client))->getMock();
 }
Exemplo n.º 2
0
 protected function getApiMock()
 {
     $httpClient = $this->getMock('Buzz\\Client\\ClientInterface', array('setTimeout', 'setVerifyPeer', 'send'));
     $httpClient->expects($this->any())->method('setTimeout')->with(10);
     $httpClient->expects($this->any())->method('setVerifyPeer')->with(false);
     $httpClient->expects($this->any())->method('send');
     $mock = $this->getMock('Github\\HttpClient\\HttpClient', array(), array(array(), $httpClient));
     $client = new \Github\Client($httpClient);
     $client->setHttpClient($mock);
     return $this->getMockBuilder($this->getApiClass())->setMethods(array('get', 'post', 'patch', 'delete', 'put'))->setConstructorArgs(array($client))->getMock();
 }
Exemplo n.º 3
0
 protected function getRepo($httpClient = null)
 {
     $github = new \Github\Client();
     if ($httpClient) {
         $github->setHttpClient($httpClient);
     }
     $output = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $repoManager = $this->getMockBuilder('Knp\\Bundle\\KnpBundlesBundle\\Git\\RepoManager')->disableOriginalConstructor()->getMock();
     return new Repo($github, $output, $repoManager, new EventDispatcher(), $this->getOwnerManagerMock());
 }