Chris@0: $this->testMediaType->id()]); Chris@0: Chris@0: $this->assertSame($media, $media->setOwnerId($this->user->id()), 'setOwnerId() method returns its own entity.'); Chris@0: } Chris@0: Chris@12: /** Chris@14: * Tests the Media "name" base field behavior. Chris@12: */ Chris@14: public function testNameBaseField() { Chris@12: /** @var \Drupal\Core\Field\BaseFieldDefinition[] $field_definitions */ Chris@12: $field_definitions = $this->container->get('entity_field.manager') Chris@12: ->getBaseFieldDefinitions('media'); Chris@12: Chris@14: // Ensure media name is configurable on manage display. Chris@12: $this->assertTrue($field_definitions['name']->isDisplayConfigurable('view')); Chris@14: // Ensure it is not visible by default. Chris@17: $this->assertSame($field_definitions['name']->getDisplayOptions('view'), ['region' => 'hidden']); Chris@12: } Chris@12: Chris@18: /** Chris@18: * Tests the legacy method used as the default entity owner. Chris@18: * Chris@18: * @group legacy Chris@18: * @expectedDeprecation The ::getCurrentUserId method is deprecated in 8.6.x and will be removed before 9.0.0. Chris@18: */ Chris@18: public function testGetCurrentUserId() { Chris@18: $this->assertEquals(['1'], Media::getCurrentUserId()); Chris@18: } Chris@18: Chris@0: }