Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/ift/web/core/modules/ckeditor/tests/src/Kernel/Plugin/CKEditorPlugin/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/ift/web/core/modules/ckeditor/tests/src/Kernel/Plugin/CKEditorPlugin/InternalTest.php

<?php

namespace Drupal\Tests\ckeditor\Kernel\Plugin\CKEditorPlugin;

use Drupal\editor\Entity\Editor;
use Drupal\filter\Entity\FilterFormat;
use Drupal\KernelTests\KernelTestBase;

/**
 * @coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal
 *
 * @group ckeditor
 */
class InternalTest extends KernelTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = [
    'ckeditor',
    'ckeditor_test',
    'filter',
    'editor',
  ];

  /**
   * A testing text format.
   *
   * @var \Drupal\filter\Entity\FilterFormat
   */
  protected $format;

  /**
   * A testing text editor.
   *
   * @var \Drupal\editor\Entity\Editor
   */
  protected $editor;

  /**
   * The CKEditor plugin manager.
   *
   * @var \Drupal\Component\Plugin\PluginManagerInterface
   */
  protected $ckeditorPluginManager;

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this->installEntitySchema('editor');
    $this->installEntitySchema('filter_format');

    $this->format = FilterFormat::create([
      'format' => 'test_format',
      'name' => $this->randomMachineName(),
    ]);
    $this->format->save();

    $this->editor = Editor::create([
      'editor' => 'ckeditor',
      'format' => 'test_format',
      'settings' => [
        'toolbar' => [
          'rows' => [
            [
              [
                'name' => 'Enabled Buttons',
                'items' => [
                  'Format',
                ],
              ],
            ],
          ],
        ],
      ],
    ]);
    $this->editor->save();

    $this->ckeditorPluginManager = $this->container->get('plugin.manager.ckeditor.plugin');
  }

  /**
   * Test the format tags settings.
   *
   * @dataProvider formatTagsSettingsTestCases
   */
  public function testFormatTagsSettings($filter_plugins, $expected_format_tags) {
    foreach ($filter_plugins as $filter_plugin_id => $filter_plugin_settings) {
      $this->format->setFilterConfig($filter_plugin_id, $filter_plugin_settings);
    }
    $this->format->save();

    $internal_plugin = $this->ckeditorPluginManager->createInstance('internal', []);
    $plugin_config = $internal_plugin->getConfig($this->editor);
    $this->assertEquals($expected_format_tags, explode(';', $plugin_config['format_tags']));
  }

  /**
   * A data provider for testFormatTagsSettings.
   */
  public function formatTagsSettingsTestCases() {
    $all_tags = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre'];

    return [
      'No filter plugins enabled (all tags allowed)' => [
        [],
        $all_tags,
      ],
      'HTML filter plugin enabled (some tags filtered out)' => [
        [
          'filter_html' => [
            'status' => 1,
            'settings' => [
              'allowed_html' => '<h1> <h2>',
              'filter_html_help' => 1,
              'filter_html_nofollow' => 0,
            ],
          ],
        ],
        ['p', 'h1', 'h2'],
      ],
      'Test attribute filter enabled (all tags allowed)' => [
        [
          'test_attribute_filter' => [
            'status' => 1,
            'settings' => [
              'tags' => ['h1', 'h2'],
            ],
          ],
        ],
        $all_tags,
      ],
    ];
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net