Make the email count dynamic based on the number

...of daily email nodes
This commit is contained in:
Oliver Davies 2025-05-12 01:13:25 +01:00
parent 6ba4b80645
commit c48f8acd4a
9 changed files with 5666 additions and 5 deletions

View file

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace Drupal\Tests\opd_daily_emails\Kernel\Repository;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\node\NodeInterface;
use Drupal\opd_daily_emails\Repository\DailyEmailNodeRepository;
use Drupal\opd_daily_emails\Repository\DailyEmailRepositoryInterface;
final class DailyEmailNodeRepositoryTest extends EntityKernelTestBase {
use NodeCreationTrait;
public static $modules = [
'node',
'opd_daily_emails',
];
/**
* @testdox Get all daily emails
*/
public function test_get_all(): void {
$this->createNode([
'status' => NodeInterface::PUBLISHED,
'type' => 'daily_email',
]);
$repository = $this->container->get(DailyEmailNodeRepository::class);
$this->assertInstanceOf(
actual: $repository,
expected: DailyEmailRepositoryInterface::class,
);
$this->assertCount(
expectedCount: 1,
haystack: $repository->getAll(),
);
}
}