diff --git a/web/modules/custom/my_module/tests/src/Kernel/ArticleRepositoryTest.php b/web/modules/custom/my_module/tests/src/Kernel/ArticleRepositoryTest.php index 0fcc9cb..8fae5b9 100644 --- a/web/modules/custom/my_module/tests/src/Kernel/ArticleRepositoryTest.php +++ b/web/modules/custom/my_module/tests/src/Kernel/ArticleRepositoryTest.php @@ -4,9 +4,12 @@ namespace Drupal\Tests\my_module\Kernel; use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; use Drupal\my_module\Repository\ArticleRepository; +use Drupal\Tests\node\Traits\NodeCreationTrait; class ArticleRepositoryTest extends EntityKernelTestBase { + use NodeCreationTrait; + public static $modules = [ 'node', 'my_module', @@ -14,6 +17,10 @@ class ArticleRepositoryTest extends EntityKernelTestBase { /** @test */ public function nodes_that_are_not_articles_are_not_returned() { + $this->createNode(['type' => 'article'])->save(); + $this->createNode(['type' => 'article'])->save(); + $this->createNode(['type' => 'article'])->save(); + $repository = $this->container->get(ArticleRepository::class); $articles = $repository->getAll();