Unit test Fails

Booted my computer up again today to get back into the book. I went to run all of my unit tests again, which past just last night (no code was changed or edited), and I have a failure. The failure is as follows:

1) ProjectTest::testGetUserOptions

Failed asserting that false is true.



Tests: 5, Assertions: 12, Failures: 1.

The line it is pertaining too is the last assertTrue:

public function testGetUserOptions()


	$project = $this->projects('project1');

	$options = $project->userOptions;


	$this->assertTrue(count($options) > 0);


So I started looking around. Low and behold when I query for all the records in my tbl_user from the trackstar_test database that is configured I get nothing. MySQL tells me the table is empty.

So I experimented, I added data to the table. Ran the unit test again. It fails. Table is empty again.

Now quoting from the Definitive Guide to Yii on this site

[color="#222222"][font="Arial, sans-serif"] [/font][/color]

[color="#222222"][font="Arial, sans-serif"][size="4"]


So this leads me to believe something is either wrong with my fixtures or Yii. Odd since they were working just last night and I have not changed them. However, I cannot find anything wrong with them.

My ProjectTest.php has the fixtures defined as:

	public $fixtures = array(

		'projects' => 'Project',

		'users' => 'User',

		'projUsrAssign' => ':tbl_project_user_assignment',


I am either about to lose my mind or I have to blame Yii…

Anyone have any ideas? Let me know what info I can provide to help.

What is the content of protected/tests/fixtures/tbl_project.php file?



Also I need your protected/tests/fixtures/tbl_user.php and protected/models/Project.php files.





I feel like a real idiot…

Turns out I previously named my test fixture ‘tbl_users’ and not ‘tbl_user’ which is the database table name.