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:
parent
f492921c8d
commit
145b2d8e94
1 changed files with 7 additions and 0 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue