Fix deprecated getMock call in Federation app

pull/1217/head
Roeland Jago Douma 10 years ago
parent 2685129184
commit 62485ed08f
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
  1. 14
      apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
  2. 12
      apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
  3. 9
      apps/federation/tests/Controller/SettingsControllerTest.php
  4. 2
      apps/federation/tests/DbHandlerTest.php
  5. 7
      apps/federation/tests/Middleware/AddServerMiddlewareTest.php
  6. 18
      apps/federation/tests/TrustedServersTest.php

@ -73,15 +73,15 @@ class GetSharedSecretTest extends TestCase {
public function setUp() {
parent::setUp();
$this->httpClient = $this->getMock('OCP\Http\Client\IClient');
$this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
$this->urlGenerator = $this->getMock('OCP\IURLGenerator');
$this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
$this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
$this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
$this->dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
$this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
$this->logger = $this->getMock('OCP\ILogger');
$this->response = $this->getMock('OCP\Http\Client\IResponse');
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->getSharedSecret = new GetSharedSecret(
$this->httpClient,

@ -61,14 +61,14 @@ class RequestSharedSecretTest extends TestCase {
public function setUp() {
parent::setUp();
$this->httpClient = $this->getMock('OCP\Http\Client\IClient');
$this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
$this->urlGenerator = $this->getMock('OCP\IURLGenerator');
$this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
$this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
$this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
$this->dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
$this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
$this->response = $this->getMock('OCP\Http\Client\IResponse');
$this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->requestSharedSecret = new RequestSharedSecret(
$this->httpClient,

@ -25,7 +25,10 @@ namespace OCA\Federation\Tests\Controller;
use OCA\Federation\Controller\SettingsController;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http\DataResponse;
use OCP\IL10N;
use OCP\IRequest;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@ -45,9 +48,9 @@ class SettingsControllerTest extends TestCase {
public function setUp() {
parent::setUp();
$this->request = $this->getMock('OCP\IRequest');
$this->l10n = $this->getMock('OCP\IL10N');
$this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
$this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
$this->controller = new SettingsController(

@ -53,7 +53,7 @@ class DbHandlerTest extends TestCase {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
$this->il10n = $this->getMock('OCP\IL10N');
$this->il10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->dbHandler = new DbHandler(
$this->connection,

@ -29,6 +29,7 @@ use OC\HintException;
use OCA\Federation\Middleware\AddServerMiddleware;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\IL10N;
use OCP\ILogger;
use Test\TestCase;
@ -49,9 +50,9 @@ class AddServerMiddlewareTest extends TestCase {
public function setUp() {
parent::setUp();
$this->logger = $this->getMock('OCP\ILogger');
$this->l10n = $this->getMock('OCP\IL10N');
$this->controller = $this->getMockBuilder('OCP\AppFramework\Controller')
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->controller = $this->getMockBuilder(Controller::class)
->disableOriginalConstructor()->getMock();
$this->middleware = new AddServerMiddleware(

@ -74,17 +74,17 @@ class TrustedServersTest extends TestCase {
public function setUp() {
parent::setUp();
$this->dbHandler = $this->getMockBuilder('\OCA\Federation\DbHandler')
$this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')
$this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)
->disableOriginalConstructor()->getMock();
$this->httpClientService = $this->getMock('OCP\Http\Client\IClientService');
$this->httpClient = $this->getMock('OCP\Http\Client\IClient');
$this->response = $this->getMock('OCP\Http\Client\IResponse');
$this->logger = $this->getMock('OCP\ILogger');
$this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
$this->secureRandom = $this->getMock('OCP\Security\ISecureRandom');
$this->config = $this->getMock('OCP\IConfig');
$this->httpClientService = $this->getMockBuilder(IClientService::class)->getMock();
$this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
$this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
$this->secureRandom = $this->getMockBuilder(ISecureRandom::class)->getMock();
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->trustedServers = new TrustedServers(
$this->dbHandler,

Loading…
Cancel
Save