Description

Zend_Cache Unit Tests write to a directory in the ZF tests/ tree. Unfortunately, for systems that utilize packaging -- Fedora, Ubuntu -- this causes issues when running tests where the user running the tests is not root. It would be better to utilze the environment's TMPDIR for the tests.

Attached is a patched CommonBackendTest.php file that would correct the issue.

Posted by Fabien MARTY (fab) on 2008-05-28T09:47:21.000+0000

Your patch use a ini config file ?

I don't have it ? And I don't see why ? $this->_root isn't enough ?

Posted by Jess Portnoy (jess04) on 2008-06-01T01:44:45.000+0000

About $this->_root not being enough, consider the following example:

The FC RPM installs ZF under /usr/share. However, the permissions on /usr/share do not allow regular users to write there. Therefore, if a regular user wishes to run the unit tests, he will not be able to create a temp dir under $this->_root.

The config.ini file does not currently exist and should be added. The code looks there first and, if the directive is not found, searches for the ENV var TMPDIR and, if all else fails, attempts to create the tmpdir under $this->_root.

This is similar to my patch only it takes the option of $this->_root . DIRECTORY_SEPARATOR . 'zend_cache_tmp_dir' as preferable and does not allow the option of setting it in an INI file, which might be much more convenient than setting an ENV var.
I think the config.ini option is useful and should be supported.

Any reason why you object to adding config.ini? in the future, it might serve for other things as well..

Posted by Fabien MARTY (fab) on 2008-06-03T10:18:53.000+0000

I don't want a specific configuration file for Zend_Cache

But I will try something with TestConfiguration.php which is a global one

Posted by Jess Portnoy (jess04) on 2008-06-04T00:09:51.000+0000

The idea is not for config.ini to be specific to Zend_Cache. I thought it could be a generic ZF config file which can be used for many other configurable options.
TestConfiguration.php is a bit problematic cause it's more annoying to manipulate via scripting, like a package postinstall script.
I think exporting TMPDIR can probably be sufficient if you really don't like the config.ini idea... But could you concat a timestamp for the zend_cache_tmp_dir? Like:
return getenv('TMPDIR').DIRECTORY_SEPARATOR . 'zend_cache_tmp_dir_'.date("mdyHi");

This is because it might happen that 2 users are trying to execute the unit test at the same time.. this is a multiuser ENV after all :)