4d: Add the ArticleRepository
Create the `ArticleRepository` class and add it as a service. This fails as there is no `getAll()` method on the class.
This commit is contained in:
parent
0c518d3d37
commit
54b306844f
3 changed files with 15 additions and 0 deletions
2
web/modules/custom/my_module/my_module.services.yml
Normal file
2
web/modules/custom/my_module/my_module.services.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
services:
|
||||||
|
Drupal\my_module\Repository\ArticleRepository: ~
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\my_module\Repository;
|
||||||
|
|
||||||
|
class ArticleRepository {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -3,9 +3,14 @@
|
||||||
namespace Drupal\Tests\my_module\Kernel;
|
namespace Drupal\Tests\my_module\Kernel;
|
||||||
|
|
||||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||||
|
use Drupal\my_module\Repository\ArticleRepository;
|
||||||
|
|
||||||
class ArticleRepositoryTest extends EntityKernelTestBase {
|
class ArticleRepositoryTest extends EntityKernelTestBase {
|
||||||
|
|
||||||
|
public static $modules = [
|
||||||
|
'my_module',
|
||||||
|
];
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function nodes_that_are_not_articles_are_not_returned() {
|
public function nodes_that_are_not_articles_are_not_returned() {
|
||||||
$repository = $this->container->get(ArticleRepository::class);
|
$repository = $this->container->get(ArticleRepository::class);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue