Yii Framework Forum: Chapter 8 Unit Test Failure - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Chapter 8 Unit Test Failure testUserAccessBasedOnProjectRole fails

#1 User is offline   TheSchaef 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 27-July 12
  • Location:Columbus, OH

Posted 31 July 2012 - 07:38 AM

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'];
$auth = Yii::app()->authManager;
$bizRule='return isset($params["project"]) && $params["project"]->isUserInRole("member");';

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.

#2 User is offline   dhimes 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 07-August 12

Posted 24 August 2012 - 11:09 AM

Which line is #96? I'm not sure what is failing here. I am on the same function, but I am getting

CException: Unknown authorization item "member"

I suspect that I am supposed to have entries in those databases that were set up- probably when running the yiic shell RbacCommand script, but they are empty. I'm not even sure what they should contain.

#3 User is offline   Allen Ahner 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 23-October 12

Posted 23 October 2012 - 03:20 PM

I am having the same issue. Has this been solved?

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users