diff --git a/core/modules/comment/src/Tests/CommentUserTest.php b/core/modules/comment/tests/src/Functional/CommentUserTest.php similarity index 46% rename from core/modules/comment/src/Tests/CommentUserTest.php rename to core/modules/comment/tests/src/Functional/CommentUserTest.php index 52f73a9..cb81a8d 100644 --- a/core/modules/comment/src/Tests/CommentUserTest.php +++ b/core/modules/comment/tests/src/Functional/CommentUserTest.php @@ -1,24 +1,20 @@ container->get('theme_handler')->install(array('bartik', 'seven')); - $this->config('system.theme') + $this->container->get('config.factory')->getEditable('system.theme') ->set('default', 'bartik') ->set('admin', 'seven') ->save(); @@ -63,11 +59,32 @@ protected function setUp() { ]); $this->drupalLogin($this->adminUser); - $this->drupalPlaceBlock('system_breadcrumb_block'); - $this->fieldUIAddNewField('admin/config/people/accounts', 'comments', 'Comments', 'comment', [ + $initial_edit = array( + 'new_storage_type' => 'comment', + 'label' => 'Comments', + 'field_name' => 'comments', + ); + + $bundle_path = 'admin/config/people/accounts/fields/add-field'; + + // First step: 'Add field' page. + $this->drupalGet($bundle_path); + $this->submitForm($initial_edit, t('Save and continue')); + $this->assertSession()->responseContains(t('These settings apply to the %label field everywhere it is used.', array('%label' => 'Comments'))); + + // Second step: 'Storage settings' form. + $this->submitForm([ 'settings[comment_type]' => 'comment', - ]); + ], t('Save field settings')); + $this->assertSession()->responseContains(t('Updated field %label field settings.', array('%label' => 'Comments'))); + + // Third step: 'Field settings' form. + $this->submitForm([], t('Save settings')); + $this->assertSession()->responseContains(t('Saved %label configuration.', array('%label' => 'Comments'))); + + // Check that the field appears in the overview form. + $this->assertSession()->pageTextContains('Comment'); } /** @@ -79,11 +96,11 @@ public function testUserCommenting() { // Comment on the user. $edit = []; $edit['subject[0][value]'] = 'I can comment on a user?'; - $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertUrl('user/' . $this->adminUser->id() . '#comment-1'); - $this->assertText('Your comment has been posted'); - $this->assertResponse(200); - $this->assertText('I can comment on a user'); + $this->submitForm($edit, t('Save')); + $this->assertSession()->addressEquals('/user/' . $this->adminUser->id() . '#comment-1'); + $this->assertSession()->pageTextContains('Your comment has been posted'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('I can comment on a user'); } }