class MediaLinkRelationsTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media/tests/src/Kernel/MediaLinkRelationsTest.php \Drupal\Tests\media\Kernel\MediaLinkRelationsTest
- 9 core/modules/media/tests/src/Kernel/MediaLinkRelationsTest.php \Drupal\Tests\media\Kernel\MediaLinkRelationsTest
Tests link relationships for media items.
@group media
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\media\Kernel\MediaKernelTestBase uses MediaTypeCreationTrait
- class \Drupal\Tests\media\Kernel\MediaLinkRelationsTest
- class \Drupal\Tests\media\Kernel\MediaKernelTestBase uses MediaTypeCreationTrait
Expanded class hierarchy of MediaLinkRelationsTest
File
- core/
modules/ media/ tests/ src/ Kernel/ MediaLinkRelationsTest.php, line 12
Namespace
Drupal\Tests\media\KernelView source
class MediaLinkRelationsTest extends MediaKernelTestBase {
/**
* Tests that all link relationships for Media exist.
*/
public function testExistLinkRelationships() {
/** @var \Drupal\Core\Http\LinkRelationTypeManager $link_relation_type_manager */
$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");
}
}
}