4a: Ensure that only articles are returned
Start adding a kernel test that retrieves article nodes from an `ArticleRepository` and ensures that only articles are returned. This fails due to a non-existent service.
This commit is contained in:
parent
23287fc0fd
commit
0c518d3d37
1 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\my_module\Kernel;
|
||||
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
|
||||
class ArticleRepositoryTest extends EntityKernelTestBase {
|
||||
|
||||
/** @test */
|
||||
public function nodes_that_are_not_articles_are_not_returned() {
|
||||
$repository = $this->container->get(ArticleRepository::class);
|
||||
$articles = $repository->getAll();
|
||||
|
||||
$this->assertCount(3, $articles);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue