mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'ticket/naderman/9701' into develop-olympus
* ticket/naderman/9701: [ticket/9701] Prevent notices from being hidden by template tests
This commit is contained in:
commit
88f6caf012
1 changed files with 21 additions and 3 deletions
|
@ -26,12 +26,24 @@ class phpbb_template_template_test extends phpbb_test_case
|
||||||
error_reporting($error_level & ~E_NOTICE);
|
error_reporting($error_level & ~E_NOTICE);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->assertTrue($this->template->display($handle, false));
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->assertTrue($this->template->display($handle, false));
|
||||||
|
}
|
||||||
|
catch (Exception $exception)
|
||||||
|
{
|
||||||
|
// reset the error level even when an error occured
|
||||||
|
// PHPUnit turns trigger_error into exceptions as well
|
||||||
|
error_reporting($error_level);
|
||||||
|
throw $exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = self::trim_template_result(ob_get_clean());
|
||||||
|
|
||||||
// reset error level
|
// reset error level
|
||||||
error_reporting($error_level);
|
error_reporting($error_level);
|
||||||
|
return $result;
|
||||||
return self::trim_template_result(ob_get_clean());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function trim_template_result($result)
|
private static function trim_template_result($result)
|
||||||
|
@ -368,9 +380,15 @@ class phpbb_template_template_test extends phpbb_test_case
|
||||||
$this->template->destroy_block_vars($block);
|
$this->template->destroy_block_vars($block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$error_level = error_reporting();
|
||||||
|
error_reporting($error_level & ~E_NOTICE);
|
||||||
|
|
||||||
$this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
|
$this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
|
||||||
|
|
||||||
$this->template->assign_display('test', 'VARIABLE', false);
|
$this->template->assign_display('test', 'VARIABLE', false);
|
||||||
|
|
||||||
|
error_reporting($error_level);
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
|
$this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue