Dear all,
I am new to the forum and I hit an odd error and hope for your help here.
At the beginning of chapter 7, I changed my createProject() content to
//create a new project
$newProject = new Project;
$newProjectName = 'Test Project Creation';
$newProject->setAttributes(
array(
'name' => $newProjectName,
'description' => 'This is a test for new project creation',
)
);
//set the application user id to the first users in our fixtures data
Yii::app()->user->setId($this->user('user1')->id);
$this->assertTrue($newProject->save());
When i ran the test, I had an error:
Exception: Unknown method ‘user’ for class ‘ProjectTest’.
at the line of Yii::app()->user->setId($this->user(‘user1’)->id);
I figure this could be the Yii:app() in my development environment was not set up correctly. I found in main.php there is a series of parameter that already set for the app and you can access these for example Yii:app()->name would return ‘My Web Application’. However I cant find where the user variable is created for Yii::app() and how I could set it.
Please give me sone hints on this, or if i missed something previously set up in the book please point it out for me,
Thanks a lot for your help
Tri