function MediaSourceFileTest::testPreventSourceFieldDeletion

Same name in other branches
  1. 8.9.x core/modules/media/tests/src/Functional/MediaSourceFileTest.php \Drupal\Tests\media\Functional\MediaSourceFileTest::testPreventSourceFieldDeletion()
  2. 10 core/modules/media/tests/src/Functional/MediaSourceFileTest.php \Drupal\Tests\media\Functional\MediaSourceFileTest::testPreventSourceFieldDeletion()
  3. 11.x core/modules/media/tests/src/Functional/MediaSourceFileTest.php \Drupal\Tests\media\Functional\MediaSourceFileTest::testPreventSourceFieldDeletion()

Ensure source field deletion is not possible.

File

core/modules/media/tests/src/Functional/MediaSourceFileTest.php, line 50

Class

MediaSourceFileTest
Tests the file media source.

Namespace

Drupal\Tests\media\Functional

Code

public function testPreventSourceFieldDeletion() {
    $media_type = $this->createMediaType('file');
    $media_type_id = $media_type->id();
    $this->drupalGet("admin/structure/media/manage/{$media_type_id}/fields/media.{$media_type_id}.field_media_file/delete");
    $this->assertSession()
        ->statusCodeEquals(403);
}

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