public function FieldUninstallValidatorTest::testValidateNoDeleted in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php \Drupal\Tests\field\Unit\FieldUninstallValidatorTest::testValidateNoDeleted()
@covers ::validate
File
- core/
modules/ field/ tests/ src/ Unit/ FieldUninstallValidatorTest.php, line 75 - Contains \Drupal\Tests\field\Unit\FieldUninstallValidatorTest.
Class
- FieldUninstallValidatorTest
- @coversDefaultClass \Drupal\field\FieldUninstallValidator @group field
Namespace
Drupal\Tests\field\UnitCode
public function testValidateNoDeleted() {
$field_storage = $this
->getMockBuilder('Drupal\\field\\Entity\\FieldStorageConfig')
->disableOriginalConstructor()
->getMock();
$field_storage
->expects($this
->once())
->method('isDeleted')
->willReturn(FALSE);
$this->fieldUninstallValidator
->expects($this
->once())
->method('getFieldStoragesByModule')
->willReturn([
$field_storage,
]);
$module = $this
->randomMachineName();
$expected = [
'Fields type(s) in use',
];
$reasons = $this->fieldUninstallValidator
->validate($module);
$this
->assertSame($expected, $this
->castSafeStrings($reasons));
}