You are here

public function MediaTest::testEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testEntity()
  2. 10 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testEntity()

Tests various aspects of a media item.

File

core/modules/media/tests/src/Kernel/MediaTest.php, line 17

Class

MediaTest
Tests Media.

Namespace

Drupal\Tests\media\Kernel

Code

public function testEntity() {
  $media = Media::create([
    'bundle' => $this->testMediaType
      ->id(),
  ]);
  $this
    ->assertSame($media, $media
    ->setOwnerId($this->user
    ->id()), 'setOwnerId() method returns its own entity.');
}