PhpManagerTestCase.php 846 Bytes
Newer Older
tof06 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<?php

namespace yiiunit\framework\rbac;

use Yii;
use yii\rbac\PhpManager;

/**
 * @group rbac
 * @property \yii\rbac\PhpManager $auth
 */
class PhpManagerTestCase extends ManagerTestCase
{
    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();
    }

    protected function tearDown()
    {
        parent::tearDown();
        @unlink($this->auth->authFile);
    }

    public function testSaveLoad()
    {
        $this->prepareData();
        $this->auth->save();
        $this->auth->clearAll();
        $this->auth->load();
        // TODO : Check if loaded and saved data are the same.
    }

}