Skip to content
Snippets Groups Projects

Move callback classRemove outside of the loop

1 file
+ 11
2
Compare changes
  • Side-by-side
  • Inline
  • 50b490ba
    Issue #3479887 by bradjones1, mcdruid: CommentUserNameTest::testUsername()... · 50b490ba
    Lee Rowlands authored
    Issue #3479887 by bradjones1, mcdruid: CommentUserNameTest::testUsername() failure due to missing comment type
@@ -5,6 +5,7 @@
@@ -5,6 +5,7 @@
namespace Drupal\Tests\comment\Kernel\Views;
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\Entity\Comment;
use Drupal\comment\Entity\Comment;
 
use Drupal\comment\Entity\CommentType;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
@@ -57,6 +58,7 @@ protected function setUp($import_test_views = TRUE): void {
@@ -57,6 +58,7 @@ protected function setUp($import_test_views = TRUE): void {
$admin_role = Role::create([
$admin_role = Role::create([
'id' => 'admin',
'id' => 'admin',
'permissions' => [
'permissions' => [
 
'view test entity',
'administer comments',
'administer comments',
'access user profiles',
'access user profiles',
'access comments',
'access comments',
@@ -79,6 +81,13 @@ protected function setUp($import_test_views = TRUE): void {
@@ -79,6 +81,13 @@ protected function setUp($import_test_views = TRUE): void {
$host = EntityTest::create(['name' => $this->randomString()]);
$host = EntityTest::create(['name' => $this->randomString()]);
$host->save();
$host->save();
 
$commentType = CommentType::create([
 
'id' => 'entity_test_comment',
 
'label' => t('Entity Test Comment'),
 
'target_entity_type_id' => 'entity_test',
 
]);
 
$commentType->save();
 
// Create some comments.
// Create some comments.
$comment = Comment::create([
$comment = Comment::create([
'subject' => 'My comment title',
'subject' => 'My comment title',
@@ -87,7 +96,7 @@ protected function setUp($import_test_views = TRUE): void {
@@ -87,7 +96,7 @@ protected function setUp($import_test_views = TRUE): void {
'entity_type' => 'entity_test',
'entity_type' => 'entity_test',
'field_name' => 'comment',
'field_name' => 'comment',
'entity_id' => $host->id(),
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'comment_type' => 'entity_test_comment',
'status' => 1,
'status' => 1,
]);
]);
$comment->save();
$comment->save();
@@ -101,7 +110,7 @@ protected function setUp($import_test_views = TRUE): void {
@@ -101,7 +110,7 @@ protected function setUp($import_test_views = TRUE): void {
'entity_type' => 'entity_test',
'entity_type' => 'entity_test',
'field_name' => 'comment',
'field_name' => 'comment',
'entity_id' => $host->id(),
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'comment_type' => 'entity_test_comment',
'created' => 123456,
'created' => 123456,
'status' => 1,
'status' => 1,
]);
]);
Loading