diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/Access/PermissionLimitsTest.php | 7 | ||||
-rw-r--r-- | tests/unit/Access/PermissionRolesTest.php | 26 | ||||
-rw-r--r-- | tests/unit/Access/PermissionsTest.php | 14 |
3 files changed, 14 insertions, 33 deletions
diff --git a/tests/unit/Access/PermissionLimitsTest.php b/tests/unit/Access/PermissionLimitsTest.php index 57ad42a19..0a90d11df 100644 --- a/tests/unit/Access/PermissionLimitsTest.php +++ b/tests/unit/Access/PermissionLimitsTest.php @@ -45,8 +45,8 @@ class PermissionLimitsTest extends UnitTestCase { * @uses ::call_hooks */ public function testStd_Limits() { - // There are 18 default perms - $permsCount = 18; + // There are 17 default perms + $permsCount = 17; // Create a stub for global function t() with expectation $t = $this->getFunctionMock('Zotlabs\Access', 't'); @@ -69,10 +69,9 @@ class PermissionLimitsTest extends UnitTestCase { $this->assertEquals(PERMS_SPECIFIC, $stdlimits['post_comments']); $this->assertEquals(PERMS_SPECIFIC, $stdlimits['post_mail']); $this->assertEquals(PERMS_SPECIFIC, $stdlimits['post_like']); - $this->assertEquals(PERMS_SPECIFIC, $stdlimits['tag_deliver']); $this->assertEquals(PERMS_SPECIFIC, $stdlimits['chat']); $this->assertEquals(PERMS_SPECIFIC, $stdlimits['republish']); $this->assertEquals(PERMS_SPECIFIC, $stdlimits['delegate']); } -}
\ No newline at end of file +} diff --git a/tests/unit/Access/PermissionRolesTest.php b/tests/unit/Access/PermissionRolesTest.php index dd55eb6e2..3d3cbbae5 100644 --- a/tests/unit/Access/PermissionRolesTest.php +++ b/tests/unit/Access/PermissionRolesTest.php @@ -40,7 +40,7 @@ class PermissionRolesTest extends UnitTestCase { use PHPMock; public function testVersion() { - $expectedVersion = 2; + $expectedVersion = 3; $this->assertEquals($expectedVersion, PermissionRoles::version()); @@ -58,23 +58,12 @@ class PermissionRolesTest extends UnitTestCase { } ); - $roles = PermissionRoles::roles(); + $roles = PermissionRoles::channel_roles(); $r = new PermissionRoles(); - $this->assertEquals($roles, $r->roles()); + $this->assertEquals($roles, $r->channel_roles()); - $socialNetworking = [ - 'social_federation' => 'Social - Federation', - 'social' => 'Social - Mostly Public', - 'social_restricted' => 'Social - Restricted', - 'social_private' => 'Social - Private' - ]; + $this->assertCount(4, $roles, 'There should be 4 channel roles.'); - Assert::assertArraySubset(['Social Networking' => $socialNetworking], $roles); - $this->assertEquals($socialNetworking, $roles['Social Networking']); - - $this->assertCount(5, $roles, 'There should be 5 permission groups.'); - - $this->assertCount(1, $roles['Other'], "In the 'Other' group should be just one permission role"); } @@ -88,12 +77,9 @@ class PermissionRolesTest extends UnitTestCase { $t = $this->getFunctionMock('Zotlabs\Access', 't'); $t = $this->getFunctionMock('Zotlabs\Access', 'get_config'); - $rp_social = PermissionRoles::role_perms('social'); - $this->assertEquals('social', $rp_social['role']); - + $rp_social = PermissionRoles::role_perms('personal'); + $this->assertEquals('personal', $rp_social['role']); - $rp_custom = PermissionRoles::role_perms('custom'); - $this->assertEquals(['role' => 'custom'], $rp_custom); $rp_nonexistent = PermissionRoles::role_perms('nonexistent'); $this->assertEquals(['role' => 'nonexistent'], $rp_nonexistent); diff --git a/tests/unit/Access/PermissionsTest.php b/tests/unit/Access/PermissionsTest.php index 40724fff8..3ab567ad0 100644 --- a/tests/unit/Access/PermissionsTest.php +++ b/tests/unit/Access/PermissionsTest.php @@ -37,7 +37,7 @@ class PermissionsTest extends UnitTestCase { use PHPMock; public function testVersion() { - $expectedVersion = 2; + $expectedVersion = 3; // static call $this->assertEquals($expectedVersion, Permissions::version()); @@ -60,8 +60,8 @@ class PermissionsTest extends UnitTestCase { * @uses ::call_hooks */ public function testPerms() { - // There are 18 default perms - $permsCount = 18; + // There are 17 default perms + $permsCount = 17; // Create a stub for global function t() with expectation $t = $this->getFunctionMock('Zotlabs\Access', 't'); @@ -94,8 +94,8 @@ class PermissionsTest extends UnitTestCase { * @uses ::call_hooks */ public function testPermsFilter() { - // There are 18 default perms - $permsCount = 18; + // There are 17 default perms + $permsCount = 17; // Create a stub for global function t() with expectation $t = $this->getFunctionMock('Zotlabs\Access', 't'); @@ -154,7 +154,6 @@ class PermissionsTest extends UnitTestCase { 'post_comments' => 0, 'post_mail' => 0, 'post_like' => 0, - 'tag_deliver' => 0, 'chat' => 0, 'republish' => 0, 'delegate' => 0 @@ -177,7 +176,6 @@ class PermissionsTest extends UnitTestCase { 'post_comments' => 0, 'post_mail' => 0, 'post_like' => 0, - 'tag_deliver' => 0, 'chat' => 0, 'republish' => 0, 'delegate' => 0 @@ -200,7 +198,6 @@ class PermissionsTest extends UnitTestCase { 'post_comments' => 0, 'post_mail' => 0, 'post_like' => 0, - 'tag_deliver' => 0, 'chat' => 0, 'republish' => 0, 'delegate' => 0 @@ -234,7 +231,6 @@ class PermissionsTest extends UnitTestCase { 'post_comments' => 0, 'post_mail' => 0, 'post_like' => 0, - 'tag_deliver' => 0, 'chat' => 0, 'republish' => 0, 'delegate' => 0 |