public function DrushCommandsTest::testCreateStartNoEnd in Site Alert 8
Tests site-alert:create with start, but no end.
File
- tests/
src/ Functional/ DrushCommandsTest.php, line 73
Class
- DrushCommandsTest
- Execute drush commands on site_alert.
Namespace
Drupal\Tests\site_alert\FunctionalCode
public function testCreateStartNoEnd() : void {
$label = 'automated-test-alert-no-end';
$message = 'A site alert with a start date but no end date.';
// Set the end date comfortably in the future.
$next_year = date('Y') + 1;
$start_time = $next_year . '-10-15T15:00:00';
$scheduling_options = [
'start' => $start_time,
];
$this
->drush('site-alert:create', [
$label,
$message,
], $scheduling_options);
$this
->assertErrorOutputEquals("[success] Created site alert 'automated-test-alert-no-end'.");
$this
->assertAlertCount(1);
$this
->assertAlertByLabel($label, $message, 'medium', TRUE, $scheduling_options);
$this
->drush('site-alert:delete', [
$label,
]);
$this
->assertErrorOutputEquals("[success] Deleted 1 site alerts labelled 'automated-test-alert-no-end'.");
$this
->assertAlertCount(0);
}