PhpManagerTest.php 687 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;

Carsten Brandt committed
8
//require_once(__DIR__ . '/ManagerTestBase.php');
Alexander Kochetov committed
9 10 11

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

Carsten Brandt committed
24
	protected function tearDown()
Alexander Kochetov committed
25
	{
Carsten Brandt committed
26
		parent::tearDown();
Alexander Kochetov committed
27 28 29 30 31 32 33 34 35 36 37
		@unlink($this->auth->authFile);
	}

	public function testSaveLoad()
	{
		$this->auth->save();
		$this->auth->clearAll();
		$this->auth->load();
		$this->testCheckAccess();
	}
}