From 145b2d8e9422f5d59917c16b2b781afa32870721 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 19 Mar 2020 21:19:53 +0000 Subject: [PATCH] 4g: Create some article nodes Create some article nodes within the test so that there are some nodes to return from the article repository. This fails due to an error from the filter module. --- .../my_module/tests/src/Kernel/ArticleRepositoryTest.php | 7 +++++++ 1 file changed, 7 insertions(+) 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();