Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpunit does not find tests in directory

Tags:

php

phpunit

i am trying to execute all tests in subfolders of my test directory. This works locally on my computer but not on the integration server.

phpunit does not find the test files

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ phpunit tests
PHPUnit 3.4.5 by Sebastian Bergmann.
Time: 0 seconds, Memory: 4.50Mb
OK (0 tests, 0 assertions)

The test file, however, does exist and is readable:

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ find tests -name \*Test.php
tests/scripts/pharauroa/common/net/deserializerTest.php
hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ ls -l tests/scripts/pharauroa/common/net/deserializerTest.php
-rw-r--r-- 1 hudson hudson 6957 Jul 17 12:54 tests/scripts/pharauroa/common/net/deserializerTest.php

I can start it by explicitly specifying it on the command line of phpunit:

hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ phpunit tests/scripts/pharauroa/common/net/deserializerTest.php
PHPUnit 3.4.5 by Sebastian Bergmann.
.....
Time: 0 seconds, Memory: 5.00Mb
OK (5 tests, 32 assertions)

What I tried so far:

Using strace, I can see that phpunit recursively scans the tests directory and even stats the deserializerTest.php file. But it does not open

"phpunit tests" works fine on my local computer. Both computers are running Ubuntu Lucid 10.04 and phpunit 3.4.5. The server is running within a chroot.

I tried to use

phpunit `find tests -name \*.php`

but phpunit only pays attention to the first parameter.

I know that it is possible to write suite classes but that seems like a maintenance nightmare. It feels like I am missing something obvious.

like image 243
Hendrik Brummermann Avatar asked Apr 10 '26 07:04

Hendrik Brummermann


1 Answers

I had the same issue with hudson/phpunit, you should set the "HUDSON_HOME" environment variable, and give a new home directory without any "." in the path. (So surely move it from ~/.hudson !)

See: http://wiki.hudson-ci.org/display/HUDSON/Administering+Hudson

like image 136
spap Avatar answered Apr 11 '26 20:04

spap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!