Rename and re-organise custom modules
- Rename `opd_talks` to `opdavies_talks` - Rename `custom` to `opdavies_blog`
This commit is contained in:
parent
e4e898f22c
commit
9b1a8fb3be
53 changed files with 125 additions and 116 deletions
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace Drupal\Tests\opdavies_talks\Kernel;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\opdavies_talks\Service\TalkCounter;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
class CountPreviousTalksTest extends TalksTestBase {
|
||||
|
||||
private TalkCounter $talkCounter;
|
||||
|
||||
/** @test */
|
||||
public function previous_talks_are_counted(): void {
|
||||
$this->createTalk([
|
||||
'field_events' => [
|
||||
$this->createEvent(),
|
||||
$this->createEvent(),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->createTalk([
|
||||
'field_events' => [
|
||||
$this->createEvent(),
|
||||
],
|
||||
]);
|
||||
|
||||
Assert::assertSame(3, $this->talkCounter->getCount());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function future_talks_are_not_counted(): void {
|
||||
$this->createTalk([
|
||||
'field_events' => [
|
||||
$this->createEvent([
|
||||
'field_date' => Carbon::now()->subDay(),
|
||||
]),
|
||||
$this->createEvent([
|
||||
'field_date' => Carbon::now()->addDay(),
|
||||
]),
|
||||
],
|
||||
]);
|
||||
|
||||
Assert::assertSame(1, $this->talkCounter->getCount());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function unpublished_talks_are_not_counted(): void {
|
||||
$this->createTalk([
|
||||
'field_events' => [$this->createEvent()],
|
||||
'status' => NodeInterface::NOT_PUBLISHED,
|
||||
]);
|
||||
|
||||
Assert::assertSame(0, $this->talkCounter->getCount());
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->talkCounter = $this->container->get(TalkCounter::class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue