protected function SchedulerUiTrait::createTransition in Lightning Scheduler 8
Creates a scheduled state transition.
Parameters
string $to_state: The label of the state to transition to.
int $ts: The localized time stamp at which the transition should take place. This should be generated using mktime(), not gmmktime().
bool $save: (optional) Whether to save the transition, or just enter it into the UI without saving. Defaults to TRUE.
5 calls to SchedulerUiTrait::createTransition()
- TransitionTest::testClearCompletedTransitions in tests/
src/ FunctionalJavascript/ TransitionTest.php - TransitionTest::testPublishInPast in tests/
src/ FunctionalJavascript/ TransitionTest.php - TransitionTest::testPublishPendingRevision in tests/
src/ FunctionalJavascript/ TransitionTest.php - TransitionTest::testSkipInvalidTransition in tests/
src/ FunctionalJavascript/ TransitionTest.php - @depends testPublishInPast
- UiTest::testUi in tests/
src/ FunctionalJavascript/ UiTest.php
File
- tests/
src/ Traits/ SchedulerUiTrait.php, line 43
Class
- SchedulerUiTrait
- Contains methods for interacting with the scheduler UI.
Namespace
Drupal\Tests\lightning_scheduler\TraitsCode
protected function createTransition($to_state, $ts, $save = TRUE) {
$page = $this
->getSession()
->getPage();
try {
$page
->clickLink('add another');
} catch (ElementNotFoundException $e) {
$page
->clickLink('Schedule a status change');
}
$page
->selectFieldOption('Scheduled moderation state', $to_state);
$page
->fillField('Scheduled transition date', date('mdY', $ts));
$page
->fillField('Scheduled transition time', date('h:i:sA', $ts));
if ($save) {
$page
->pressButton('Save transition');
$text = sprintf("Change to {$to_state} on %s at %s", date('F j, Y', $ts), date('g:i A', $ts));
$this
->assertSession()
->pageTextContains($text);
}
$this
->addToAssertionCount(1);
}