Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor1/web/core/modules/media/tests/src/Kernel/

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/rocksensor1/web/core/modules/media/tests/src/Kernel/EditorMediaDialogTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\media\Kernel;

use Drupal\Core\Form\FormState;
use Drupal\editor\EditorInterface;
use Drupal\filter\Entity\FilterFormat;
use Drupal\KernelTests\KernelTestBase;
use Drupal\media\Entity\Media;
use Drupal\media\Form\EditorMediaDialog;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;

/**
 * @coversDefaultClass \Drupal\media\Form\EditorMediaDialog
 * @group media
 * @group legacy
 */
class EditorMediaDialogTest extends KernelTestBase {

  use MediaTypeCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'field',
    'file',
    'filter',
    'image',
    'media',
    'media_test_source',
    'system',
    'user',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $this->installSchema('file', ['file_usage']);
    $this->installEntitySchema('file');
    $this->installEntitySchema('media');
    $this->installEntitySchema('user');
  }

  /**
   * Tests that the form builds successfully.
   *
   * @covers ::buildForm
   */
  public function testBuildForm(): void {
    $format = FilterFormat::create([
      'filters' => [
        'media_embed' => ['status' => TRUE],
      ],
      'name' => 'Media embed on',
    ]);

    $editor = $this->prophesize(EditorInterface::class);
    $editor->getFilterFormat()->willReturn($format);

    // Create a sample media entity to be embedded.
    $media = Media::create([
      'bundle' => $this->createMediaType('test')->id(),
      'name' => 'Screaming hairy armadillo',
      'field_media_test' => $this->randomString(),
    ]);
    $media->save();

    $form_state = new FormState();
    $form_state->setUserInput([
      'editor_object' => [
        'attributes' => [
          'data-entity-type' => 'media',
          'data-entity-uuid' => $media->uuid(),
          'data-align' => 'center',
        ],
        'hasCaption' => 'false',
        'label' => $media->label(),
        'link' => '',
        'hostEntityLangcode' => $media->language()->getId(),
        'classes' => '',
      ],
    ]);
    $form_state->setRequestMethod('POST');

    $form = EditorMediaDialog::create($this->container)
      ->buildForm([], $form_state, $editor->reveal());
    $this->assertNotNull($form, 'Form should have been built without errors.');
  }

}

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