示例#1
0
 public function testCreateRoleWithAccessPermissions()
 {
     $this->acl->getRoleManager()->add('Editor', 'Content editor');
     $this->acl->getResourceManager()->add('mvc:wiki:Frontend\\Handbook', "Wiki hand books", array("index", "edit", "add", "delete"));
     $this->acl->getResourceManager()->add('mvc:wiki:Frontend\\Articles', "Wiki articles", array("index", "add"));
     $this->assertCount(1, array_filter($this->acl->getRoles(), function ($role) {
         return $role->getName() === 'Editor';
     }));
     $this->assertCount(2, array_filter($this->acl->getResourceManager()->getResources(), function ($resource) {
         return in_array($resource->getName(), ['mvc:wiki:Frontend-Handbook', 'mvc:wiki:Frontend-Articles']);
     }));
 }