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.
This commit is contained in:
Oliver Davies 2020-03-19 21:19:53 +00:00
parent f492921c8d
commit 145b2d8e94

View file

@ -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();