diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2020-04-02 12:34:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 12:34:21 +0300 |
commit | bc6a5ef5c4431ca662424dbd1125e65e74b27fa8 (patch) | |
tree | a4ca41650699b5d9f9356eb4e7d5a5a10ab15ab2 /apps | |
parent | c1368b86963b93a42ec98a856f8d307d922c8967 (diff) | |
parent | 1f5ba56235349ad811329b80cc1a2338dc8c79c7 (diff) |
Merge pull request #19890 from nextcloud/enh/comments-reference-id
Add optional comments reference_id
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/tests/unit/Comments/CommentsNodeTest.php | 21 | ||||
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 11 | ||||
-rw-r--r-- | apps/settings/tests/Controller/CheckSetupControllerTest.php | 1 |
3 files changed, 25 insertions, 8 deletions
diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index 0555d09379c..a219b0a5c74 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -108,7 +108,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->node->delete(); } - + public function testDeleteForbidden() { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); @@ -150,7 +150,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->assertSame($this->node->getName(), $id); } - + public function testSetName() { $this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class); @@ -195,7 +195,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->assertTrue($this->node->updateComment($msg)); } - + public function testUpdateCommentLogException() { $this->expectException(\Exception::class); $this->expectExceptionMessage('buh!'); @@ -236,7 +236,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->node->updateComment($msg); } - + public function testUpdateCommentMessageTooLongException() { $this->expectException(\Sabre\DAV\Exception\BadRequest::class); $this->expectExceptionMessage('Message exceeds allowed character limit of'); @@ -275,7 +275,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->node->updateComment('foo'); } - + public function testUpdateForbiddenByUser() { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); @@ -310,7 +310,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->node->updateComment($msg); } - + public function testUpdateForbiddenByType() { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); @@ -340,7 +340,7 @@ class CommentsNodeTest extends \Test\TestCase { $this->node->updateComment($msg); } - + public function testUpdateForbiddenByNotLoggedIn() { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); @@ -403,6 +403,7 @@ class CommentsNodeTest extends \Test\TestCase { $ns . 'latestChildDateTime' => new \DateTime('2016-01-12 18:48:00'), $ns . 'objectType' => 'files', $ns . 'objectId' => '1848', + $ns . 'referenceId' => 'ref', $ns . 'isUnread' => null, ]; @@ -469,6 +470,10 @@ class CommentsNodeTest extends \Test\TestCase { ->method('getObjectId') ->willReturn($expected[$ns . 'objectId']); + $this->comment->expects($this->once()) + ->method('getReferenceId') + ->willReturn($expected[$ns . 'referenceId']); + $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -484,7 +489,7 @@ class CommentsNodeTest extends \Test\TestCase { $properties = $this->node->getProperties(null); foreach($properties as $name => $value) { - $this->assertTrue(array_key_exists($name, $expected)); + $this->assertArrayHasKey($name, $expected); $this->assertSame($expected[$name], $value); unset($expected[$name]); } diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 04711cf5308..6f3bb539eff 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -46,6 +46,7 @@ use GuzzleHttp\Exception\ClientException; use OC; use OC\AppFramework\Http; use OC\DB\Connection; +use OC\DB\MissingColumnInformation; use OC\DB\MissingIndexInformation; use OC\DB\SchemaWrapper; use OC\IntegrityCheck\Checker; @@ -445,6 +446,15 @@ Raw output return $indexInfo->getListOfMissingIndexes(); } + protected function hasMissingColumns(): array { + $indexInfo = new MissingColumnInformation(); + // Dispatch event so apps can also hint for pending index updates if needed + $event = new GenericEvent($indexInfo); + $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event); + + return $indexInfo->getListOfMissingColumns(); + } + protected function isSqliteUsed() { return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false; } @@ -693,6 +703,7 @@ Raw output 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), 'missingIndexes' => $this->hasMissingIndexes(), + 'missingColumns' => $this->hasMissingColumns(), 'isSqliteUsed' => $this->isSqliteUsed(), 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), 'isPHPMailerUsed' => $this->isPHPMailerUsed(), diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 5e59bfe353a..c15f3b8f23a 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -583,6 +583,7 @@ class CheckSetupControllerTest extends TestCase { 'isSqliteUsed' => false, 'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion', 'missingIndexes' => [], + 'missingColumns' => [], 'isPHPMailerUsed' => false, 'mailSettingsDocumentation' => 'https://server/index.php/settings/admin', 'isMemoryLimitSufficient' => true, |