You are here

public function OEmbedFormatterTest::providerRender in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php \Drupal\Tests\media\Functional\FieldFormatter\OEmbedFormatterTest::providerRender()

Data provider for testRender().

Return value

array

See also

::testRender()

File

core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php, line 57

Class

OEmbedFormatterTest
@covers \Drupal\media\Plugin\Field\FieldFormatter\OEmbedFormatter

Namespace

Drupal\Tests\media\Functional\FieldFormatter

Code

public function providerRender() {
  return [
    'Vimeo video' => [
      'https://vimeo.com/7073899',
      'video_vimeo.json',
      [],
      [
        'iframe' => [
          'src' => '/media/oembed?url=https%3A//vimeo.com/7073899',
          'width' => '480',
          'height' => '360',
          'title' => 'Drupal Rap Video - Schipulcon09',
        ],
      ],
    ],
    'Vimeo video, resized' => [
      'https://vimeo.com/7073899',
      'video_vimeo.json?maxwidth=100&maxheight=100',
      [
        'max_width' => '100',
        'max_height' => '100',
      ],
      [
        'iframe' => [
          'src' => '/media/oembed?url=https%3A//vimeo.com/7073899',
          'width' => '100',
          'height' => '100',
          'title' => 'Drupal Rap Video - Schipulcon09',
        ],
      ],
    ],
    'Vimeo video, no title' => [
      'https://vimeo.com/7073899',
      'video_vimeo-no-title.json',
      [],
      [
        'iframe' => [
          'src' => '/media/oembed?url=https%3A//vimeo.com/7073899',
          'width' => '480',
          'height' => '360',
          'title' => NULL,
        ],
      ],
    ],
    'tweet' => [
      'https://twitter.com/drupaldevdays/status/935643039741202432',
      'rich_twitter.json',
      [
        // The tweet resource does not specify a height, so the formatter
        // should default to the configured maximum height.
        'max_height' => 360,
      ],
      [
        'iframe' => [
          'src' => '/media/oembed?url=https%3A//twitter.com/drupaldevdays/status/935643039741202432',
          'width' => '550',
          'height' => '360',
        ],
      ],
    ],
    'Flickr photo' => [
      'https://www.flickr.com/photos/amazeelabs/26497866357',
      'photo_flickr.json',
      [],
      [
        'img' => [
          'src' => '/core/misc/druplicon.png',
          'width' => '88',
          'height' => '100',
        ],
      ],
    ],
    'Flickr photo (no dimensions)' => [
      'https://www.flickr.com/photos/amazeelabs/26497866357',
      'photo_flickr_no_dimensions.json',
      [],
      [
        'img' => [
          'src' => '/core/misc/druplicon.png',
        ],
      ],
    ],
  ];
}