From 9e17ff21ba6ceec19d57a4c429727ef807d4cd4f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 23 Nov 2016 10:12:25 +0100 Subject: [PATCH] Test: add base test framework --- library/Businessprocess/Test/BaseTestCase.php | 47 +++++++++++++++++++ library/Businessprocess/Test/Bootstrap.php | 28 +++++++++++ phpunit.xml | 18 +++++++ test/bootstrap.php | 9 ++++ test/config/authentication.ini | 0 test/config/config.ini | 0 6 files changed, 102 insertions(+) create mode 100644 library/Businessprocess/Test/BaseTestCase.php create mode 100644 library/Businessprocess/Test/Bootstrap.php create mode 100644 phpunit.xml create mode 100644 test/bootstrap.php create mode 100644 test/config/authentication.ini create mode 100644 test/config/config.ini diff --git a/library/Businessprocess/Test/BaseTestCase.php b/library/Businessprocess/Test/BaseTestCase.php new file mode 100644 index 0000000..8154bd4 --- /dev/null +++ b/library/Businessprocess/Test/BaseTestCase.php @@ -0,0 +1,47 @@ +app(); + } + + /** + * @param null $subDir + * @return string + */ + protected function getTestsBaseDir($subDir = null) + { + $dir = dirname(dirname(dirname(__DIR__))) . '/test'; + if ($subDir === null) { + return $dir; + } else { + return $dir . '/' . ltrim($subDir, '/'); + } + } + + /** + * @return ApplicationBootstrap + */ + protected function app() + { + if (self::$app === null) { + self::$app = Icinga::app(); + } + + return self::$app; + } +} diff --git a/library/Businessprocess/Test/Bootstrap.php b/library/Businessprocess/Test/Bootstrap.php new file mode 100644 index 0000000..3bd5187 --- /dev/null +++ b/library/Businessprocess/Test/Bootstrap.php @@ -0,0 +1,28 @@ +getModuleManager() + ->loadModule('businessprocess', $basedir); + } +} diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..72f31b3 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,18 @@ + + + + + test/php + + + diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 0000000..9a0fe64 --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,9 @@ +