write chagelog of debugger in its interface
[plcapi.git] / tests / 2InvalidHostTest.php
index 685bd59..7e0062c 100644 (file)
@@ -4,6 +4,9 @@ include_once __DIR__ . '/../lib/xmlrpc.inc';
 
 include_once __DIR__ . '/parse_args.php';
 
+/**
+ * Tests involving requests sent to non-existing servers
+ */
 class InvalidHostTest extends PHPUnit_Framework_TestCase
 {
     /** @var xmlrpc_client $client */
@@ -15,8 +18,21 @@ class InvalidHostTest extends PHPUnit_Framework_TestCase
         $this->args = argParser::getArgs();
 
         $this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['LOCALSERVER'], 80);
-        if ($this->args['DEBUG']) {
-            $this->client->setDebug($this->args['DEBUG']);
+        $this->client->setDebug($this->args['DEBUG']);
+
+        if ($this->args['DEBUG'] == 1)
+            ob_start();
+    }
+
+    protected function tearDown()
+    {
+        if ($this->args['DEBUG'] != 1)
+            return;
+        $out = ob_get_clean();
+        $status = $this->getStatus();
+        if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
+            || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
+            echo $out;
         }
     }