Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
namespace core;
use filter_manager;
/**
* Unit tests for the {@link filter_manager} class.
*
* @package core
* @category test
* @copyright 2015 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class filter_manager_test extends \advanced_testcase {
/**
* Helper method to apply filters to some text and return the result.
* @param string $text the text to filter.
* @param array $skipfilters any filters not to apply, even if they are configured.
* @return string the filtered text.
*/
protected function filter_text($text, $skipfilters) {
global $PAGE;
$filtermanager = filter_manager::instance();
$filtermanager->setup_page_for_filters($PAGE, $PAGE->context);
$filteroptions = array(
'originalformat' => FORMAT_HTML,
'noclean' => false,
);
return $filtermanager->filter_text($text, $PAGE->context, $filteroptions, $skipfilters);
}
public function test_filter_normal() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
$this->assertMatchesRegularExpression(
'~^![smile smile]()
$~',
$this->filter_text(':-)
', array()));
}
public function test_one_filter_disabled() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
$this->assertEquals(':-)
',
$this->filter_text(':-)
', array('emoticon')));
}
public function test_disabling_other_filter_does_not_break_it() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
$this->assertMatchesRegularExpression('~^
$~',
$this->filter_text(':-)
', array('urltolink')));
}
public function test_one_filter_of_two_disabled() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
filter_set_global_state('urltolink', TEXTFILTER_ON);
$this->assertMatchesRegularExpression('~^
http://google.com/
$~',
$this->filter_text(':-) http://google.com/
', array('glossary', 'urltolink')));
}
}