function EntityLinksTest::providerTestMediaEntity

Data provider for testMediaEntity.

File

core/modules/filter/tests/src/Kernel/EntityLinksTest.php, line 298

Class

EntityLinksTest
Tests the behavior of generating entity URLs when using entity links in CKEditor.

Namespace

Drupal\Tests\filter\Kernel

Code

public static function providerTestMediaEntity() : array {
  return [
    [
      TRUE,
      'file',
      [
        'target_id' => 1,
      ],
      '/media/1',
      [
        'media:1',
      ],
    ],
    [
      FALSE,
      'file',
      [
        'target_id' => 1,
      ],
      '/<SITE_DIRECTORY>/files/druplicon.txt',
      [
        'file:1',
        'media:1',
      ],
    ],
    [
      TRUE,
      'oembed:video',
      [
        'value' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
      ],
      '/media/1',
      [
        'media:1',
      ],
    ],
    [
      FALSE,
      'oembed:video',
      [
        'value' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
      ],
      'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
      [
        'media:1',
      ],
    ],
    [
      TRUE,
      'test',
      [
        'value' => 'foobar',
      ],
      '/media/1',
      [
        'media:1',
      ],
    ],
    [
      FALSE,
      'test',
      [
        'value' => 'foobar',
      ],
      '',
      [
        'media:1',
      ],
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.