diff --git a/_test/tests/inc/io_replaceinfile.test.php b/_test/tests/inc/io_replaceinfile.test.php
index 3fb81b256b8b7d54767d7ed3d6b42337831ece19..61b0e12e0d4e9b453e9d1c2b151ebc8f8570c2b4 100644
--- a/_test/tests/inc/io_replaceinfile.test.php
+++ b/_test/tests/inc/io_replaceinfile.test.php
@@ -109,7 +109,7 @@ class io_replaceinfile_test extends DokuWikiTest {
         } else {
             $expect = 'PHPUnit_Framework_Error_Warning'; // PHPUnit 5
         }
-        $this->setExpectedException($expect);
+        $this->expectException($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));