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:
Oliver Davies 2020-03-19 21:06:52 +00:00
parent 23287fc0fd
commit 0c518d3d37

View file

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