MediaLinkRelationsTest.php in Drupal 9
File
core/modules/media/tests/src/Kernel/MediaLinkRelationsTest.php
View source
<?php
namespace Drupal\Tests\media\Kernel;
use Drupal\media\Entity\Media;
class MediaLinkRelationsTest extends MediaKernelTestBase {
public function testExistLinkRelationships() {
$link_relation_type_manager = $this->container
->get('plugin.manager.link_relation_type');
$media = Media::create([
'bundle' => $this->testMediaType
->id(),
]);
$media
->save();
foreach ($media
->uriRelationships() as $relation_name) {
$this
->assertTrue($link_relation_type_manager
->hasDefinition($relation_name), "Link relationship '{$relation_name}' for a media item");
}
}
}