diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php index 6158f07..8fb2661 100644 --- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php +++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php @@ -53,10 +53,11 @@ function setUp() { function testTelephoneField() { // Add the telepone field to the article content type. - entity_create('field_entity', array( + $field = entity_create('field_entity', array( 'field_name' => 'field_telephone', 'type' => 'telephone', - ))->save(); + )); + $field->save(); entity_create('field_instance', array( 'field_name' => 'field_telephone', 'label' => 'Telephone Number', @@ -102,5 +103,17 @@ function testTelephoneField() { $this->drupalPost('node/add/article', $edit, t('Save')); $this->assertRaw('', 'Telephone link is output with whitespace removed.'); + + // Test that module can't be disabled while its fields exists. + $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules')); + $this->drupalLogin($admin_user); + $this->drupalGet('admin/modules'); + $this->assertText('Fields type(s) in use'); + $field->delete(); + $this->drupalGet('admin/modules'); + $this->assertText('Fields pending deletion'); + $this->cronRun(); + $this->assertNoText('Fields pending deletion'); } + }