Example #1
0
 /**
  * Mock the API methods themselfs
  *
  * @param  array                                    $methods
  * @param  array                                    $clientMethods
  * @param  null                                     $sessionToken
  * @return \PHPUnit_Framework_MockObject_MockObject
  */
 protected function getMockedApi(array $methods = [], array $clientMethods = [], $sessionToken = null)
 {
     $this->_client = $this->getClientWithMockedHttpClient($clientMethods);
     if ($sessionToken) {
         $this->_client->setSessionToken($sessionToken);
     }
     return $this->_api = $this->getMockBuilder($this->getApiClass())->setMethods($methods)->setConstructorArgs([$this->_client])->getMock();
 }
Example #2
0
 /**
  * Return regular objects but replace the http adapter to not actually send requests
  *
  * @param  array $methods
  * @param  null  $sessionToken
  * @return mixed
  */
 protected function getRepositoryWithMockedHttpAdapter(array $methods = [], $sessionToken = null)
 {
     $this->_client = $this->getClientWithMockedHttpClient($methods);
     if ($sessionToken) {
         $this->_client->setSessionToken($sessionToken);
     }
     $repositoryClass = $this->getRepositoryClass();
     return new $repositoryClass($this->_client);
 }