mirror of
https://github.com/e107inc/e107.git
synced 2025-09-01 18:32:44 +02:00
Issue #5473 Permissions completed. Tests passing.
This commit is contained in:
@@ -38,7 +38,7 @@ class e_admin_dispatcherTest extends \Codeception\Test\Unit
|
||||
->willReturnCallback(function ($perm)
|
||||
{
|
||||
|
||||
return $perm === 'Y';
|
||||
return $perm === 'P';
|
||||
});
|
||||
|
||||
$this->dp->expects($this->any())
|
||||
@@ -86,19 +86,19 @@ class e_admin_dispatcherTest extends \Codeception\Test\Unit
|
||||
|
||||
$adminMenu = [
|
||||
'main/list' => ['caption' => 'Manage', 'perm' => '0'],
|
||||
'main/create' => ['caption' => 'LAN_CREATE', 'perm' => 'Y'],
|
||||
'main/create' => ['caption' => 'LAN_CREATE', 'perm' => 'P'],
|
||||
'main/prefs' => ['caption' => 'Settings', 'perm' => 'J', 'icon' => 'fa-cog'],
|
||||
|
||||
'main/custom' => ['caption' => 'Custom Pages', 'perm' => '0', 'icon' => 'fa-asterisk'],
|
||||
'main/custom1' => ['group' => 'main/custom', 'caption' => 'Custom Page 1', 'perm' => 'Y'],
|
||||
'main/custom1' => ['group' => 'main/custom', 'caption' => 'Custom Page 1', 'perm' => 'P'],
|
||||
'main/custom2' => ['group' => 'main/custom', 'caption' => 'Custom Page 2', 'perm' => '0'],
|
||||
|
||||
'other/custom' => ['caption' => 'Other Pages', 'perm' => 'Y', 'icon' => 'fa-asterisk'], // should be ignored since no access to sub-items. 'other/custom1' => ['group' => 'other/custom', 'caption' => 'Other Page 1', 'perm' => '0'],
|
||||
'other/custom' => ['caption' => 'Other Pages', 'perm' => 'P', 'icon' => 'fa-asterisk'], // should be ignored since no access to sub-items. 'other/custom1' => ['group' => 'other/custom', 'caption' => 'Other Page 1', 'perm' => '0'],
|
||||
'other/custom2' => ['group' => 'other/custom', 'caption' => 'Other Page 2', 'perm' => '0'],
|
||||
|
||||
'misc/custom' => ['caption' => 'Misc Pages', 'perm' => 'Y', 'icon' => 'fa-asterisk'],
|
||||
'misc/custom' => ['caption' => 'Misc Pages', 'perm' => 'P', 'icon' => 'fa-asterisk'],
|
||||
'misc/custom1' => ['group' => 'misc/custom', 'caption' => 'misc Page 1', 'perm' => '0'],
|
||||
'misc/custom2' => ['group' => 'misc/custom', 'caption' => 'misc Page 2', 'perm' => 'Y'],
|
||||
'misc/custom2' => ['group' => 'misc/custom', 'caption' => 'misc Page 2', 'perm' => 'P'],
|
||||
];
|
||||
|
||||
// Use real setMenuData
|
||||
@@ -139,24 +139,24 @@ class e_admin_dispatcherTest extends \Codeception\Test\Unit
|
||||
|
||||
$adminMenu = [
|
||||
'main/list' => ['caption' => 'Manage', 'perm' => '0'],
|
||||
'main/create' => ['caption' => 'LAN_CREATE', 'perm' => 'Y'],
|
||||
'main/prefs' => ['caption' => 'Settings', 'perm' => 'Y', 'icon' => 'fa-cog'],
|
||||
'main/create' => ['caption' => 'LAN_CREATE', 'perm' => 'P'],
|
||||
'main/prefs' => ['caption' => 'Settings', 'perm' => 'P', 'icon' => 'fa-cog'],
|
||||
|
||||
'main/custom' => ['caption' => 'Custom Pages', 'perm' => '0', 'icon' => 'fa-asterisk'],
|
||||
'main/custom1' => ['group' => 'main/custom', 'caption' => 'Custom Page 1', 'perm' => 'Y'],
|
||||
'main/custom2' => ['group' => 'main/custom', 'caption' => 'Custom Page 2', 'perm' => 'Y'],
|
||||
'main/custom1' => ['group' => 'main/custom', 'caption' => 'Custom Page 1', 'perm' => 'P'],
|
||||
'main/custom2' => ['group' => 'main/custom', 'caption' => 'Custom Page 2', 'perm' => 'P'],
|
||||
|
||||
'other/custom' => ['caption' => 'Other Pages', 'perm' => 'Y', 'icon' => 'fa-asterisk'],
|
||||
'other/custom1' => ['group' => 'other/custom', 'caption' => 'Other Page 1', 'perm' => 'Y'],
|
||||
'other/custom2' => ['group' => 'other/custom', 'caption' => 'Other Page 2', 'perm' => 'Y'],
|
||||
'other/custom' => ['caption' => 'Other Pages', 'perm' => 'P', 'icon' => 'fa-asterisk'],
|
||||
'other/custom1' => ['group' => 'other/custom', 'caption' => 'Other Page 1', 'perm' => 'P'],
|
||||
'other/custom2' => ['group' => 'other/custom', 'caption' => 'Other Page 2', 'perm' => 'P'],
|
||||
|
||||
'misc/custom' => ['caption' => 'Misc Pages', 'perm' => 'Y', 'icon' => 'fa-asterisk'],
|
||||
'misc/custom1' => ['group' => 'misc/custom', 'caption' => 'misc Page 1', 'perm' => 'Y'],
|
||||
'misc/custom2' => ['group' => 'misc/custom', 'caption' => 'misc Page 2', 'perm' => 'Y'],
|
||||
'misc/custom' => ['caption' => 'Misc Pages', 'perm' => 'P', 'icon' => 'fa-asterisk'],
|
||||
'misc/custom1' => ['group' => 'misc/custom', 'caption' => 'misc Page 1', 'perm' => 'P'],
|
||||
'misc/custom2' => ['group' => 'misc/custom', 'caption' => 'misc Page 2', 'perm' => 'P'],
|
||||
|
||||
'cat/custom' => ['caption' => 'Category Pages', 'perm' => 'Y', 'icon' => 'fa-asterisk'],
|
||||
'cat/custom1' => ['group' => 'cat/custom', 'caption' => 'Category Page 1', 'perm' => 'Y'],
|
||||
'cat/custom2' => ['group' => 'cat/custom', 'caption' => 'Category Page 2', 'perm' => 'Y'],
|
||||
'cat/custom' => ['caption' => 'Category Pages', 'perm' => 'P', 'icon' => 'fa-asterisk'],
|
||||
'cat/custom1' => ['group' => 'cat/custom', 'caption' => 'Category Page 1', 'perm' => 'P'],
|
||||
'cat/custom2' => ['group' => 'cat/custom', 'caption' => 'Category Page 2', 'perm' => 'P'],
|
||||
|
||||
'treatment' => array('caption'=> "Treatment", 'perm' => 'P', 'icon'=>'fas-syringe'),
|
||||
'treatment/day' => array('group'=>'treatment', 'caption'=> "Treatment Today (Status)", 'perm' => 'P', 'icon'=>'fas-syringe'),
|
||||
@@ -208,6 +208,7 @@ class e_admin_dispatcherTest extends \Codeception\Test\Unit
|
||||
|
||||
$result = $this->dp->renderMenu(true);
|
||||
|
||||
|
||||
$this::assertNotEmpty($result, 'Render menu result is empty');
|
||||
$this::assertArrayNotHasKey('main/list', $result, 'Main list menu item should NOT be present');
|
||||
$this::assertNotEmpty($result['main/create'], 'Main create menu item should be present');
|
||||
@@ -216,7 +217,10 @@ class e_admin_dispatcherTest extends \Codeception\Test\Unit
|
||||
$this::assertArrayNotHasKey('other/custom', $result, 'Other custom group should NOT be present');
|
||||
|
||||
$this::assertArrayNotHasKey('cat/custom', $result, 'Category group should NOT be present');
|
||||
$this::assertArrayHasKey('treatment', $result, 'Treatment group should be present '); // This is failing.
|
||||
|
||||
// $this::assertArrayHasKey('treatment/day', $result, 'Treatment day sub-item should be present'); // This is failing.
|
||||
$this::assertArrayHasKey('schedule/week', $result['treatment']['sub'], 'Treatment Today (Status) should be present '); // This is failing.
|
||||
|
||||
$this::assertArrayHasKey('treatment/day', $result['treatment']['sub'], 'Treatment Today (Scheduled) should be present'); // This is failing.
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user