function MediaTest::testEntity

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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.');
}

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