Fix getMock Http Client
This commit is contained in:
parent
aa670cab14
commit
97f6410ac8
|
@ -11,14 +11,16 @@ namespace Test\Http\Client;
|
||||||
use GuzzleHttp\Client as GuzzleClient;
|
use GuzzleHttp\Client as GuzzleClient;
|
||||||
use OC\Http\Client\Client;
|
use OC\Http\Client\Client;
|
||||||
use OC\Http\Client\ClientService;
|
use OC\Http\Client\ClientService;
|
||||||
|
use OCP\ICertificateManager;
|
||||||
|
use OCP\IConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ClientServiceTest
|
* Class ClientServiceTest
|
||||||
*/
|
*/
|
||||||
class ClientServiceTest extends \Test\TestCase {
|
class ClientServiceTest extends \Test\TestCase {
|
||||||
public function testNewClient() {
|
public function testNewClient() {
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$certificateManager = $this->getMock('\OCP\ICertificateManager');
|
$certificateManager = $this->createMock(ICertificateManager::class);
|
||||||
|
|
||||||
$expected = new Client($config, $certificateManager, new GuzzleClient());
|
$expected = new Client($config, $certificateManager, new GuzzleClient());
|
||||||
$clientService = new ClientService($config, $certificateManager);
|
$clientService = new ClientService($config, $certificateManager);
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Test\Http\Client;
|
||||||
|
|
||||||
use GuzzleHttp\Message\Response;
|
use GuzzleHttp\Message\Response;
|
||||||
use OC\Http\Client\Client;
|
use OC\Http\Client\Client;
|
||||||
|
use OCP\ICertificateManager;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +26,11 @@ class ClientTest extends \Test\TestCase {
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->config = $this->getMock('\OCP\IConfig');
|
$this->config = $this->createMock(IConfig::class);
|
||||||
$this->guzzleClient = $this->getMockBuilder('\GuzzleHttp\Client')
|
$this->guzzleClient = $this->getMockBuilder('\GuzzleHttp\Client')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$certificateManager = $this->getMock('\OCP\ICertificateManager');
|
$certificateManager = $this->createMock(ICertificateManager::class);
|
||||||
$this->client = new Client(
|
$this->client = new Client(
|
||||||
$this->config,
|
$this->config,
|
||||||
$certificateManager,
|
$certificateManager,
|
||||||
|
|
Loading…
Reference in New Issue