public function DateRecurInterpreterTest::testInterpreterWebCreate in Recurring Dates Field 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/DateRecurInterpreterTest.php \Drupal\Tests\date_recur\Functional\DateRecurInterpreterTest::testInterpreterWebCreate()
- 3.x tests/src/Functional/DateRecurInterpreterTest.php \Drupal\Tests\date_recur\Functional\DateRecurInterpreterTest::testInterpreterWebCreate()
- 3.0.x tests/src/Functional/DateRecurInterpreterTest.php \Drupal\Tests\date_recur\Functional\DateRecurInterpreterTest::testInterpreterWebCreate()
Tests adding a new interpreter.
File
- tests/
src/ Functional/ DateRecurInterpreterTest.php, line 41
Class
- DateRecurInterpreterTest
- Tests interfaces for interpreters.
Namespace
Drupal\Tests\date_recur\FunctionalCode
public function testInterpreterWebCreate() {
$instanceLabel = 'Kaya';
$url = Url::fromRoute('entity.date_recur_interpreter.add_form');
$this
->drupalGet($url);
$buttonLabel = \t('Next');
$this
->assertSession()
->buttonExists($buttonLabel);
$this
->assertSession()
->pageTextContains('Add interpreter');
$this
->assertSession()
->optionExists('plugin_type', 'test_interpreter');
$page = $this
->getSession()
->getPage();
$page
->findField('label')
->setValue($instanceLabel);
$this
->assertSession()
->waitForElementVisible('css', '[name="label"] + * .machine-name-value');
$page
->findField('plugin_type')
->setValue('test_interpreter');
$this
->submitForm([], $buttonLabel, 'date-recur-interpreter-add-form');
// Page should have reloaded, a different submit button visible.
$this
->assertSession()
->buttonNotExists($buttonLabel);
$buttonLabel = \t('Save');
$this
->assertSession()
->pageTextContains('Add interpreter');
$this
->assertSession()
->checkboxNotChecked('configure[show_foo]');
$page = $this
->getSession()
->getPage();
$page
->checkField('configure[show_foo]');
$this
->submitForm([], $buttonLabel, 'date-recur-interpreter-add-form');
// Page reloaded to interpreter collection page, message displayed.
$this
->assertSession()
->addressEquals(Url::fromRoute('entity.date_recur_interpreter.collection')
->setAbsolute()
->toString());
$this
->assertSession()
->elementTextContains('css', '.messages', 'Saved the ' . $instanceLabel . ' interpreter.');
}