comparison core/modules/comment/tests/src/Kernel/CommentIntegrationTest.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
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\comment\Kernel; 3 namespace Drupal\Tests\comment\Kernel;
4 4
5 use Drupal\comment\Entity\CommentType; 5 use Drupal\comment\Entity\CommentType;
6 use Drupal\Component\Utility\Unicode;
7 use Drupal\Core\Database\Database; 6 use Drupal\Core\Database\Database;
8 use Drupal\Core\Entity\Entity\EntityViewDisplay; 7 use Drupal\Core\Entity\Entity\EntityViewDisplay;
9 use Drupal\Core\Entity\Entity\EntityViewMode; 8 use Drupal\Core\Entity\Entity\EntityViewMode;
10 use Drupal\field\Entity\FieldConfig; 9 use Drupal\field\Entity\FieldConfig;
11 use Drupal\field\Entity\FieldStorageConfig; 10 use Drupal\field\Entity\FieldStorageConfig;
45 * 44 *
46 * @see comment_entity_view_display_presave() 45 * @see comment_entity_view_display_presave()
47 * @see CommentDefaultFormatter::calculateDependencies() 46 * @see CommentDefaultFormatter::calculateDependencies()
48 */ 47 */
49 public function testViewMode() { 48 public function testViewMode() {
50 $mode = Unicode::strtolower($this->randomMachineName()); 49 $mode = mb_strtolower($this->randomMachineName());
51 // Create a new comment view mode and a view display entity. 50 // Create a new comment view mode and a view display entity.
52 EntityViewMode::create([ 51 EntityViewMode::create([
53 'id' => "comment.$mode", 52 'id' => "comment.$mode",
54 'targetEntityType' => 'comment', 53 'targetEntityType' => 'comment',
55 'settings' => ['comment_type' => 'comment'], 54 'settings' => ['comment_type' => 'comment'],
62 61
63 // Create a comment field attached to a host 'entity_test' entity. 62 // Create a comment field attached to a host 'entity_test' entity.
64 FieldStorageConfig::create([ 63 FieldStorageConfig::create([
65 'entity_type' => 'entity_test', 64 'entity_type' => 'entity_test',
66 'type' => 'comment', 65 'type' => 'comment',
67 'field_name' => $field_name = Unicode::strtolower($this->randomMachineName()), 66 'field_name' => $field_name = mb_strtolower($this->randomMachineName()),
68 'settings' => [ 67 'settings' => [
69 'comment_type' => 'comment', 68 'comment_type' => 'comment',
70 ], 69 ],
71 ])->save(); 70 ])->save();
72 FieldConfig::create([ 71 FieldConfig::create([