- <?php
- * @file
- * Tests for ckeditor.module.
- */
-
- * CKEditor 4 testing class specific for right-to-left languages.
- */
- class CKEditorRtlTestCase extends BackdropWebTestCase {
-
- * User object.
- *
- * @var object
- */
- protected $adminUser;
-
- * Profile name.
- *
- * @var string
- */
- protected $profile = 'standard';
-
-
- * Set up environment.
- */
- public function setUp() {
- parent::setUp('ckeditor', 'language', 'locale');
-
- $arabic = (object) array(
- 'langcode' => 'ar',
- 'name' => 'Arabic',
- 'direction' => LANGUAGE_RTL,
- );
- language_save($arabic);
-
-
- config_set('system.core', 'error_level', 'all');
-
-
- $this->adminUser = $this->backdropCreateUser(array(
- 'administer filters',
- 'access administration pages',
- 'access content',
- 'administer nodes',
- ));
- $this->backdropLogin($this->adminUser);
- }
-
-
- * Test that the CKEditor 4 admin form works correctly with RTL languages.
- */
- public function testRtlAdminIcons() {
- $arabic = language_load('ar');
- $notice = '<em class="placeholder">Notice</em>: Undefined index: image_rtl in <em class="placeholder">{closure}()</em>';
-
- $this->backdropGet('admin/config/content/formats/filtered_html', array('language' => $arabic));
-
- $edit = array(
- 'editor' => 'ckeditor',
- 'editor_settings[toolbar]' => '[[{"name":"Formatting","items":["Bold","Italic"]}]]',
- );
- $this->backdropPost(NULL, $edit, t('Save configuration'));
- $this->backdropGet('admin/config/content/formats/filtered_html', array('language' => $arabic));
-
-
- $this->assertNoRaw($notice, '"Notice: Undefined index: image_rtl in {closure}()" not found');
-
-
- $script_tag = $this->xpath('//script[contains(text(), :string)]', array(':string' => 'window.Backdrop'));
- $js_settings = (string) $script_tag[0];
-
- $icons = array(
- 'bold' => 'ckeditor\\\/images\\\/buttons\\\/bold.png',
- 'italic' => 'ckeditor\\\/images\\\/buttons\\\/italic.png',
- 'blockquote' => 'ckeditor\\\/images\\\/buttons\\\/blockquote.png',
- 'cut' => 'ckeditor\\\/images\\\/buttons\\\/cut.png',
- 'copy' => 'ckeditor\\\/images\\\/buttons\\\/copy.png',
- 'paste' => 'ckeditor\\\/images\\\/buttons\\\/paste.png',
- 'justifyblock' => 'ckeditor\\\/images\\\/buttons\\\/justifyblock.png',
- );
-
- foreach ($icons as $name => $icon) {
- $this->assertTrue(preg_match('#' . $icon . '#', $js_settings, $matches), format_string('Image src found for %icon', array('%icon' => $name)));
- }
- }
-
- }