function FieldUninstallValidatorTest::testValidateNoStorages

Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php \Drupal\Tests\field\Unit\FieldUninstallValidatorTest::testValidateNoStorages()
  2. 10 core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php \Drupal\Tests\field\Unit\FieldUninstallValidatorTest::testValidateNoStorages()
  3. 11.x core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php \Drupal\Tests\field\Unit\FieldUninstallValidatorTest::testValidateNoStorages()

@covers ::validate

File

core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php, line 43

Class

FieldUninstallValidatorTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21field%21src%21FieldUninstallValidator.php/class/FieldUninstallValidator/8.9.x" title="Prevents uninstallation of modules providing active field storage." class="local">\Drupal\field\FieldUninstallValidator</a> @group field

Namespace

Drupal\Tests\field\Unit

Code

public function testValidateNoStorages() {
    $this->fieldUninstallValidator
        ->expects($this->once())
        ->method('getFieldStoragesByModule')
        ->willReturn([]);
    $module = $this->randomMachineName();
    $expected = [];
    $reasons = $this->fieldUninstallValidator
        ->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
}

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