public function CourierMaintenanceFormTest::testMessageDelete in Courier 8
Same name and namespace in other branches
- 2.x src/Tests/CourierMaintenanceFormTest.php \Drupal\courier\Tests\CourierMaintenanceFormTest::testMessageDelete()
Test message queue items are deleted.
File
- src/
Tests/ CourierMaintenanceFormTest.php, line 21
Class
- CourierMaintenanceFormTest
- Courier maintenance form web test.
Namespace
Drupal\courier\TestsCode
public function testMessageDelete() {
$user = $this
->drupalCreateUser([
'administer courier',
]);
$this
->drupalLogin($user);
MessageQueueItem::create([
'created' => REQUEST_TIME + 3600,
])
->save();
MessageQueueItem::create([
'created' => REQUEST_TIME + 3600,
])
->save();
MessageQueueItem::create([
'created' => REQUEST_TIME + 3600,
])
->save();
MessageQueueItem::create([
'created' => REQUEST_TIME - 3600,
])
->save();
MessageQueueItem::create([
'created' => REQUEST_TIME - 3600,
])
->save();
$edit = [
'delete_age' => 60,
];
$this
->drupalPostForm(Url::fromRoute('courier.admin.maintenance'), $edit, t('Delete messages'));
$this
->assertRaw('2 messages deleted.');
}