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

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

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

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