Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / media / tests / src / Kernel / MediaTest.php
1 <?php
2
3 namespace Drupal\Tests\media\Kernel;
4
5 use Drupal\media\Entity\Media;
6
7 /**
8  * Tests Media.
9  *
10  * @group media
11  */
12 class MediaTest extends MediaKernelTestBase {
13
14   /**
15    * Tests various aspects of a Media entity.
16    */
17   public function testEntity() {
18     $media = Media::create(['bundle' => $this->testMediaType->id()]);
19
20     $this->assertSame($media, $media->setOwnerId($this->user->id()), 'setOwnerId() method returns its own entity.');
21   }
22
23   /**
24    * Ensure media name is configurable on manage display.
25    */
26   public function testNameIsConfigurable() {
27     /** @var \Drupal\Core\Field\BaseFieldDefinition[] $field_definitions */
28     $field_definitions = $this->container->get('entity_field.manager')
29       ->getBaseFieldDefinitions('media');
30
31     $this->assertTrue($field_definitions['name']->isDisplayConfigurable('view'));
32   }
33
34 }