Unit Testing: Multiple Tests not working


I encountered the following problem: While the first test (test function) is executed properly, I am always getting strange errors from the following tests. If I put all tests into one large function (separated by $this->setUp()), everything works fine.

I am running XAMPP. The problem occures with Yii 1.1alpha and yesterday’s nightly.

Everything is reproducible with demos/blog/protected/tests/unit/CommentTest.php (i.e. the error message as well as the "workaround" with one large test function with $this->setUp()).

What is the error you saw?

With demos/blog/protected/tests/unit/CommentTest.php it is

1) CommentTest::testApprove

array_keys() expects parameter 1 to be array, null given




But with my tests, I got other errors as well, e.g.

Invalid argument supplied for foreach()



when trying to access a fixture.

Did you make any changes to the demo? I couldn’t reproduce the issue.

For your own test, did you define primary key for all your tables?

No. I used a completely new Yii download.

If, however if replace


	public function testApprove()




all assertions are true.

I am having this same problem. Was a solution ever found?