PhpManagerTest.php 770 Bytes
Newer Older
Alexander Kochetov committed
1 2 3 4
<?php

namespace yiiunit\framework\rbac;

Alexander Kochetov committed
5
use Yii;
Alexander Kochetov committed
6 7
use yii\rbac\PhpManager;

8 9 10
/**
 * @group rbac
 */
Alexander Makarov committed
11
class PhpManagerTest extends ManagerTestCase
Alexander Kochetov committed
12
{
13 14 15 16 17 18 19 20 21 22 23
    protected function setUp()
    {
        parent::setUp();
        $this->mockApplication();
        $authFile = Yii::$app->getRuntimePath() . '/rbac.php';
        @unlink($authFile);
        $this->auth = new PhpManager;
        $this->auth->authFile = $authFile;
        $this->auth->init();
        $this->prepareData();
    }
Alexander Kochetov committed
24

25 26 27 28 29
    protected function tearDown()
    {
        parent::tearDown();
        @unlink($this->auth->authFile);
    }
Alexander Kochetov committed
30

31 32 33 34 35 36 37
    public function testSaveLoad()
    {
        $this->auth->save();
        $this->auth->clearAll();
        $this->auth->load();
        $this->testCheckAccess();
    }
Alexander Kochetov committed
38
}