Browse Source

added testcase of @UncleCoder

e43c503c2d

issue #3817
tags/2.0.0-rc
Carsten Brandt 10 years ago
parent
commit
1a7b4c5383
  1. 12
      tests/unit/framework/rbac/ManagerTestCase.php
  2. 4
      tests/unit/framework/rbac/PhpManagerTest.php

12
tests/unit/framework/rbac/ManagerTestCase.php

@ -45,6 +45,18 @@ abstract class ManagerTestCase extends TestCase
// todo: check duplication of name // todo: check duplication of name
} }
public function testGetChildren()
{
$user = $this->auth->createRole('user');
$this->auth->add($user);
$this->assertCount(0, $this->auth->getChildren($user->name));
$changeName = $this->auth->createPermission('changeName');
$this->auth->add($changeName);
$this->auth->addChild($user, $changeName);
$this->assertCount(1, $this->auth->getChildren($user->name));
}
/* /*
public function testRemove() public function testRemove()
{ {

4
tests/unit/framework/rbac/PhpManagerTestCase.php → tests/unit/framework/rbac/PhpManagerTest.php

@ -9,7 +9,7 @@ use yii\rbac\PhpManager;
* @group rbac * @group rbac
* @property \yii\rbac\PhpManager $auth * @property \yii\rbac\PhpManager $auth
*/ */
class PhpManagerTestCase extends ManagerTestCase class PhpManagerTest extends ManagerTestCase
{ {
protected function setUp() protected function setUp()
{ {
@ -32,7 +32,7 @@ class PhpManagerTestCase extends ManagerTestCase
{ {
$this->prepareData(); $this->prepareData();
$this->auth->save(); $this->auth->save();
$this->auth->clearAll(); $this->auth->removeAll();
$this->auth->load(); $this->auth->load();
// TODO : Check if loaded and saved data are the same. // TODO : Check if loaded and saved data are the same.
} }
Loading…
Cancel
Save