You are here

public function CkeditorCodeMirrorBasicTest::testEnableCkeditorCodeMirrorPlguin in CKEditor CodeMirror 7

Enable CKEditor CodeMirror plugin.

File

./ckeditor_codemirror.test, line 57
Tests for CKEditor CodeMirror module.

Class

CkeditorCodeMirrorBasicTest
@file Tests for CKEditor CodeMirror module.

Code

public function testEnableCkeditorCodeMirrorPlguin() {
  $this
    ->drupalGet('admin/config/content/ckeditor/edit/Advanced');
  $this
    ->assertText(t('CodeMirror (Source) Syntax Highlighting.'));
  $this
    ->assertNoFieldChecked('edit-loadplugins-codemirror');
  $edit = array();
  $edit['loadPlugins[codemirror]'] = TRUE;
  $this
    ->drupalPost('admin/config/content/ckeditor/edit/Advanced', $edit, t('Save'));
  $this
    ->assertText(t('Your CKEditor profile was updated.'));
  $this
    ->drupalGet('node/add/article');
  if (($library = libraries_detect('ckeditor.codemirror')) && !empty($library['library path'])) {
    if (isset($this->drupalSettings['ckeditor']['input_formats']['filtered_html']['loadPlugins']['codemirror'])) {
      $this
        ->pass(t('CKEditor CodeMirror plugin has been found.'));
    }
    else {
      $this
        ->fail(t('CKEditor CodeMirror plugin has not been found.'));
    }
  }
}