Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor1/web/core/modules/tour/tests/src/Unit/Entity/

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/tour/tests/src/Unit/Entity/TourTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\tour\Unit\Entity;

use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\tour\Entity\Tour
 *
 * @group tour
 * @group legacy
 */
class TourTest extends UnitTestCase {

  /**
   * Tests \Drupal\tour\Entity\Tour::hasMatchingRoute().
   *
   * @param array $routes
   *   Array of routes as per the Tour::routes property.
   * @param string $route_name
   *   The route name to match.
   * @param array $route_params
   *   Array of route params.
   * @param bool $result
   *   Expected result.
   *
   * @covers ::hasMatchingRoute
   *
   * @dataProvider routeProvider
   */
  public function testHasMatchingRoute($routes, $route_name, $route_params, $result): void {
    $tour = $this->getMockBuilder('\Drupal\tour\Entity\Tour')
      ->disableOriginalConstructor()
      ->onlyMethods(['getRoutes'])
      ->getMock();

    $tour->expects($this->any())
      ->method('getRoutes')
      ->willReturn($routes);

    $this->assertSame($result, $tour->hasMatchingRoute($route_name, $route_params));

    $tour->resetKeyedRoutes();
  }

  /**
   * Provides sample routes for testing.
   */
  public static function routeProvider() {
    return [
      // Simple match.
      [
        [
          ['route_name' => 'some.route'],
        ],
        'some.route',
        [],
        TRUE,
      ],
      // Simple non-match.
      [
        [
          ['route_name' => 'another.route'],
        ],
        'some.route',
        [],
        FALSE,
      ],
      // Empty params.
      [
        [
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'bar'],
          ],
        ],
        'some.route',
        [],
        FALSE,
      ],
      // Match on params.
      [
        [
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'bar'],
          ],
        ],
        'some.route',
        ['foo' => 'bar'],
        TRUE,
      ],
      // Non-matching params.
      [
        [
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'bar'],
          ],
        ],
        'some.route',
        ['bar' => 'foo'],
        FALSE,
      ],
      // One matching, one not.
      [
        [
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'bar'],
          ],
          [
            'route_name' => 'some.route',
            'route_params' => ['bar' => 'foo'],
          ],
        ],
        'some.route',
        ['bar' => 'foo'],
        TRUE,
      ],
      // One matching, one not.
      [
        [
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'bar'],
          ],
          [
            'route_name' => 'some.route',
            'route_params' => ['foo' => 'baz'],
          ],
        ],
        'some.route',
        ['foo' => 'baz'],
        TRUE,
      ],
    ];
  }

}

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