diff --git a/_test/tests/inc/io_replaceinfile.test.php b/_test/tests/inc/io_replaceinfile.test.php index f67ebcaba0c026bd9425053d0b448120d1882172..2e46fc551c49912cf9e94f4170b35c629161ca17 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));