Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
allow a second bite of the cherry.
Browse files Browse the repository at this point in the history
either

foo/bar/zum.php has
foo/bar/zum.test.php

OR

foo/bar/zum.php has
tests/foo/bar/zumTest.php
  • Loading branch information
AD7six committed Aug 17, 2011
1 parent 1508adb commit 431fbad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions php/phpunit.php
Expand Up @@ -11,12 +11,15 @@
if (!preg_match('@\.php$@', $file)) {
continue;
}
if (preg_match('@\.test\.php$@', $file)) {
if (preg_match('@(?:\.test|Test)\.php$@', $file)) {
$test = $file;
} else {
$test = preg_replace('@\.php$@', '.test.php', $file);
if (!file_exists($test)) {
continue;
$test = 'tests/' . preg_replace('@\.php$@', 'Test.php', $file);
if (!file_exists($test)) {
continue;
}
}
}

Expand Down

0 comments on commit 431fbad

Please sign in to comment.