Skip to content

Commit 74279b3

Browse files
committed
Update test runner and stub
1 parent c1809c6 commit 74279b3

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

buildPhar.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
unlink('xml-file.phar');
44
$phar = new Phar('xml-file.phar');
5-
// $phar->buildFromDirectory('src');
6-
// $phar->buildFromIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator('src')));
75
$pattern = '#' . dirname(__FILE__) . '.src.*$#';
86
$pattern = str_replace("\\", "\\\\", $pattern);
9-
print("PATTERN: $pattern");
107
$phar->buildFromDirectory(dirname(__FILE__), $pattern);
118
$phar->addFile("LICENSE");
129
$phar->addFile("VERSION");

src/stub.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
22

33
spl_autoload_register(function ($name) {
4-
$d = (strpos(__FILE__, ".phar") === false ? __DIR__ : "phar://" . __FILE__ . "/src");
5-
if ($name == "xml_file") require_once($d . "/class-xml-file.php");
6-
if ($name == "xml_file_base") require_once($d . "/class-xml-file-base.php");
7-
if ($name == "xml_file_interface") require_once($d . "/class-xml-file-interface.php");
4+
// $d = (strpos(__FILE__, ".phar") === false ? __DIR__ : "phar://" . __FILE__ . "/src");
5+
$d = __DIR__;
6+
switch($name) {
7+
case "xml_file": require_once($d . "/class-xml-file.php"); break;
8+
case "xml_file_base": require_once($d . "/class-xml-file-base.php"); break;
9+
case "xml_file_interface": require_once($d . "/class-xml-file-interface.php"); break;
10+
}
811
});
912
__HALT_COMPILER();

test

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ set -e
33

44
cd $(dirname $0)
55

6+
testFile() {
7+
php ../phpunit-9.5.phar --bootstrap ./src/stub.php $1
8+
}
9+
610
if [[ "$1" == "" ]]; then
7-
../phpunit $1 --bootstrap ./src/stub.php --test-suffix '_test.php,-test.php,Test.php,.phpt' tests
11+
for f in tests/*test.php; do
12+
echo "test: $f"
13+
testFile $f
14+
done
815
else
9-
../phpunit --bootstrap ./src/stub.php $1
16+
testFile $1
1017
fi
File renamed without changes.

0 commit comments

Comments
 (0)