Yii Framework Forum: Yii Access Control Lists Class Not Found In Unit Test - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Access Control Lists Class Not Found In Unit Test Rate Topic: -----

#1 User is offline   alpiz2012 

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

Posted 29 October 2012 - 11:32 AM

Hi
I did this unit test:

class AclTest extends CDbTestCase
{
function testGroup()
{
$rGroup = new RGroup();
$rGroup->alias = "Lavagna";
$rGroup->save();
}
}

but when i do:

phpunit unit/AclTest

i get:
PHP Fatal error: Class 'RGroup' not found in C:\wamp\www\visualshopping\protect
ed\tests\unit\AclTest.php on line 28

help please!
0

#2 User is offline   zeroByte 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 17-February 12

Posted 25 November 2012 - 04:10 PM

The class is just a shortcut to whatever strategy you use - it is generated using runtime. To load the config (and generate this class), you need to call
Strategy::initialize();

before. This can be done in a global controller for instance.

A good place to look is tests/unit/features/* - you can see how things are used there. You might to take a look at BusinessRulesTest.php in the first place because though all of them are advanced examples, this is the easiest one ;-)



Regards,
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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