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

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Drupal\Tests\opd_presentations\Traits;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\ctools\Testing\EntityCreationTrait;
use Drupal\opd_presentations\Date;
use Drupal\opd_presentations\Event;
use Drupal\opd_presentations\Events;
use Drupal\opd_presentations\Presentation;
trait PresentationCreationTrait {
@ -19,9 +19,9 @@ trait PresentationCreationTrait {
/**
* @param Event[] $events
*/
private function createPresentation(array $events, bool $isPublished = TRUE): Presentation {
private function createPresentation(Events $events, bool $isPublished = TRUE): Presentation {
$presentation = $this->createNode([
'field_events' => $events,
'field_events' => $events->toEvents(),
'status' => $isPublished,
'type' => Presentation::NODE_TYPE,
]);