-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from jpwhite4/unit_test_harness
Added a unit test harness.
- Loading branch information
Showing
6 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Open XDMoD SUPReMM module Unit Tests | ||
===================== | ||
|
||
Run the tests: | ||
|
||
$ ./runtests.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
$dir = __DIR__; | ||
|
||
// Autoloader for test classes. | ||
spl_autoload_register( | ||
function ($className) use ($dir) { | ||
$classPath | ||
= $dir | ||
. '/lib/' | ||
. str_replace('_', '/', $className) | ||
. '.php'; | ||
|
||
if (is_readable($classPath)) { | ||
return require_once $classPath; | ||
} else { | ||
return false; | ||
} | ||
} | ||
); | ||
|
||
// Autoloader for SUPReMM module classes | ||
spl_autoload_register( | ||
function ($className) use ($dir) { | ||
$classPath | ||
= $dir | ||
. '/../classes/' | ||
. str_replace('\\', '/', $className) | ||
. '.php'; | ||
|
||
error_log("Checking ".$classPath); | ||
if (is_readable($classPath)) { | ||
return require_once $classPath; | ||
} else { | ||
return false; | ||
} | ||
} | ||
); | ||
|
||
// Autoloader for XDMoD classes. | ||
require_once __DIR__ . '/../../xdmod/configuration/linker.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd" | ||
backupGlobals="true" | ||
backupStaticAttributes="false" | ||
bootstrap="bootstrap.php" | ||
cacheTokens="true" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
forceCoversAnnotation="false" | ||
mapTestClassNameToCoveredClassName="false" | ||
printerClass="PHPUnit_TextUI_ResultPrinter" | ||
processIsolation="false" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" | ||
verbose="true"> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
if { ! which phpunit >/dev/null 2>&1; } then | ||
echo phpunit not found 1>&2 | ||
exit 127 | ||
fi | ||
|
||
cd $(dirname $0) | ||
phpunit . | ||
exit $? |