|
3 | 3 | namespace Drupal\Tests\rng\Kernel;
|
4 | 4 |
|
5 | 5 | use Drupal\Core\Entity\EntityStorageException;
|
| 6 | +use Drupal\rng\Entity\EventType; |
6 | 7 | use Drupal\rng\Entity\Registrant;
|
7 | 8 | use Drupal\simpletest\UserCreationTrait;
|
8 | 9 | use Drupal\rng\Entity\Registration;
|
@@ -98,4 +99,41 @@ public function testAddIdentity() {
|
98 | 99 | $this->assertEquals($user1->id(), $registrant->getIdentity()->id(), 'Identity ID is same');
|
99 | 100 | }
|
100 | 101 |
|
| 102 | + /** |
| 103 | + * Test creating a registration for an event type that exceeds 32 characters. |
| 104 | + */ |
| 105 | + public function testLongEventTypeRegistration() { |
| 106 | + $event_type = $this->createEventTypeBase([ |
| 107 | + 'bundle' => 'event_type_over_32_characters', |
| 108 | + ]); |
| 109 | + $event = $this->createEvent(); |
| 110 | + $registration = Registration::create([ |
| 111 | + 'type' => $event_type->id(), |
| 112 | + ]); |
| 113 | + $registration->setEvent($event->getEvent()); |
| 114 | + $user1 = $this->drupalCreateUser(); |
| 115 | + $registration |
| 116 | + ->addIdentity($user1) |
| 117 | + ->save(); |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Create a event type with only required info. |
| 122 | + * |
| 123 | + * @param array $values |
| 124 | + * Default values to use when creating the event type. |
| 125 | + * |
| 126 | + * @return \Drupal\rng\EventTypeInterface |
| 127 | + * An new event type entity. |
| 128 | + */ |
| 129 | + protected function createEventTypeBase($values = []) { |
| 130 | + $event_type = EventType::create($values + [ |
| 131 | + 'id' => $this->randomMachineName(33), |
| 132 | + 'label' => $this->randomMachineName(), |
| 133 | + 'entity_type' => 'entity_test', |
| 134 | + 'bundle' => 'entity_test', |
| 135 | + ]); |
| 136 | + return $event_type; |
| 137 | + } |
| 138 | + |
101 | 139 | }
|
0 commit comments