summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-08-15 16:43:22 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-08-15 16:43:22 +0200
commit7ffb7b0d846241c8cc6b45a3c85b2374c6d026ae (patch)
tree8472e73eb69f8495405231d44e1d580cbd0942bd /tests
parent8a7a0f328746230dd896ccc53b3ada271a91b930 (diff)
downloadnextcloud-server-7ffb7b0d846241c8cc6b45a3c85b2374c6d026ae.tar.gz
nextcloud-server-7ffb7b0d846241c8cc6b45a3c85b2374c6d026ae.zip
Use MockBuilder instead of createMock
CI uses an older PHPUnit
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/AdminSettingsControllerTest.php8
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php2
-rw-r--r--tests/lib/Settings/Admin/AdditionalTest.php2
-rw-r--r--tests/lib/Settings/Admin/EncryptionTest.php4
-rw-r--r--tests/lib/Settings/Admin/LoggingTest.php2
-rw-r--r--tests/lib/Settings/Admin/ServerTest.php8
-rw-r--r--tests/lib/Settings/Admin/SharingTest.php2
-rw-r--r--tests/lib/Settings/Admin/TipsTricksTest.php2
-rw-r--r--tests/lib/Settings/ManagerTest.php36
9 files changed, 33 insertions, 33 deletions
diff --git a/tests/Settings/Controller/AdminSettingsControllerTest.php b/tests/Settings/Controller/AdminSettingsControllerTest.php
index 86950c9aa9d..6c93bca0d68 100644
--- a/tests/Settings/Controller/AdminSettingsControllerTest.php
+++ b/tests/Settings/Controller/AdminSettingsControllerTest.php
@@ -44,9 +44,9 @@ class AdminSettingsControllerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->request = $this->createMock('\OCP\IRequest');
- $this->navigationManager = $this->createMock('\OCP\INavigationManager');
- $this->settingsManager = $this->createMock('\OCP\Settings\IManager');
+ $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
+ $this->navigationManager = $this->getMockBuilder('\OCP\INavigationManager')->getMock();
+ $this->settingsManager = $this->getMockBuilder('\OCP\Settings\IManager')->getMock();
$this->adminSettingsController = new AdminSettingsController(
'settings',
@@ -65,7 +65,7 @@ class AdminSettingsControllerTest extends TestCase {
->expects($this->once())
->method('getAdminSettings')
->with('test')
- ->willReturn([5 => new TipsTricks($this->createMock('\OCP\IConfig'))]);
+ ->willReturn([5 => new TipsTricks($this->getMockBuilder('\OCP\IConfig')->getMock())]);
$expected = new TemplateResponse('settings', 'admin/frame', ['forms' => [], 'content' => '']);
$this->assertEquals($expected, $this->adminSettingsController->index('test'));
}
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index 63c8141cedd..770d5a4934e 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -98,7 +98,7 @@ class CheckSetupControllerTest extends TestCase {
}));
$this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
->disableOriginalConstructor()->getMock();
- $this->logger = $this->createMock('\OCP\ILogger');
+ $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
$this->checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
->setConstructorArgs([
'settings',
diff --git a/tests/lib/Settings/Admin/AdditionalTest.php b/tests/lib/Settings/Admin/AdditionalTest.php
index 178d7550614..3a99893cf7c 100644
--- a/tests/lib/Settings/Admin/AdditionalTest.php
+++ b/tests/lib/Settings/Admin/AdditionalTest.php
@@ -36,7 +36,7 @@ class AdditionalTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
$this->admin = new Additional(
$this->config
diff --git a/tests/lib/Settings/Admin/EncryptionTest.php b/tests/lib/Settings/Admin/EncryptionTest.php
index a68b40ae11b..f9763d85c1f 100644
--- a/tests/lib/Settings/Admin/EncryptionTest.php
+++ b/tests/lib/Settings/Admin/EncryptionTest.php
@@ -39,8 +39,8 @@ class EncryptionTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->manager = $this->createMock('\OC\Encryption\Manager');
- $this->userManager = $this->createMock('\OCP\IUserManager');
+ $this->manager = $this->getMockBuilder('\OC\Encryption\Manager')->disableOriginalConstructor()->getMock();
+ $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
$this->admin = new Encryption(
$this->manager,
diff --git a/tests/lib/Settings/Admin/LoggingTest.php b/tests/lib/Settings/Admin/LoggingTest.php
index 10a94f1c59c..181553d3894 100644
--- a/tests/lib/Settings/Admin/LoggingTest.php
+++ b/tests/lib/Settings/Admin/LoggingTest.php
@@ -37,7 +37,7 @@ class LoggingTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
$this->admin = new Logging(
$this->config
diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php
index 5a4fa22920f..874422307e0 100644
--- a/tests/lib/Settings/Admin/ServerTest.php
+++ b/tests/lib/Settings/Admin/ServerTest.php
@@ -46,10 +46,10 @@ class ServerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->createMock('\OCP\IConfig');
- $this->dbConnection = $this->createMock('\OCP\IDBConnection');
- $this->lockingProvider = $this->createMock('\OCP\Lock\ILockingProvider');
- $this->l10n = $this->createMock('\OCP\IL10N');
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock();
+ $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock();
+ $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
$this->admin = new Server(
$this->dbConnection,
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php
index 7aec187d372..261e631363a 100644
--- a/tests/lib/Settings/Admin/SharingTest.php
+++ b/tests/lib/Settings/Admin/SharingTest.php
@@ -36,7 +36,7 @@ class SharingTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
$this->admin = new Sharing(
$this->config
diff --git a/tests/lib/Settings/Admin/TipsTricksTest.php b/tests/lib/Settings/Admin/TipsTricksTest.php
index afa053e8337..0e8857b56d0 100644
--- a/tests/lib/Settings/Admin/TipsTricksTest.php
+++ b/tests/lib/Settings/Admin/TipsTricksTest.php
@@ -36,7 +36,7 @@ class TipsTrickTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
$this->admin = new TipsTricks(
$this->config
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 01e226225be..cd5100eff6d 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -56,13 +56,13 @@ class ManagerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->logger = $this->createMock('\OCP\ILogger');
- $this->dbConnection = $this->createMock('\OCP\IDBConnection');
- $this->l10n = $this->createMock('\OCP\IL10N');
- $this->config = $this->createMock('\OCP\IConfig');
- $this->encryptionManager = $this->createMock('\OCP\Encryption\IManager');
- $this->userManager = $this->createMock('\OCP\IUserManager');
- $this->lockingProvider = $this->createMock('\OCP\Lock\ILockingProvider');
+ $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
+ $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock();
+ $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
+ $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->encryptionManager = $this->getMockBuilder('\OCP\Encryption\IManager')->getMock();
+ $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
+ $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock();
$this->manager = new Manager(
$this->logger,
@@ -76,7 +76,7 @@ class ManagerTest extends TestCase {
}
public function testSetupSettings() {
- $qb = $this->createMock('\OCP\DB\QueryBuilder\IQueryBuilder');
+ $qb = $this->getMockBuilder('\OCP\DB\QueryBuilder\IQueryBuilder')->getMock();
$qb
->expects($this->once())
->method('select')
@@ -91,12 +91,12 @@ class ManagerTest extends TestCase {
->method('from')
->with('admin_settings')
->willReturn($qb);
- $expressionBuilder = $this->createMock('\OCP\DB\QueryBuilder\IExpressionBuilder');
+ $expressionBuilder = $this->getMockBuilder('\OCP\DB\QueryBuilder\IExpressionBuilder')->getMock();
$qb
->expects($this->once())
->method('expr')
->willReturn($expressionBuilder);
- $param = $this->createMock('\OCP\DB\QueryBuilder\IParameter');
+ $param = $this->getMockBuilder('\OCP\DB\QueryBuilder\IParameter')->getMock();
$qb
->expects($this->once())
->method('createNamedParameter')
@@ -112,13 +112,13 @@ class ManagerTest extends TestCase {
->method('where')
->with('myString')
->willReturn($qb);
- $stmt = $this->createMock('\Doctrine\DBAL\Driver\Statement');
+ $stmt = $this->getMockBuilder('\Doctrine\DBAL\Driver\Statement')->getMock();
$qb
->expects($this->once())
->method('execute')
->willReturn($stmt);
- $qb1 = $this->createMock('\OCP\DB\QueryBuilder\IQueryBuilder');
+ $qb1 = $this->getMockBuilder('\OCP\DB\QueryBuilder\IQueryBuilder')->getMock();
$qb1
->expects($this->once())
->method('insert')
@@ -135,7 +135,7 @@ class ManagerTest extends TestCase {
}
public function testGetAdminSections() {
- $qb = $this->createMock('\OCP\DB\QueryBuilder\IQueryBuilder');
+ $qb = $this->getMockBuilder('\OCP\DB\QueryBuilder\IQueryBuilder')->getMock();
$qb
->expects($this->once())
->method('select')
@@ -146,7 +146,7 @@ class ManagerTest extends TestCase {
->method('from')
->with('admin_sections')
->willReturn($qb);
- $stmt = $this->createMock('\Doctrine\DBAL\Driver\Statement');
+ $stmt = $this->getMockBuilder('\Doctrine\DBAL\Driver\Statement')->getMock();
$qb
->expects($this->once())
->method('execute')
@@ -171,7 +171,7 @@ class ManagerTest extends TestCase {
}
public function testGetAdminSettings() {
- $qb = $this->createMock('\OCP\DB\QueryBuilder\IQueryBuilder');
+ $qb = $this->getMockBuilder('\OCP\DB\QueryBuilder\IQueryBuilder')->getMock();
$qb
->expects($this->once())
->method('select')
@@ -182,12 +182,12 @@ class ManagerTest extends TestCase {
->method('from')
->with('admin_settings')
->willReturn($qb);
- $expressionBuilder = $this->createMock('\OCP\DB\QueryBuilder\IExpressionBuilder');
+ $expressionBuilder = $this->getMockBuilder('\OCP\DB\QueryBuilder\IExpressionBuilder')->getMock();
$qb
->expects($this->once())
->method('expr')
->willReturn($expressionBuilder);
- $param = $this->createMock('\OCP\DB\QueryBuilder\IParameter');
+ $param = $this->getMockBuilder('\OCP\DB\QueryBuilder\IParameter')->getMock();
$qb
->expects($this->once())
->method('createParameter')
@@ -203,7 +203,7 @@ class ManagerTest extends TestCase {
->method('where')
->with('myString')
->willReturn($qb);
- $stmt = $this->createMock('\Doctrine\DBAL\Driver\Statement');
+ $stmt = $this->getMockBuilder('\Doctrine\DBAL\Driver\Statement')->getMock();
$qb
->expects($this->once())
->method('execute')