You are here

public function TourTest::routeProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/tour/tests/src/Unit/Entity/TourTest.php \Drupal\Tests\tour\Unit\Entity\TourTest::routeProvider()

File

core/modules/tour/tests/src/Unit/Entity/TourTest.php, line 51
Contains \Drupal\Tests\tour\Unit\Entity\TourTest.

Class

TourTest
@coversDefaultClass \Drupal\tour\Entity\Tour @group tour

Namespace

Drupal\Tests\tour\Unit\Entity

Code

public function routeProvider() {
  return array(
    // Simple match.
    array(
      array(
        array(
          'route_name' => 'some.route',
        ),
      ),
      'some.route',
      array(),
      TRUE,
    ),
    // Simple non-match.
    array(
      array(
        array(
          'route_name' => 'another.route',
        ),
      ),
      'some.route',
      array(),
      FALSE,
    ),
    // Empty params.
    array(
      array(
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'bar',
          ),
        ),
      ),
      'some.route',
      array(),
      FALSE,
    ),
    // Match on params.
    array(
      array(
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'bar',
          ),
        ),
      ),
      'some.route',
      array(
        'foo' => 'bar',
      ),
      TRUE,
    ),
    // Non-matching params.
    array(
      array(
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'bar',
          ),
        ),
      ),
      'some.route',
      array(
        'bar' => 'foo',
      ),
      FALSE,
    ),
    // One matching, one not.
    array(
      array(
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'bar',
          ),
        ),
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'bar' => 'foo',
          ),
        ),
      ),
      'some.route',
      array(
        'bar' => 'foo',
      ),
      TRUE,
    ),
    // One matching, one not.
    array(
      array(
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'bar',
          ),
        ),
        array(
          'route_name' => 'some.route',
          'route_params' => array(
            'foo' => 'baz',
          ),
        ),
      ),
      'some.route',
      array(
        'foo' => 'baz',
      ),
      TRUE,
    ),
  );
}