function MigrateMessageFormTest::testFilter
Same name in other branches
- 11.x core/modules/migrate/tests/src/Functional/MigrateMessageFormTest.php \Drupal\Tests\migrate\Functional\MigrateMessageFormTest::testFilter()
Tests the message form.
File
-
core/
modules/ migrate/ tests/ src/ Functional/ MigrateMessageFormTest.php, line 19
Class
- MigrateMessageFormTest
- Tests for the MessageForm class.
Namespace
Drupal\Tests\migrate\FunctionalCode
public function testFilter() : void {
$session = $this->assertSession();
// Create map and message tables.
$this->createTables($this->migrationIds);
// Expected counts for each error level.
$expected = [
MigrationInterface::MESSAGE_ERROR => 3,
MigrationInterface::MESSAGE_WARNING => 0,
MigrationInterface::MESSAGE_NOTICE => 0,
MigrationInterface::MESSAGE_INFORMATIONAL => 1,
];
// Confirm that all the entries are displayed.
$this->drupalGet('/admin/reports/migration-messages/custom_test');
$session->statusCodeEquals(200);
$messages = $this->getMessages();
$this->assertCount(4, $messages);
// Set the filter to match each of the two filter-type attributes and
// confirm the correct number of entries are displayed.
foreach ($expected as $level => $expected_count) {
$edit['severity[]'] = $level;
$this->submitForm($edit, 'Filter');
$count = $this->getLevelCounts($expected);
$this->assertEquals($expected_count, $count[$level], sprintf('Count for level %s failed', $level));
}
// Reset the filter
$this->submitForm([], 'Reset');
$messages = $this->getMessages();
$this->assertCount(4, $messages);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.