function MediaTypeValidationTest::testMediaSourceIsValidated

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

Tests that the media source plugin's existence is validated.

File

core/modules/media/tests/src/Kernel/MediaTypeValidationTest.php, line 48

Class

MediaTypeValidationTest
Tests validation of media_type entities.

Namespace

Drupal\Tests\media\Kernel

Code

public function testMediaSourceIsValidated() : void {
    // The `source` property is immutable, so we need to clone the entity in
    // order to cleanly change its immutable properties.
    $this->entity = $this->entity
        ->createDuplicate()
        ->set('id', 'test')
        ->set('source_configuration', [])
        ->set('source', 'invalid');
    $this->assertValidationErrors([
        'source' => "The 'invalid' plugin does not exist.",
    ]);
}

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