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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Comments/ManagerTest.php')
-rw-r--r--tests/lib/Comments/ManagerTest.php77
1 files changed, 40 insertions, 37 deletions
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 8b7bf50f95c..93cafc0f933 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -21,7 +21,7 @@ class ManagerTest extends TestCase {
/** @var IDBConnection */
private $connection;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
@@ -67,18 +67,18 @@ class ManagerTest extends TestCase {
return $factory->getManager();
}
- /**
- * @expectedException \OCP\Comments\NotFoundException
- */
+
public function testGetCommentNotFound() {
+ $this->expectException(\OCP\Comments\NotFoundException::class);
+
$manager = $this->getManager();
$manager->get('22');
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testGetCommentNotFoundInvalidInput() {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$manager->get('unexisting22');
}
@@ -125,18 +125,18 @@ class ManagerTest extends TestCase {
$this->assertEquals($comment->getLatestChildDateTime(), $latestChildDT);
}
- /**
- * @expectedException \OCP\Comments\NotFoundException
- */
+
public function testGetTreeNotFound() {
+ $this->expectException(\OCP\Comments\NotFoundException::class);
+
$manager = $this->getManager();
$manager->getTree('22');
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testGetTreeNotFoundInvalidIpnut() {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$manager->getTree('unexisting22');
}
@@ -411,13 +411,14 @@ class ManagerTest extends TestCase {
/**
* @dataProvider invalidCreateArgsProvider
- * @expectedException \InvalidArgumentException
* @param string $aType
* @param string $aId
* @param string $oType
* @param string $oId
*/
public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId) {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$manager->create($aType, $aId, $oType, $oId);
}
@@ -436,10 +437,10 @@ class ManagerTest extends TestCase {
$this->assertSame($comment->getObjectId(), $objectId);
}
- /**
- * @expectedException \OCP\Comments\NotFoundException
- */
+
public function testDelete() {
+ $this->expectException(\OCP\Comments\NotFoundException::class);
+
$manager = $this->getManager();
$done = $manager->delete('404');
@@ -497,10 +498,10 @@ class ManagerTest extends TestCase {
$this->assertSame($comment->getMessage(), $loadedComment->getMessage());
}
- /**
- * @expectedException \OCP\Comments\NotFoundException
- */
+
public function testSaveUpdateException() {
+ $this->expectException(\OCP\Comments\NotFoundException::class);
+
$manager = $this->getManager();
$comment = new Comment();
$comment
@@ -516,10 +517,10 @@ class ManagerTest extends TestCase {
$manager->save($comment);
}
- /**
- * @expectedException \UnexpectedValueException
- */
+
public function testSaveIncomplete() {
+ $this->expectException(\UnexpectedValueException::class);
+
$manager = $this->getManager();
$comment = new Comment();
$comment->setMessage('from no one to nothing');
@@ -562,11 +563,12 @@ class ManagerTest extends TestCase {
/**
* @dataProvider invalidActorArgsProvider
- * @expectedException \InvalidArgumentException
* @param string $type
* @param string $id
*/
public function testDeleteReferencesOfActorInvalidInput($type, $id) {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$manager->deleteReferencesOfActor($type, $id);
}
@@ -630,11 +632,12 @@ class ManagerTest extends TestCase {
/**
* @dataProvider invalidObjectArgsProvider
- * @expectedException \InvalidArgumentException
* @param string $type
* @param string $id
*/
public function testDeleteCommentsAtObjectInvalidInput($type, $id) {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$manager->deleteCommentsAtObject($type, $id);
}
@@ -797,10 +800,10 @@ class ManagerTest extends TestCase {
$this->assertSame('SOMBRERO', $manager->resolveDisplayName('galaxy', 'sombrero'));
}
- /**
- * @expectedException \OutOfBoundsException
- */
+
public function testRegisterResolverDuplicate() {
+ $this->expectException(\OutOfBoundsException::class);
+
$manager = $this->getManager();
$planetClosure = function ($name) {
@@ -810,10 +813,10 @@ class ManagerTest extends TestCase {
$manager->registerDisplayNameResolver('planet', $planetClosure);
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testRegisterResolverInvalidType() {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$planetClosure = function ($name) {
@@ -822,10 +825,10 @@ class ManagerTest extends TestCase {
$manager->registerDisplayNameResolver(1337, $planetClosure);
}
- /**
- * @expectedException \OutOfBoundsException
- */
+
public function testResolveDisplayNameUnregisteredType() {
+ $this->expectException(\OutOfBoundsException::class);
+
$manager = $this->getManager();
$planetClosure = function ($name) {
@@ -847,10 +850,10 @@ class ManagerTest extends TestCase {
$this->assertTrue(is_string($manager->resolveDisplayName('planet', 'neptune')));
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testResolveDisplayNameInvalidType() {
+ $this->expectException(\InvalidArgumentException::class);
+
$manager = $this->getManager();
$planetClosure = function () {