Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/stolberg/web/core/modules/menu_ui/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/stolberg/web/core/modules/menu_ui/tests/src/Kernel/MenuBlockTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\menu_ui\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\system\Entity\Menu;
use Drupal\block\Entity\Block;
use Drupal\system\MenuInterface;
use Drupal\Tests\user\Traits\UserCreationTrait;

/**
 * Tests SystemMenuBlock.
 *
 * @group menu_ui
 */
class MenuBlockTest extends KernelTestBase {

  use UserCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
    'block',
    'menu_ui',
    'user',
  ];

  /**
   * The menu for testing.
   *
   * @var \Drupal\system\MenuInterface
   */
  protected MenuInterface $menu;

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

    $this->setUpCurrentUser([], ['administer menu']);

    // Add a new custom menu.
    $menu_name = 'mock';
    $label = $this->randomMachineName(16);

    $this->menu = Menu::create([
      'id' => $menu_name,
      'label' => $label,
      'description' => 'Description text',
    ]);
    $this->menu->save();

  }

  /**
   * Tests the editing links for SystemMenuBlock.
   */
  public function testOperationLinks(): void {
    $block = Block::create([
      'plugin' => 'system_menu_block:' . $this->menu->id(),
      'region' => 'footer',
      'id' => 'machine_name',
      'theme' => 'stark',
    ]);

    // Test when user does have "administer menu" permission.
    $this->assertEquals([
      'menu-edit' => [
        'title' => 'Edit menu',
        'url' => $this->menu->toUrl('edit-form'),
        'weight' => 50,
      ],
    ], menu_ui_entity_operation($block));

    $this->setUpCurrentUser();
    // Test when user doesn't have "administer menu" permission.
    $this->assertEmpty(menu_ui_entity_operation($block));
  }

}

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