public function RngEventSettingsTest::testEventSettings in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Tests/RngEventSettingsTest.php \Drupal\rng\Tests\RngEventSettingsTest::testEventSettings()
- 3.x src/Tests/RngEventSettingsTest.php \Drupal\rng\Tests\RngEventSettingsTest::testEventSettings()
Tests changing event settings reveals the 'Register' tab.
File
- src/
Tests/ RngEventSettingsTest.php, line 104
Class
- RngEventSettingsTest
- Tests event settings page.
Namespace
Drupal\rng\TestsCode
public function testEventSettings() {
$bundle = $this->event_bundle
->id();
$account = $this
->drupalCreateUser([
'access content',
'edit own ' . $bundle . ' content',
'rng register self',
]);
$this
->drupalLogin($account);
$this
->createEntity($this->event_bundle, [
'uid' => \Drupal::currentUser()
->id(),
]);
// Event
$base_url = 'node/1';
$this
->drupalGet($base_url . '');
$this
->assertResponse(200);
$this
->drupalGet($base_url . '/event');
$this
->assertResponse(200);
$this
->assertNoLinkByHref($base_url . '/register');
$this
->drupalGet($base_url . '/register');
$this
->assertResponse(403);
// Settings
$edit = [
'rng_status[value]' => TRUE,
'rng_registration_type[' . $this->registration_type
->id() . ']' => TRUE,
'rng_capacity[0][unlimited_number][unlimited_number]' => 'limited',
'rng_capacity[0][unlimited_number][number]' => '1',
];
$this
->drupalPostForm($base_url . '/event', $edit, t('Save'));
$this
->assertRaw(t('Event settings updated.'));
// Register tab appears.
$this
->assertLinkByHref($base_url . '/register');
}