Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor2/web/core/modules/contextual/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/rocksensor2/web/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\contextual\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
 * Tests edge cases for converting between contextual links and IDs.
 *
 * @group contextual
 */
class ContextualUnitTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['contextual'];

  /**
   * Provides test cases for both test functions.
   *
   * Used in testContextualLinksToId() and testContextualIdToLinks().
   *
   * @return array[]
   *   Test cases.
   */
  public static function contextualLinksDataProvider(): array {
    $tests['one group, one dynamic path argument, no metadata'] = [
      [
        'node' => [
          'route_parameters' => [
            'node' => '14031991',
          ],
          'metadata' => ['langcode' => 'en'],
        ],
      ],
      'node:node=14031991:langcode=en',
    ];

    $tests['one group, multiple dynamic path arguments, no metadata'] = [
      [
        'foo' => [
          'route_parameters' => [
            0 => 'bar',
            'key' => 'baz',
            1 => 'qux',
          ],
          'metadata' => ['langcode' => 'en'],
        ],
      ],
      'foo:0=bar&key=baz&1=qux:langcode=en',
    ];

    $tests['one group, one dynamic path argument, metadata'] = [
      [
        'views_ui_edit' => [
          'route_parameters' => [
            'view' => 'frontpage',
          ],
          'metadata' => [
            'location' => 'page',
            'display' => 'page_1',
            'langcode' => 'en',
          ],
        ],
      ],
      'views_ui_edit:view=frontpage:location=page&display=page_1&langcode=en',
    ];

    $tests['multiple groups, multiple dynamic path arguments'] = [
      [
        'node' => [
          'route_parameters' => [
            'node' => '14031991',
          ],
          'metadata' => ['langcode' => 'en'],
        ],
        'foo' => [
          'route_parameters' => [
            0 => 'bar',
            'key' => 'baz',
            1 => 'qux',
          ],
          'metadata' => ['langcode' => 'en'],
        ],
        'edge' => [
          'route_parameters' => ['20011988'],
          'metadata' => ['langcode' => 'en'],
        ],
      ],
      'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en',
    ];

    return $tests;
  }

  /**
   * Tests the conversion from contextual links to IDs.
   *
   * @param array $links
   *   The #contextual_links property value array.
   * @param string $id
   *   The serialized representation of the passed links.
   *
   * @covers ::_contextual_links_to_id
   *
   * @dataProvider contextualLinksDataProvider
   */
  public function testContextualLinksToId(array $links, string $id): void {
    $this->assertSame($id, _contextual_links_to_id($links));
  }

  /**
   * Tests the conversion from contextual ID to links.
   *
   * @param array $links
   *   The #contextual_links property value array.
   * @param string $id
   *   The serialized representation of the passed links.
   *
   * @covers ::_contextual_id_to_links
   *
   * @dataProvider contextualLinksDataProvider
   */
  public function testContextualIdToLinks(array $links, string $id): void {
    $this->assertSame($links, _contextual_id_to_links($id));
  }

}

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