4g: Add an article

This commit is contained in:
Oliver Davies 2020-11-14 09:12:58 +00:00
parent 9b7d9b3feb
commit 48c2724736

View file

@ -4,13 +4,18 @@ 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'];
/** @test */
public function it_returns_blog_posts() {
$this->createNode(['type' => 'article', 'title' => 'Test post'])->save();
$repository = $this->container->get(ArticleRepository::class);
$articles = $repository->getAll();