Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Add failing test demonstrating issue (#143). #144

Open
wants to merge 1 commit into
base: 8.x-1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tests/src/Kernel/RngRegistrationEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\Tests\rng\Kernel;

use Drupal\Core\Entity\EntityStorageException;
use Drupal\rng\Entity\EventType;
use Drupal\rng\Entity\Registrant;
use Drupal\simpletest\UserCreationTrait;
use Drupal\rng\Entity\Registration;
Expand Down Expand Up @@ -98,4 +99,41 @@ public function testAddIdentity() {
$this->assertEquals($user1->id(), $registrant->getIdentity()->id(), 'Identity ID is same');
}

/**
* Test creating a registration for an event type that exceeds 32 characters.
*/
public function testLongEventTypeRegistration() {
$event_type = $this->createEventTypeBase([
'bundle' => 'event_type_over_32_characters',
]);
$event = $this->createEvent();
$registration = Registration::create([
'type' => $event_type->id(),
]);
$registration->setEvent($event->getEvent());
$user1 = $this->drupalCreateUser();
$registration
->addIdentity($user1)
->save();
}

/**
* Create a event type with only required info.
*
* @param array $values
* Default values to use when creating the event type.
*
* @return \Drupal\rng\EventTypeInterface
* An new event type entity.
*/
protected function createEventTypeBase($values = []) {
$event_type = EventType::create($values + [
'id' => $this->randomMachineName(33),
'label' => $this->randomMachineName(),
'entity_type' => 'entity_test',
'bundle' => 'entity_test',
]);
return $event_type;
}

}