From b71e148ceafd4153ff564b46de92c6859088d2f2 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Tue, 18 Oct 2016 20:43:48 +0200 Subject: [BUGFIX] for fromStandalonePermission(). Not sure if this method is used anywhere, but it should not have worked correctly. This should correct it. Add a unit test for this class. --- tests/unit/Lib/PermissionDescriptionTest.php | 110 +++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 tests/unit/Lib/PermissionDescriptionTest.php (limited to 'tests') diff --git a/tests/unit/Lib/PermissionDescriptionTest.php b/tests/unit/Lib/PermissionDescriptionTest.php new file mode 100644 index 000000000..b1da5a0fd --- /dev/null +++ b/tests/unit/Lib/PermissionDescriptionTest.php @@ -0,0 +1,110 @@ +assertEquals($permDesc, $permDesc2); + $this->assertNotEquals($permDesc, $permDesc3); + } + + public function testFromStandalonePermission() { + $permDescUnknown = PermissionDescription::fromStandalonePermission(-1); + $permDescSelf = PermissionDescription::fromStandalonePermission(0); + + $this->assertNull($permDescUnknown); + $this->assertNotNull($permDescSelf); + } + + public function testFromGlobalPermission() { + //$permDesc = PermissionDescription::fromGlobalPermission('view_profile'); + + $this->markTestIncomplete( + 'For this test we need more stubs...' + ); + } + + public function testGetPermissionDescription() { + + // fromStandalonePermission uses get_permission_description(), so that will not help + //$permDescSelf = PermissionDescription::fromStandalonePermission(0); + //$permDescPublic = PermissionDescription::fromStandalonePermission(PERMS_PUBLIC); + + $this->markTestIncomplete( + 'For this test we need a mock of PermissionDescription...' + ); + //$permDescSelf = + //$this->assertEquals($permDescSelf->, 'Only me'); + //$this->assertEquals($permDescPublic, 'Public'); + } + } +} -- cgit v1.2.3