Add Events::fromDateStrings

This commit is contained in:
Oliver Davies 2025-06-15 09:58:14 +01:00
parent 678263c75c
commit 3ba181a753
4 changed files with 30 additions and 48 deletions

View file

@ -7,6 +7,7 @@ namespace Drupal\Tests\opd_presentations;
use Drupal\Tests\RandomGeneratorTrait;
use Drupal\Tests\opd_presentations\Traits\PresentationCreationTrait;
use Drupal\opd_presentations\Date;
use Drupal\opd_presentations\Events;
use Drupal\opd_presentations\PresentationCounter;
use weitzman\DrupalTestTraits\ExistingSiteBase;
@ -20,12 +21,7 @@ final class PresentationCounterTest extends ExistingSiteBase {
assert($counter instanceof PresentationCounter);
$this->createPresentation(
events: [
$this->createEvent(
eventDate: Date::fromString('yesterday'),
eventName: $this->randomString(),
),
],
Events::fromDateStrings('yesterday'),
);
$this->assertGreaterThanOrEqual(
@ -41,12 +37,7 @@ final class PresentationCounterTest extends ExistingSiteBase {
$count = $counter->getPastCount();
$this->createPresentation(
events: [
$this->createEvent(
eventDate: Date::fromString('yesterday'),
eventName: $this->randomString(),
),
],
events: Events::fromDateStrings('yesterday'),
isPublished: FALSE,
);
@ -69,17 +60,7 @@ final class PresentationCounterTest extends ExistingSiteBase {
);
$this->createPresentation(
events: [
$this->createEvent(
eventDate: Date::fromString('tomorrow'),
eventName: $this->randomString(),
),
$this->createEvent(
eventDate: Date::fromString('yesterday'),
eventName: $this->randomString(),
),
],
Events::fromDateStrings('tomorrow', 'yesterday'),
);
$counter = $this->container->get(PresentationCounter::class);