MDL-40648 Make sure the button is added in the correct row
[moodle.git] / lib / editor / tinymce / tests / editor_test.php
CommitLineData
b3aefe3c
PS
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
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.
8//
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.
13//
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/>.
16
17/**
18 * TinyMCE tests.
19 *
20 * @package editor_tinymce
21 * @category phpunit
22 * @copyright 2012 Petr Skoda {@link http://skodak.org}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
26defined('MOODLE_INTERNAL') || die();
27
28
29/**
30 * TinyMCE tests.
31 *
32 * @package editor_tinymce
33 * @category phpunit
34 * @copyright 2012 Petr Skoda {@link http://skodak.org}
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 */
37class editor_tinymce_testcase extends advanced_testcase {
38
299e107e
PS
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'));
44 }
45
b3aefe3c
PS
46 public function test_toolbar_parsing() {
47 global $CFG;
48 require_once("$CFG->dirroot/lib/editorlib.php");
49 require_once("$CFG->dirroot/lib/editor/tinymce/lib.php");
50
51 $result = tinymce_texteditor::parse_toolbar_setting("bold,italic\npreview");
52 $this->assertSame(array('bold,italic', 'preview'), $result);
53
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);
56
57 $result = tinymce_texteditor::parse_toolbar_setting("| \n\n| \n \r");
58 $this->assertSame(array(), $result);
717a9931
PS
59
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);
b3aefe3c
PS
62 }
63}