diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php index 9095b7d..afae2c5 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php @@ -42,14 +42,29 @@ class ConfigExportImportUITest extends WebTestBase { protected $tarball; /** - * The name of the role with config UI administer permissions. + * A content type, held between test methods. * * @var string */ - protected $admin_role; + protected $contentType; + /** + * A field, held between test methods. + * + * @var string + */ + protected $field; + + /** + * Modules to enable. + * + * @var array + */ public static $modules = array('config'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Export/import UI', @@ -58,6 +73,9 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); // The initial import must be done with uid 1 because if separately named @@ -79,6 +97,35 @@ public function testExportImport() { ->save(); $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->newSlogan); + // Create a content type. + $this->contentType = $this->drupalCreateContentType(); + + // Create a field. + $this->field = entity_create('field_entity', array( + 'name' => drupal_strtolower($this->randomName()), + 'entity_type' => 'node', + 'type' => 'text', + )); + $this->field->save(); + entity_create('field_instance', array( + 'field_name' => $this->field->name, + 'entity_type' => 'node', + 'bundle' => $this->contentType->type, + ))->save(); + entity_get_form_display('node', $this->contentType->type, 'default') + ->setComponent($this->field->name, array( + 'type' => 'text_textfield', + )) + ->save(); + entity_get_display('node', $this->contentType->type, 'full') + ->setComponent($this->field->name) + ->save(); + + // Display the creation form. + $this->drupalGet('node/add/' . $this->contentType->type); + $this->assertFieldByName("{$this->field->name}[0][value]", '', 'Widget is displayed'); + + // Export the site configuration. $this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export'); $this->tarball = $this->drupalGetContent(); @@ -89,10 +136,9 @@ public function testExportImport() { $filename = 'temporary://' . $this->randomName(); file_put_contents($filename, $this->tarball); + $this->drupalPostForm('admin/config/development/configuration/full/import', array('files[import_tarball]' => $filename), 'Upload'); $this->drupalPostForm(NULL, array(), 'Import all'); - - $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->newSlogan); } -} +}