public function MigrateSearchPageTest::testSearchPage in Zircon Profile 8
Same name in this branch
- 8 core/modules/search/src/Tests/Migrate/d6/MigrateSearchPageTest.php \Drupal\search\Tests\Migrate\d6\MigrateSearchPageTest::testSearchPage()
- 8 core/modules/search/src/Tests/Migrate/d7/MigrateSearchPageTest.php \Drupal\search\Tests\Migrate\d7\MigrateSearchPageTest::testSearchPage()
Same name and namespace in other branches
- 8.0 core/modules/search/src/Tests/Migrate/d6/MigrateSearchPageTest.php \Drupal\search\Tests\Migrate\d6\MigrateSearchPageTest::testSearchPage()
Tests Drupal 6 search settings to Drupal 8 search page entity migration.
File
- core/
modules/ search/ src/ Tests/ Migrate/ d6/ MigrateSearchPageTest.php, line 37 - Contains \Drupal\search\Tests\Migrate\d6\MigrateSearchPageTest.
Class
- MigrateSearchPageTest
- Upgrade search rank settings to search.page.*.yml.
Namespace
Drupal\search\Tests\Migrate\d6Code
public function testSearchPage() {
$id = 'node_search';
/** @var \Drupal\search\Entity\SearchPage $search_page */
$search_page = SearchPage::load($id);
$this
->assertIdentical($id, $search_page
->id());
$configuration = $search_page
->getPlugin()
->getConfiguration();
$this
->assertIdentical($configuration['rankings'], array(
'comments' => 5,
'promote' => 0,
'recent' => 0,
'relevance' => 2,
'sticky' => 8,
'views' => 1,
));
$this
->assertIdentical('node', $search_page
->getPath());
// Test that we can re-import using the EntitySearchPage destination.
Database::getConnection('default', 'migrate')
->update('variable')
->fields(array(
'value' => serialize(4),
))
->condition('name', 'node_rank_comments')
->execute();
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = \Drupal::entityManager()
->getStorage('migration')
->loadUnchanged('search_page');
// Indicate we're rerunning a migration that's already run.
$migration
->getIdMap()
->prepareUpdate();
$this
->executeMigration($migration);
$configuration = SearchPage::load($id)
->getPlugin()
->getConfiguration();
$this
->assertIdentical(4, $configuration['rankings']['comments']);
}