Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-11-28 16:54:16 +0300
committerJoas Schilling <coding@schilljs.com>2019-11-28 16:54:16 +0300
commit324a30dd5b6ee58579f9c040a9d60045499c52ff (patch)
tree55cae1ff89512f5a023790cc41d3fae125bf4b82 /tests
parent80357681e62e15e9dd21f5a18e43c626359ba8ae (diff)
Fix warnings and errors with phpunit 8
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/php/Activity/Provider/BaseTest.php4
-rw-r--r--tests/php/Activity/Provider/InvitationTest.php4
-rw-r--r--tests/php/Activity/SettingTest.php14
-rw-r--r--tests/php/Chat/AutoComplete/SearchPluginTest.php6
-rw-r--r--tests/php/Chat/Parser/SystemMessageTest.php10
-rw-r--r--tests/php/Collaboration/Collaborators/RoomPluginTest.php8
-rw-r--r--tests/php/Notification/NotifierTest.php35
-rw-r--r--tests/php/phpunit.xml1
8 files changed, 43 insertions, 39 deletions
diff --git a/tests/php/Activity/Provider/BaseTest.php b/tests/php/Activity/Provider/BaseTest.php
index 22d1521fe..9ed72bc2e 100644
--- a/tests/php/Activity/Provider/BaseTest.php
+++ b/tests/php/Activity/Provider/BaseTest.php
@@ -162,9 +162,6 @@ class BaseTest extends TestCase {
$this->assertSame($event, static::invokePrivate($provider, 'preParse', [$event]));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testPreParseThrows() {
/** @var IEvent|MockObject $event */
$event = $this->createMock(IEvent::class);
@@ -172,6 +169,7 @@ class BaseTest extends TestCase {
->method('getApp')
->willReturn('activity');
$provider = $this->getProvider();
+ $this->expectException(\InvalidArgumentException::class);
static::invokePrivate($provider, 'preParse', [$event]);
}
diff --git a/tests/php/Activity/Provider/InvitationTest.php b/tests/php/Activity/Provider/InvitationTest.php
index 25d097402..a06cd30d5 100644
--- a/tests/php/Activity/Provider/InvitationTest.php
+++ b/tests/php/Activity/Provider/InvitationTest.php
@@ -96,9 +96,6 @@ class InvitationTest extends TestCase {
);
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testParseThrowsWrongSubject() {
/** @var IEvent|MockObject $event */
$event = $this->createMock(IEvent::class);
@@ -123,6 +120,7 @@ class InvitationTest extends TestCase {
->willReturn(false);
$provider = $this->getProvider();
+ $this->expectException(\InvalidArgumentException::class);
$provider->parse('en', $event);
}
diff --git a/tests/php/Activity/SettingTest.php b/tests/php/Activity/SettingTest.php
index 2f0760e22..5ec1356c9 100644
--- a/tests/php/Activity/SettingTest.php
+++ b/tests/php/Activity/SettingTest.php
@@ -49,7 +49,7 @@ class SettingTest extends TestCase {
public function testGetIdentifier($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('string', $setting->getIdentifier());
+ $this->assertIsString($setting->getIdentifier());
}
/**
@@ -59,7 +59,7 @@ class SettingTest extends TestCase {
public function testGetName($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('string', $setting->getName());
+ $this->assertIsString($setting->getName());
}
/**
@@ -70,7 +70,7 @@ class SettingTest extends TestCase {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$priority = $setting->getPriority();
- $this->assertInternalType('int', $setting->getPriority());
+ $this->assertIsInt($setting->getPriority());
$this->assertGreaterThanOrEqual(0, $priority);
$this->assertLessThanOrEqual(100, $priority);
}
@@ -82,7 +82,7 @@ class SettingTest extends TestCase {
public function testCanChangeStream($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('bool', $setting->canChangeStream());
+ $this->assertIsBool($setting->canChangeStream());
}
/**
@@ -92,7 +92,7 @@ class SettingTest extends TestCase {
public function testIsDefaultEnabledStream($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('bool', $setting->isDefaultEnabledStream());
+ $this->assertIsBool($setting->isDefaultEnabledStream());
}
/**
@@ -102,7 +102,7 @@ class SettingTest extends TestCase {
public function testCanChangeMail($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('bool', $setting->canChangeMail());
+ $this->assertIsBool($setting->canChangeMail());
}
/**
@@ -112,6 +112,6 @@ class SettingTest extends TestCase {
public function testIsDefaultEnabledMail($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
- $this->assertInternalType('bool', $setting->isDefaultEnabledMail());
+ $this->assertIsBool($setting->isDefaultEnabledMail());
}
}
diff --git a/tests/php/Chat/AutoComplete/SearchPluginTest.php b/tests/php/Chat/AutoComplete/SearchPluginTest.php
index bc05f217f..d1b753af5 100644
--- a/tests/php/Chat/AutoComplete/SearchPluginTest.php
+++ b/tests/php/Chat/AutoComplete/SearchPluginTest.php
@@ -68,7 +68,7 @@ class SearchPluginTest extends \Test\TestCase {
/**
* @param string[] $methods
- * @return SearchPlugin|\PHPUnit_Framework_MockObject_MockObject
+ * @return SearchPlugin|MockObject
*/
protected function getPlugin(array $methods = []) {
if (empty($methods)) {
@@ -131,7 +131,7 @@ class SearchPluginTest extends \Test\TestCase {
->with('fo', ['123', 'foo', 'bar'], $result)
->willReturnCallback(function($search, $users, $result) {
array_map(function($user) {
- $this->assertInternalType('string', $user);
+ $this->assertIsString($user);
}, $users);
});
$plugin->expects($this->once())
@@ -139,7 +139,7 @@ class SearchPluginTest extends \Test\TestCase {
->with('fo', $this->anything(), $result)
->willReturnCallback(function($search, $guests, $result) {
array_map(function($guest) {
- $this->assertInternalType('string', $guest);
+ $this->assertIsString($guest);
$this->assertSame(40, strlen($guest));
}, $guests);
});
diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php
index 8544e7d7d..fb47d6189 100644
--- a/tests/php/Chat/Parser/SystemMessageTest.php
+++ b/tests/php/Chat/Parser/SystemMessageTest.php
@@ -397,7 +397,6 @@ class SystemMessageTest extends TestCase {
/**
* @dataProvider dataParseMessageThrows
* @param string|null $return
- * @expectedException \OutOfBoundsException
*/
public function testParseMessageThrows($return) {
/** @var IComment|MockObject $comment */
@@ -416,6 +415,7 @@ class SystemMessageTest extends TestCase {
$chatMessage = new Message($room, $participant, $comment, $this->l);
$chatMessage->setMessage($return, []);
+ $this->expectException(\OutOfBoundsException::class);
$parser->parseMessage($chatMessage);
}
@@ -606,9 +606,6 @@ class SystemMessageTest extends TestCase {
], self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']));
}
- /**
- * @expectedException \OCP\Files\NotFoundException
- */
public function testGetFileFromShareForRecipientThrows() {
$node = $this->createMock(Node::class);
$node->expects($this->once())
@@ -651,12 +648,10 @@ class SystemMessageTest extends TestCase {
->method('linkToRouteAbsolute');
$parser = $this->getParser();
+ $this->expectException(NotFoundException::class);
self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']);
}
- /**
- * @expectedException \OCP\Share\Exceptions\ShareNotFound
- */
public function testGetFileFromShareThrows() {
$this->shareProvider->expects($this->once())
@@ -666,6 +661,7 @@ class SystemMessageTest extends TestCase {
$participant = $this->createMock(Participant::class);
$parser = $this->getParser();
+ $this->expectException(ShareNotFound::class);
self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']);
}
diff --git a/tests/php/Collaboration/Collaborators/RoomPluginTest.php b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
index 897859fb8..4598fd1d5 100644
--- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php
+++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php
@@ -216,8 +216,8 @@ class RoomPluginTest extends \Test\TestCase {
* @dataProvider searchProvider
*
* @param string $searchTerm
- * @param bool $limit
- * @param bool $offset
+ * @param int $limit
+ * @param int $offset
* @param array $roomsForParticipant
* @param array $expectedMatchesExact
* @param array $expectedMatches
@@ -225,8 +225,8 @@ class RoomPluginTest extends \Test\TestCase {
*/
public function testSearch(
string $searchTerm,
- bool $limit,
- bool $offset,
+ int $limit,
+ int $offset,
array $roomsForParticipant,
array $expectedMatchesExact,
array $expectedMatches,
diff --git a/tests/php/Notification/NotifierTest.php b/tests/php/Notification/NotifierTest.php
index d28b98818..89eb5a114 100644
--- a/tests/php/Notification/NotifierTest.php
+++ b/tests/php/Notification/NotifierTest.php
@@ -758,8 +758,6 @@ class NotifierTest extends \Test\TestCase {
/**
* @dataProvider dataPrepareThrows
*
- * @expectedException \InvalidArgumentException
- *
* @param string $message
* @param string $app
* @param bool|null $isDisabledForUser
@@ -835,15 +833,30 @@ class NotifierTest extends \Test\TestCase {
$n->expects($this->once())
->method('getApp')
->willReturn($app);
- $n->expects($subject === null ? $this->never() : $this->atLeastOnce())
- ->method('getSubject')
- ->willReturn($subject);
- $n->expects($params === null ? $this->never() : $this->once())
- ->method('getSubjectParameters')
- ->willReturn($params);
- $n->expects($objectType === null ? $this->never() : $this->once())
- ->method('getObjectType')
- ->willReturn($objectType);
+ if ($subject === null) {
+ $n->expects($this->never())
+ ->method('getSubject');
+ } else {
+ $n->expects($this->once())
+ ->method('getSubject')
+ ->willReturn($subject);
+ }
+ if ($params === null) {
+ $n->expects($this->never())
+ ->method('getSubjectParameters');
+ } else {
+ $n->expects($this->once())
+ ->method('getSubjectParameters')
+ ->willReturn($params);
+ }
+ if ($objectType === null) {
+ $n->expects($this->never())
+ ->method('getObjectType');
+ } else {
+ $n->expects($this->once())
+ ->method('getObjectType')
+ ->willReturn($objectType);
+ }
if ($message === AlreadyProcessedException::class) {
$this->expectException(AlreadyProcessedException::class);
diff --git a/tests/php/phpunit.xml b/tests/php/phpunit.xml
index 82c757c6f..25cb92ad3 100644
--- a/tests/php/phpunit.xml
+++ b/tests/php/phpunit.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit bootstrap="bootstrap.php"
- strict="true"
verbose="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"