From bd3cb3d556bffb5615ea60d7b9372e49403084ab Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 12 Mar 2017 09:00:29 +0100
Subject: [PATCH] make use of exception wrapper in io test

---
 _test/tests/inc/io_replaceinfile.test.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/_test/tests/inc/io_replaceinfile.test.php b/_test/tests/inc/io_replaceinfile.test.php
index f67ebcaba..2e46fc551 100644
--- a/_test/tests/inc/io_replaceinfile.test.php
+++ b/_test/tests/inc/io_replaceinfile.test.php
@@ -101,12 +101,11 @@ class io_replaceinfile_test extends DokuWikiTest {
     function test_badparam()
     {
         if (class_exists('PHPUnit\Framework\Error\Warning')) {
-            // PHPUnit 6
-            $this->expectException(PHPUnit\Framework\Error\Warning::class);
+            $expect = PHPUnit\Framework\Error\Warning::class; // PHPUnit 6
         } else {
-            // PHPUnit 5
-            $this->expectException(PHPUnit_Framework_Error_Warning::class);
+            $expect = PHPUnit_Framework_Error_Warning::class; // PHPUnit 5
         }
+        $this->setExpectedException($expect);
 
         /* The empty $oldline parameter should be caught before the file doesn't exist test. */
         $this->assertFalse(io_replaceInFile(TMP_DIR.'/not_existing_file.txt', '', '', false, 0));
-- 
GitLab