Set extensions directory for tests
- amik
- Member | 118
Hi,
I'm just thinking about how to set extension directory for PHP in ini files for
tests. When I use custom php.ini for my tests, it looks for extensions in
C:\PHP\ext (probably default), which is wrong in my case.
Putting my local absolute path to PHP extensions into test ini files seems as total nonsense for me, is there any other way to specify extension path for tests? How do you solve this?
Thanks.
- Milo
- Nette Core | 1283
I don't know about universal solution. Any computer can have a different environment. Two solutions I'm using:
1)
- distribute INI file as a
php.example.ini
with emptyextensions_dir=
- copy it as
php.ini
on specific PC, edit the path in it - add it into
.git/info/exclude
to ignore it
2)
- call Tester as
tester -c tests/php.ini -d extension_dir=/path/to/ext tests
- amik
- Member | 118
Thanks for answer @Milo , I assume that this is a bit pain always then. I finally figured out this solution, most suitable for me (.sh script to run tests, lets me have custom php.ini and extract extension_dir from PHP CLI's php.ini without need of manual edits):
cp ./tests/php-unix.ini ./tests/php.ini # php.ini is ignored
PHP_EXT=`php -r "echo ini_get('extension_dir');"`
echo "" >> ./tests/php.ini # ensure newline at the end
echo "extension_dir=$PHP_EXT" >> ./tests/php.ini
./libs/composer/bin/tester ./tests -p php -c ./tests
Last edited by amik (2015-09-30 08:52)