MDL-52487 rss: PHP 7 compatible error supression
[moodle.git] / lib / tests / rsslib_test.php
index a10d05a..51648c9 100644 (file)
@@ -99,7 +99,12 @@ EOD;
      * Test retrieving a url which doesn't exist.
      */
     public function test_failurl() {
-        $feed = @new moodle_simplepie($this->getExternalTestFileUrl('/rsstest-which-doesnt-exist.xml'), self::TIMEOUT); // We do not want this in php error log.
+        global $CFG;
+
+        // We do not want this in php error log.
+        $errorlevel = error_reporting($CFG->debug & ~E_USER_NOTICE);
+        $feed = new moodle_simplepie($this->getExternalTestFileUrl('/rsstest-which-doesnt-exist.xml'), self::TIMEOUT);
+        error_reporting($errorlevel);
 
         $this->assertNotEmpty($feed->error());
     }