2025-05-12 12:00:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Drupal\Tests\opd_daily_emails\Functional;
|
|
|
|
|
|
|
|
use Drupal\Tests\BrowserTestBase;
|
2025-06-12 02:10:09 +01:00
|
|
|
use Drupal\Tests\RandomGeneratorTrait;
|
2025-05-13 23:42:39 +01:00
|
|
|
use Drupal\Tests\opd_daily_emails\Traits\DailyEmailTestTrait;
|
2025-05-12 12:00:00 +01:00
|
|
|
use Drupal\Tests\token\Functional\TokenTestTrait;
|
|
|
|
|
|
|
|
class DailyEmailTokenTest extends BrowserTestBase {
|
|
|
|
|
2025-05-13 23:42:39 +01:00
|
|
|
use DailyEmailTestTrait;
|
2025-06-12 02:10:09 +01:00
|
|
|
use RandomGeneratorTrait;
|
2025-05-12 12:00:00 +01:00
|
|
|
use TokenTestTrait;
|
|
|
|
|
|
|
|
public $defaultTheme = 'stark';
|
|
|
|
|
2025-05-29 18:12:17 +01:00
|
|
|
protected static $modules = [
|
2025-05-12 12:00:00 +01:00
|
|
|
'node',
|
|
|
|
'opd_daily_emails',
|
|
|
|
];
|
|
|
|
|
2025-06-12 02:10:09 +01:00
|
|
|
public function test_the_token_returns_the_number_of_published_daily_emails(): void {
|
2025-06-12 02:10:09 +01:00
|
|
|
$this->createDailyEmailNode(
|
|
|
|
isPublished: TRUE,
|
2025-06-15 17:22:37 +01:00
|
|
|
title: 'a',
|
2025-06-12 02:10:09 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->createDailyEmailNode(
|
|
|
|
isPublished: FALSE,
|
2025-06-15 17:22:37 +01:00
|
|
|
title: 'b',
|
2025-06-12 02:10:09 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->createDailyEmailNode(
|
|
|
|
isPublished: TRUE,
|
2025-06-15 17:22:37 +01:00
|
|
|
title: 'c',
|
2025-06-12 02:10:09 +01:00
|
|
|
);
|
2025-05-12 12:00:00 +01:00
|
|
|
|
|
|
|
$this->assertToken(
|
|
|
|
data: [],
|
|
|
|
expected: 2,
|
|
|
|
token: 'email-count',
|
|
|
|
type: 'opd-daily-emails',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|