phpunit - $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] not set correctly in Zend Studio -


I established a unit test in Zend Studios last week, and it was working fine .. until some refactoring After all, I got an error that the following file was not found in ZendPHPUnit.php:

  / var / folders / TD / Tdnh ++ 2KEdWAsk8Y0O4N0k +++ TI / -Tmp- / Zend.phpunit.UserMapperTest. Php.2428213892936827201.php   folder 

file path is stored in $ _SERVER ['ZEND_PHPUNIT_TESTS_LOCATION'] in ZendPHPUnit.php

I checked and I found zend.phpunit. UserrMapperTest.php.6031927106542896607.php (Number is different)

So I forced this to work. I was a little desperate

  $ _ server ['ZEND_PHPUNIT_TESTS_LOCATION'] = '/var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.6031927106542896607.php';   

After all, after working with some other test cases, I decided to fix the problem myself. Now, I repeated some code again, and the problem is back. None of my testcoses work.

Restarting the computer does not help, Project - & gt; Clean does not help

Thanks!

The problem is that PHPUnit does not work with files themselves but directories are On the files that it makes on the fly and with copies of the shops, these files created on the fly have been modified to include PHPUnit logic. It has self-test files for Php.ini (which will test you by loading the extension in the main php.ini file Because the additional .i files are ignored). Each time you run a trial, these files will be recreated with a new unique name (original name and unique identifier).

The best way to do this is to create a launch configuration for testing this issue around and save them as .launch files in your project ( for right click - & Gt; Run -> New PHPUnit config can be created - & gt; Select "Shared File" in the General tab tab ). Once you have the launch configs, you can run it by clicking on the editor and clicking on the Run button. You will see that every time you run them, there will be a line like the following on each launch file that has changed (it is easy to see if configs are in version control):

  & lt; MapInterprise key = "ZEND_PHPUNIT_TESTS_LOCATION" value = "/ var / folders / my / ph9spb0s45z5_11l9tqw256r0000gn / tt / default workspace.fipune.assignment controllercardatreative.php.4951739174960507380.php" />   

I usually do this change together with some other changes that I'm working with at that time.

It is still annoying that the file changes and thus launches config, but in this way at least your tests will run and you worry about running manually again. No need to do it, or clean the project, or anything like that.

Comments