Yii Phpunit Testing On Local Windows Machine

Hello everyone,

for my internship i have to write test cases for my project, and this is completely new for me.

I downloaded the phpunit.phar (v3.7 stable) from the official website: http://phpunit.de/, and moved this file to: protected\tests\unit.

then i made this simple testcase and placed it in the same folder.




<?php

	

class firstTest extends CTestCase {


    public function testHelloworld() {

	$val = TRUE;

	$this->assertTrue( $val );

    }

}


?>



But when i try to run the test with the following command: php phpunit.phar firstTest.php, i get a fatal error which is telling me that it can’t find the CtestCase class file.

does anyone know what i’am doing wrong, or how to solve this?

Thanks in advance.

Go to your test directory (not directly into unit), e.g. /my-yii-directory/protected/tests and you issue the command:


php phpunit.phar unit/firstTest.php

It should work then. If not, the most likely reason is that some components for PHPunit are missing. Let me know if it works for you.

Hey thanks for your answer, but i still get the same error :(

I think i am one step furder, i indeed have to start the test from the test folder, instead of the unit folder.

and my path to yiit in bootstrap.php was wrong, after i made the correct changes i now get a different error: failed opening required ‘phpunit/extensions/seleniumtestcase.php’

as long as you do not need selenium, remove the corresponding lines in phpunit.xml

Hey thanks for replying,

i removed the following lines from the phpunit.xml:




	<selenium>

		<browser name="Internet Explorer" browser="*iexplore" />

		<browser name="Firefox" browser="*firefox" />

	</selenium>



but i still get the same error.