2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
20 * @package editor_tinymce
22 * @copyright 2012 Petr Skoda {@link http://skodak.org}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 defined('MOODLE_INTERNAL') || die();
32 * @package editor_tinymce
34 * @copyright 2012 Petr Skoda {@link http://skodak.org}
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37 class editor_tinymce_testcase extends advanced_testcase {
39 public function test_autoloading() {
40 // Note: This test core_frankestyle calssloader.
41 $this->assertTrue(class_exists('editor_tinymce_plugin'));
42 $this->assertFalse(class_exists('editor_tinymce_plugin_xx_yy'));
43 $this->assertFalse(class_exists('\editor_tinymce\plugin'));
46 public function test_toolbar_parsing() {
48 require_once("$CFG->dirroot/lib/editorlib.php");
49 require_once("$CFG->dirroot/lib/editor/tinymce/lib.php");
51 $result = tinymce_texteditor::parse_toolbar_setting("bold,italic\npreview");
52 $this->assertSame(array('bold,italic', 'preview'), $result);
54 $result = tinymce_texteditor::parse_toolbar_setting("| bold,|italic*blink\rpreview\n\n| \n paste STYLE | ");
55 $this->assertSame(array('bold,|,italic,blink', 'preview', 'paste,style'), $result);
57 $result = tinymce_texteditor::parse_toolbar_setting("| \n\n| \n \r");
58 $this->assertSame(array(), $result);
60 $result = tinymce_texteditor::parse_toolbar_setting("one\ntwo\n\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten");
61 $this->assertSame(array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'), $result);