You are here

public function RngEventMetaTest::testRegistrantsMaximumDefaultValue in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/RngEventMetaTest.php \Drupal\Tests\rng\Kernel\RngEventMetaTest::testRegistrantsMaximumDefaultValue()
  2. 8 tests/src/Kernel/RngEventMetaTest.php \Drupal\Tests\rng\Kernel\RngEventMetaTest::testRegistrantsMaximumDefaultValue()

Tests maximum registrants is unlimited if there is no field value.

@covers ::getRegistrantsMaximum

File

tests/src/Kernel/RngEventMetaTest.php, line 76

Class

RngEventMetaTest
Tests the event meta class.

Namespace

Drupal\Tests\rng\Kernel

Code

public function testRegistrantsMaximumDefaultValue() {
  $field = FieldConfig::loadByName('entity_test', 'entity_test', EventManagerInterface::FIELD_REGISTRANTS_CAPACITY);
  $field
    ->setDefaultValue([
    [
      'value' => 666,
    ],
  ])
    ->save();
  $event = EntityTest::create();
  $event_meta = $this->eventManager
    ->getMeta($event);
  $this
    ->assertSame(666, $event_meta
    ->getRegistrantsMaximum(), 'Maximum registrants matches bundle default value.');
}