comparison core/modules/comment/tests/src/Functional/CommentPreviewTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
58 $this->assertNoEscaped('<em>' . $this->webUser->id() . '</em>'); 58 $this->assertNoEscaped('<em>' . $this->webUser->id() . '</em>');
59 $this->assertRaw('<em>' . $this->webUser->id() . '</em>'); 59 $this->assertRaw('<em>' . $this->webUser->id() . '</em>');
60 60
61 // Add a user picture. 61 // Add a user picture.
62 $image = current($this->drupalGetTestFiles('image')); 62 $image = current($this->drupalGetTestFiles('image'));
63 $user_edit['files[user_picture_0]'] = drupal_realpath($image->uri); 63 $user_edit['files[user_picture_0]'] = \Drupal::service('file_system')->realpath($image->uri);
64 $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, t('Save')); 64 $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, t('Save'));
65 65
66 // As the web user, fill in the comment form and preview the comment. 66 // As the web user, fill in the comment form and preview the comment.
67 $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); 67 $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
68 68
115 $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article'); 115 $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
116 $this->assertEqual(1, count($elements)); 116 $this->assertEqual(1, count($elements));
117 117
118 // Go back and re-submit the form. 118 // Go back and re-submit the form.
119 $this->getSession()->getDriver()->back(); 119 $this->getSession()->getDriver()->back();
120 $submit_button = $this->assertSession()->buttonExists('Save');
121 $submit_button->click();
120 $this->assertText('Your comment has been posted.'); 122 $this->assertText('Your comment has been posted.');
121 $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article'); 123 $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
122 $this->assertEqual(2, count($elements)); 124 $this->assertEqual(2, count($elements));
123 } 125 }
124 126