parent
8016f96b97
commit
678263c75c
3 changed files with 47 additions and 77 deletions
|
@ -4,14 +4,32 @@ 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\Presentation;
|
||||
|
||||
trait PresentationCreationTrait {
|
||||
|
||||
use EntityCreationTrait;
|
||||
use NodeCreationTrait;
|
||||
|
||||
/**
|
||||
* @param Event[] $events
|
||||
*/
|
||||
private function createPresentation(array $events, bool $isPublished = TRUE): Presentation {
|
||||
$presentation = $this->createNode([
|
||||
'field_events' => $events,
|
||||
'status' => $isPublished,
|
||||
'type' => Presentation::NODE_TYPE,
|
||||
]);
|
||||
|
||||
assert($presentation instanceof Presentation);
|
||||
|
||||
return $presentation;
|
||||
}
|
||||
|
||||
private function createEvent(string $eventName, Date $eventDate): Event {
|
||||
$event = $this->createEntity(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue