Rename custom module directories
- Rename `opdavies_blog` to `blog`. - Rename `opdavies_blog_test` to `blog_test`. - Rename `opdavies_talks` to `talks`. - Rename `opdavies_talks_test` to `talks_test`. The files within the directories haven't changed, so there is no breaking change caused by renaming the directories. Please enter the commit message for your changes. Lines starting
This commit is contained in:
parent
d7d5a6c8a3
commit
cbe60209e6
59 changed files with 0 additions and 0 deletions
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\opdavies_talks\Kernel\Repository;
|
||||
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\opdavies_talks\Entity\Node\Talk;
|
||||
use Drupal\opdavies_talks\Repository\TalkRepository;
|
||||
use Drupal\Tests\node\Traits\NodeCreationTrait;
|
||||
use Drupal\Tests\opdavies_talks\Kernel\TalksTestBase;
|
||||
|
||||
final class TalkRepositoryTest extends TalksTestBase {
|
||||
|
||||
use NodeCreationTrait;
|
||||
|
||||
private TalkRepository $talkRepository;
|
||||
|
||||
/** @test */
|
||||
public function get_all_talks() {
|
||||
$this->createTalk(['title' => 'TDD - Test Driven Drupal']);
|
||||
$this->createTalk(['title' => 'Taking Flight with Tailwind CSS']);
|
||||
$this->createTalk(['title' => 'Upgrading to Drupal 9']);
|
||||
|
||||
$talks = $this->talkRepository->getAll();
|
||||
|
||||
$this->assertCount(3, $talks);
|
||||
$this->assertSame(
|
||||
[
|
||||
1 => 'TDD - Test Driven Drupal',
|
||||
2 => 'Taking Flight with Tailwind CSS',
|
||||
3 => 'Upgrading to Drupal 9',
|
||||
],
|
||||
$talks->map(fn(Talk $talk) => $talk->label())->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function get_all_published_talks() {
|
||||
$this->createTalk([
|
||||
'title' => 'TDD - Test Driven Drupal',
|
||||
'status' => NodeInterface::PUBLISHED,
|
||||
]);
|
||||
|
||||
$this->createTalk([
|
||||
'title' => 'Taking Flight with Tailwind CSS',
|
||||
'status' => NodeInterface::NOT_PUBLISHED,
|
||||
]);
|
||||
|
||||
$talks = $this->talkRepository->getAll(TRUE);
|
||||
|
||||
$this->assertCount(1, $talks);
|
||||
$this->assertSame('TDD - Test Driven Drupal', $talks->first()->label());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_only_returns_talk_nodes() {
|
||||
$this->createNode(['type' => 'page']);
|
||||
|
||||
$talks = $this->talkRepository->getAll();
|
||||
|
||||
$this->assertEmpty($talks);
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(['filter']);
|
||||
|
||||
$this->talkRepository = $this->container->get(TalkRepository::class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue