You are here

public function PathMappingTest::providerParsePathMapping in Gatsby Live Preview & Incremental Builds 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/PathMappingTest.php \Drupal\Tests\gatsby\Unit\PathMappingTest::providerParsePathMapping()

Data provider for testParsePathMapping.

Return value

array Test cases.

File

tests/src/Unit/PathMappingTest.php, line 37

Class

PathMappingTest
Defines a test for GatsbyPathMapping.

Namespace

Drupal\Tests\gatsby\Unit

Code

public function providerParsePathMapping() : array {
  return [
    'empty' => [
      '',
      [],
    ],
    'single value' => [
      '/foo|/bar',
      [
        '/foo' => '/bar',
      ],
    ],
    'complex nested path' => [
      '/foo/bar/whizz|/bar/biz/bang',
      [
        '/foo/bar/whizz' => '/bar/biz/bang',
      ],
    ],
    'multiple values' => [
      "/foo|/bar\n/biz|/bang",
      [
        '/foo' => '/bar',
        '/biz' => '/bang',
      ],
    ],
    'empty line in middle' => [
      "/foo|/bar\n\n/biz|/bang",
      [
        '/foo' => '/bar',
        '/biz' => '/bang',
      ],
    ],
    'empty line at end' => [
      "/foo|/bar\n/biz|/bang\n",
      [
        '/foo' => '/bar',
        '/biz' => '/bang',
      ],
    ],
    'empty line at start' => [
      "\n/foo|/bar\n/biz|/bang",
      [
        '/foo' => '/bar',
        '/biz' => '/bang',
      ],
    ],
  ];
}