diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2017-10-31 15:05:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-31 15:05:26 +0100 |
commit | b3ff9a2248f18fac4b2a9ffa5be99c464effb4b6 (patch) | |
tree | e6a1524c973307d17b0b89e20ed161b72c6687dd /apps/dav/tests | |
parent | 6ddda3d7d4173bf0203bd2556f7a2d13aea22195 (diff) | |
parent | 143ff6a622a3349a01dd0347d069f824b0f24c4c (diff) | |
download | nextcloud-server-b3ff9a2248f18fac4b2a9ffa5be99c464effb4b6.tar.gz nextcloud-server-b3ff9a2248f18fac4b2a9ffa5be99c464effb4b6.zip |
Merge pull request #6849 from nextcloud/fix-missing-translation-of-personal-calendar-in-activity
Fix missing translation of "Personal" calendar in activities
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Activity/BackendTest.php | 8 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php | 36 |
2 files changed, 41 insertions, 3 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php index d8d15e8f1f7..dd48d8172d3 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php @@ -108,11 +108,13 @@ class BackendTest extends TestCase { [Calendar::SUBJECT_ADD, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], [], [], '', 'admin', null, ['admin']], [Calendar::SUBJECT_ADD, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], [], [], 'test2', 'test2', null, ['admin']], @@ -122,17 +124,20 @@ class BackendTest extends TestCase { [Calendar::SUBJECT_UPDATE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], [], '', 'admin', null, ['admin']], // Visible change [Calendar::SUBJECT_UPDATE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], ['{DAV:}displayname' => 'Name'], '', 'admin', ['user1'], ['user1', 'admin']], [Calendar::SUBJECT_UPDATE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], ['{DAV:}displayname' => 'Name'], 'test2', 'test2', ['user1'], ['user1', 'admin']], @@ -141,16 +146,19 @@ class BackendTest extends TestCase { [Calendar::SUBJECT_DELETE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], [], '', 'admin', [], ['admin']], [Calendar::SUBJECT_DELETE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], [], '', 'admin', ['user1'], ['user1', 'admin']], [Calendar::SUBJECT_DELETE, [ 'principaluri' => 'principal/user/admin', 'id' => 42, + 'uri' => 'this-uri', '{DAV:}displayname' => 'Name of calendar', ], ['shares'], [], 'test2', 'test2', ['user1'], ['user1', 'admin']], ]; diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php index 85eb439f100..adffaf27ded 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php @@ -24,6 +24,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\Activity\Provider; use OCA\DAV\CalDAV\Activity\Provider\Base; use OCP\Activity\IEvent; use OCP\Activity\IProvider; +use OCP\IL10N; use OCP\IUser; use OCP\IUserManager; use Test\TestCase; @@ -113,22 +114,51 @@ class BaseTest extends TestCase { public function dataGenerateCalendarParameter() { return [ + [['id' => 23, 'uri' => 'foo', 'name' => 'bar'], 'bar'], + [['id' => 42, 'uri' => 'foo', 'name' => 'Personal'], 'Personal'], + [['id' => 42, 'uri' => 'personal', 'name' => 'bar'], 'bar'], + [['id' => 42, 'uri' => 'personal', 'name' => 'Personal'], 't(Personal)'], + ]; + } + + /** + * @dataProvider dataGenerateCalendarParameter + * @param array $data + * @param string $name + */ + public function testGenerateCalendarParameter(array $data, $name) { + $l = $this->createMock(IL10N::class); + $l->expects($this->any()) + ->method('t') + ->willReturnCallback(function($string, $args) { + return 't(' . vsprintf($string, $args) . ')'; + }); + + $this->assertEquals([ + 'type' => 'calendar', + 'id' => $data['id'], + 'name' => $name, + ], $this->invokePrivate($this->provider, 'generateCalendarParameter', [$data, $l])); + } + + public function dataGenerateLegacyCalendarParameter() { + return [ [23, 'c1'], [42, 'c2'], ]; } /** - * @dataProvider dataGenerateCalendarParameter + * @dataProvider dataGenerateLegacyCalendarParameter * @param int $id * @param string $name */ - public function testGenerateCalendarParameter($id, $name) { + public function testGenerateLegacyCalendarParameter($id, $name) { $this->assertEquals([ 'type' => 'calendar', 'id' => $id, 'name' => $name, - ], $this->invokePrivate($this->provider, 'generateCalendarParameter', [$id, $name])); + ], $this->invokePrivate($this->provider, 'generateLegacyCalendarParameter', [$id, $name])); } public function dataGenerateGroupParameter() { |