[icinga-checkins] icinga.org: icingaweb2-module-director/master: BaseTestCase: add simple test bootstrapping

git at icinga.org git at icinga.org
Thu Feb 25 18:37:03 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 9cd5f46a681996e553e8e2c669f5e017491b245a
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=9cd5f46a681996e553e8e2c669f5e017491b245a

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Feb 25 18:23:05 2016 +0100

BaseTestCase: add simple test bootstrapping

---

 library/Director/Test/BaseTestCase.php |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/library/Director/Test/BaseTestCase.php b/library/Director/Test/BaseTestCase.php
new file mode 100644
index 0000000..3f543e3
--- /dev/null
+++ b/library/Director/Test/BaseTestCase.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Icinga\Module\Director\Test;
+
+use Icinga\Application\Cli;
+use PHPUnit_Framework_TestCase;
+
+class BaseTestCase extends PHPUnit_Framework_TestCase
+{
+    private $app;
+
+    public function setUp()
+    {
+        $this->app();
+    }
+
+    protected function app()
+    {
+        if ($this->app === null) {
+            $testModuleDir = $_SERVER['PWD'];
+            $libDir = dirname(dirname($testModuleDir)) . '/library';
+            require_once $libDir . '/Icinga/Application/Cli.php';
+            $this->app = Cli::start();
+        }
+
+        return $this->app;
+    }
+}



More information about the icinga-checkins mailing list