EndpointTest.php

Same filename and directory in other branches
  1. 10 core/modules/media/tests/src/Unit/EndpointTest.php
  2. 9 core/modules/media/tests/src/Unit/EndpointTest.php

Namespace

Drupal\Tests\media\Unit

File

core/modules/media/tests/src/Unit/EndpointTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\media\Unit;

use Drupal\media\OEmbed\Endpoint;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;

/**
 * Tests Drupal\media\OEmbed\Endpoint.
 */
class EndpointTest extends UnitTestCase {
  
  /**
   * Tests match url.
   *
   * @legacy-covers ::matchUrl
   */
  public function testMatchUrl() : void {
    $endpoint = new Endpoint('https://www.youtube.com/oembed', $this->createMock('\\Drupal\\media\\OEmbed\\Provider'), [
      'https://*.youtube.com/playlist?list=*',
    ]);
    $this->assertTrue($endpoint->matchUrl('https://www.youtube.com/playlist?list=aBc-EzAs123'));
  }
  
  /**
   * Tests case sensitive match.
   *
   * @legacy-covers ::matchUrl
   */
  public function testCaseSensitiveMatch() : void {
    $endpoint = new Endpoint('https://www.example.com/oembed', $this->createMock('\\Drupal\\media\\OEmbed\\Provider'), [
      'https://*.example.com/Video/*',
    ]);
    $this->assertTrue($endpoint->matchUrl('https://foo.example.com/Video/bar'));
  }

}

Classes

Title Deprecated Summary
EndpointTest Tests Drupal\media\OEmbed\Endpoint.

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