public function ScheduledTransitionSettingsFormTest::testEnabledBundles in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x tests/src/Functional/ScheduledTransitionSettingsFormTest.php \Drupal\Tests\scheduled_transitions\Functional\ScheduledTransitionSettingsFormTest::testEnabledBundles()
Tests enabling bundles on form.
File
- tests/
src/ Functional/ ScheduledTransitionSettingsFormTest.php, line 91
Class
- ScheduledTransitionSettingsFormTest
- Tests settings form.
Namespace
Drupal\Tests\scheduled_transitions\FunctionalCode
public function testEnabledBundles() : void {
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('entity_test_revlog', 'entity_test_revlog');
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('st_entity_test', 'st_entity_test');
$workflow
->save();
$currentUser = $this
->drupalCreateUser([
'administer scheduled transitions',
]);
$this
->drupalLogin($currentUser);
$url = Url::fromRoute('scheduled_transitions.settings');
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains('Enabled types (0)');
$this
->assertFieldByName('enabled[entity_test_revlog:entity_test_revlog]');
$this
->assertFieldByName('enabled[st_entity_test:st_entity_test]');
// Enable just one of the boxes.
$edit = [
'enabled[st_entity_test:st_entity_test]' => 'TRUE',
];
$this
->drupalPostForm(NULL, $edit, 'Save configuration');
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
$this
->assertSession()
->pageTextContains('Enabled types (1)');
$this
->assertSession()
->checkboxNotChecked('enabled[entity_test_revlog:entity_test_revlog]');
$this
->assertSession()
->checkboxChecked('enabled[st_entity_test:st_entity_test]');
}