I am currently trying to pass the testUserAccessBasedOnProjectRole, but phpunit returns the error:
Failed asserting that false is true
… apparently on line 96.
Here is the code for the function, which as far as I can tell, mirrors the text correctly:
public function testUserAccessBasedOnProjectRole()
{
$row1 = $this->projUserRole['row1'];
Yii::app()->user->setId($row1['user_id']);
$project=Project::model()->findByPk($row1['project_id']);
$auth = Yii::app()->authManager;
$bizRule='return isset($params["project"]) && $params["project"]->isUserInRole("member");';
$auth->assign('member',$row1['user_id'],$bizRule);
$params=array('project'=>$project);
$this->assertTrue(Yii::app()->user->checkAccess('updateIssue',$params));
$this->assertTrue(Yii::app()->user->checkAccess('readIssue',$params));
$this->assertFalse(Yii::app()->user->checkAccess('updateProject',$params));
}
I also checked the database and everything appears to be correct. User 2 is assigned to Project 2 as a member, the bizrule is in the AuthAssignment table, readIssue is assigned to reader in AuthItemChild, updateIssue to member, and updateProject to owner.
I can’t see any reason why the test would fail the assertion.