function MediaTypeValidationTest::testMediaSourceIsValidated
Same name in other branches
- 11.x 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 49
Class
- MediaTypeValidationTest
- Tests validation of media_type entities.
Namespace
Drupal\Tests\media\KernelCode
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.