Move all files to tome/
This commit is contained in:
parent
5675bcfc36
commit
674daab35b
2874 changed files with 0 additions and 0 deletions
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\Tests\opd_presentations\Traits;
|
||||
|
||||
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 {
|
||||
|
||||
use EntityCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
|
||||
private function createPresentation(Events $events, bool $isPublished = TRUE): Presentation {
|
||||
$presentation = $this->createNode([
|
||||
'field_events' => $events->toEvents(),
|
||||
'status' => $isPublished,
|
||||
'type' => Presentation::NODE_TYPE,
|
||||
]);
|
||||
|
||||
assert($presentation instanceof Presentation);
|
||||
|
||||
return $presentation;
|
||||
}
|
||||
|
||||
private function createEvent(string $eventName, Date $eventDate): Event {
|
||||
$event = $this->createEntity(
|
||||
entity_type: 'paragraph',
|
||||
values: [
|
||||
'field_date' => $eventDate->toTimestamp(),
|
||||
'field_event_name' => $eventName,
|
||||
'type' => Event::PARAGRAPH_TYPE,
|
||||
],
|
||||
);
|
||||
|
||||
assert($event instanceof Event);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue