From ceb74f618b57679f06999e7cd041ed84a0719273 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 12 May 2025 12:00:00 +0100 Subject: [PATCH] Add a test to confirm the token substitutes ...correctly --- .../src/Functional/DailyEmailTokenTest.php | 45 +++++++++++++++++++ phpunit.xml.dist | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 modules/opd_daily_emails/tests/src/Functional/DailyEmailTokenTest.php diff --git a/modules/opd_daily_emails/tests/src/Functional/DailyEmailTokenTest.php b/modules/opd_daily_emails/tests/src/Functional/DailyEmailTokenTest.php new file mode 100644 index 000000000..68b20a2d8 --- /dev/null +++ b/modules/opd_daily_emails/tests/src/Functional/DailyEmailTokenTest.php @@ -0,0 +1,45 @@ +createDailyEmailNode(['status' => NodeInterface::PUBLISHED]); + $this->createDailyEmailNode(['status' => NodeInterface::NOT_PUBLISHED]); + $this->createDailyEmailNode(['status' => NodeInterface::PUBLISHED]); + + $this->assertToken( + data: [], + expected: 2, + token: 'email-count', + type: 'opd-daily-emails', + ); + } + + private function createDailyEmailNode(array $options): NodeInterface { + return $this->createNode(array_merge( + $options, + [ + 'type' => 'daily_email', + ] + )); + } + +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7c54b408d..2c6634889 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,7 @@ - +