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.


/trackstar/protected/tests/unit/ProjectTest.php:69


FAILURES!

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(is_array($options));

	$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"]

[/size][/font][/color]

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?

2528

tbl_project.php

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

2533

tbl_user.php

2534

Project.php

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.