Files
moodle/lib/editor/tinymce/tests/editor_test.php
T
Petr Škoda b3aefe3cc8 MDL-34990 improve custom toolbar setting parsing
It is probably better to parse the setting every time because somebody may put unsupported values directly into config.php, performance should not be an issue because we do not have editors on every page.
2012-08-24 16:11:00 +02:00

54 lines
1.8 KiB
PHP

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* TinyMCE tests.
*
* @package editor_tinymce
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* TinyMCE tests.
*
* @package editor_tinymce
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class editor_tinymce_testcase extends advanced_testcase {
public function test_toolbar_parsing() {
global $CFG;
require_once("$CFG->dirroot/lib/editorlib.php");
require_once("$CFG->dirroot/lib/editor/tinymce/lib.php");
$result = tinymce_texteditor::parse_toolbar_setting("bold,italic\npreview");
$this->assertSame(array('bold,italic', 'preview'), $result);
$result = tinymce_texteditor::parse_toolbar_setting("| bold,|italic*blink\rpreview\n\n| \n paste STYLE | ");
$this->assertSame(array('bold,|,italic,blink', 'preview', 'paste,style'), $result);
$result = tinymce_texteditor::parse_toolbar_setting("| \n\n| \n \r");
$this->assertSame(array(), $result);
}
}