Unit Testing: Multiple Tests not working

Hi!

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


D:\progs\xampp\yii\framework\db\ar\CActiveRecord.php:511

D:\progs\xampp\yii\framework\base\CModel.php:423

D:\progs\xampp\yii\demos\blog\protected\tests\unit\CommentTest.php:45

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


Invalid argument supplied for foreach()


D:\progs\xampp\yii\framework\test\CDbFixtureManager.php:345

D:\progs\xampp\yii\framework\test\CDbTestCase.php:73



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()

	{

with


$this->setUp();

all assertions are true.

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