Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
3 namespace Drupal\Tests\comment\Functional; | 3 namespace Drupal\Tests\comment\Functional; |
4 | 4 |
5 use Drupal\comment\CommentManagerInterface; | 5 use Drupal\comment\CommentManagerInterface; |
6 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; | 6 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; |
7 use Drupal\comment\Entity\Comment; | 7 use Drupal\comment\Entity\Comment; |
8 use Drupal\Component\Utility\Unicode; | |
9 use Drupal\Core\Entity\Entity\EntityViewDisplay; | 8 use Drupal\Core\Entity\Entity\EntityViewDisplay; |
10 use Drupal\Core\Entity\Entity\EntityViewMode; | 9 use Drupal\Core\Entity\Entity\EntityViewMode; |
11 use Drupal\user\RoleInterface; | 10 use Drupal\user\RoleInterface; |
12 use Drupal\filter\Entity\FilterFormat; | 11 use Drupal\filter\Entity\FilterFormat; |
13 | 12 |
164 $this->drupalGet('node/' . $this->node->id(), ['query' => ['page' => 2]]); | 163 $this->drupalGet('node/' . $this->node->id(), ['query' => ['page' => 2]]); |
165 $this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s'); | 164 $this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s'); |
166 $this->setCommentsPerPage(50); | 165 $this->setCommentsPerPage(50); |
167 | 166 |
168 // Attempt to reply to an unpublished comment. | 167 // Attempt to reply to an unpublished comment. |
169 $reply_loaded->setPublished(FALSE); | 168 $reply_loaded->setUnpublished(); |
170 $reply_loaded->save(); | 169 $reply_loaded->save(); |
171 $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id()); | 170 $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id()); |
172 $this->assertResponse(403); | 171 $this->assertResponse(403); |
173 | 172 |
174 // Attempt to post to node with comments disabled. | 173 // Attempt to post to node with comments disabled. |
309 $comment_element = $this->cssSelect('.comment-wrapper'); | 308 $comment_element = $this->cssSelect('.comment-wrapper'); |
310 $this->assertTrue(!empty($comment_element)); | 309 $this->assertTrue(!empty($comment_element)); |
311 $this->assertRaw('<p>' . $comment_text . '</p>'); | 310 $this->assertRaw('<p>' . $comment_text . '</p>'); |
312 | 311 |
313 // Create a new comment entity view mode. | 312 // Create a new comment entity view mode. |
314 $mode = Unicode::strtolower($this->randomMachineName()); | 313 $mode = mb_strtolower($this->randomMachineName()); |
315 EntityViewMode::create([ | 314 EntityViewMode::create([ |
316 'targetEntityType' => 'comment', | 315 'targetEntityType' => 'comment', |
317 'id' => "comment.$mode", | 316 'id' => "comment.$mode", |
318 ])->save(); | 317 ])->save(); |
319 // Create the corresponding entity view display for article node-type. Note | 318 // Create the corresponding entity view display for article node-type. Note |