Commit 6374f3fc authored by Wim Leers's avatar Wim Leers Committed by Wim Leers
Browse files

Issue #3311367 by Wim Leers, lauriii, Anchal_gupta, xjm, sorabh.v6, Chris...

Issue #3311367 by Wim Leers, lauriii, Anchal_gupta, xjm, sorabh.v6, Chris Burge: Fix "Unknown themes: classy" error in the tests — part two
parent 2719314d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\ckeditor\Plugin\Editor;

use Drupal\Core\Extension\ExtensionPathResolver;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\ckeditor\CKEditorPluginManager;
@@ -389,7 +390,9 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
    if (empty($langcodes)) {
      $langcodes = [];
      // Collect languages included with CKEditor based on file listing.
      $files = scandir('core/assets/vendor/ckeditor/lang');
      $extension_path_resolver = \Drupal::service('extension.path.resolver');
      assert($extension_path_resolver instanceof ExtensionPathResolver);
      $files = scandir($extension_path_resolver->getPath('module', 'ckeditor') . '/vendor/lang');
      foreach ($files as $file) {
        if ($file[0] !== '.' && preg_match('/\.js$/', $file)) {
          $langcode = basename($file, '.js');
+5 −1
Original line number Diff line number Diff line
@@ -22,8 +22,12 @@ class CKEditorUpdateOmitDisabledPluginSettings extends UpdatePathTestBase {
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() {
    // @see https://www.drupal.org/node/3306545
    [$version] = explode('.', \Drupal::VERSION, 2);
    $this->databaseDumpFiles = [
      DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz',
      $version == 9
        ? DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-9.3.0.bare.standard.php.gz'
        : DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz',
    ];
  }

+14 −0
Original line number Diff line number Diff line
@@ -281,6 +281,13 @@ class CKEditorTest extends KernelTestBase {
    $expected[] = $this->fileUrlGenerator->generateString($this->getModulePath('ckeditor_test') . '/css/llama.css') . $query_string;
    $this->assertSame($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a CKEditorPluginInterface implementation exists.');

    // Some things cannot be tested in Drupal 10 anymore.
    // @see https://www.drupal.org/project/drupal/issues/3270438
    [$version] = explode('.', \Drupal::VERSION, 2);
    if ($version == 10) {
      return;
    }

    // Enable the Olivero theme, which specifies a CKEditor stylesheet.
    \Drupal::service('theme_installer')->install(['olivero']);
    $this->config('system.theme')->set('default', 'olivero')->save();
@@ -460,6 +467,13 @@ class CKEditorTest extends KernelTestBase {
    ];
    $this->assertSame($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_relative'));

    // Some things cannot be tested in Drupal 10 anymore.
    // @see https://www.drupal.org/project/drupal/issues/3270438
    [$version] = explode('.', \Drupal::VERSION, 2);
    if ($version == 10) {
      return;
    }

    // Case 4: Install theme which has a Drupal root CSS URL.
    $theme_installer->install(['test_ckeditor_stylesheets_drupal_root']);
    $this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_drupal_root')->save();