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/d7/MigrateSearchPageTest.php \Drupal\search\Tests\Migrate\d7\MigrateSearchPageTest::testSearchPage()
Tests Drupal 7 search ranking to Drupal 8 search page entity migration.
File
- core/
modules/ search/ src/ Tests/ Migrate/ d7/ MigrateSearchPageTest.php, line 39 - Contains \Drupal\search\Tests\Migrate\d7\MigrateSearchPageTest.
Class
- MigrateSearchPageTest
- Upgrade search rank settings to search.page.*.yml.
Namespace
Drupal\search\Tests\Migrate\d7Code
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();
$expected_rankings = array(
'comments' => 0,
'promote' => 0,
'relevance' => 2,
'sticky' => 0,
'views' => 0,
);
$this
->assertIdentical($expected_rankings, $configuration['rankings']);
$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']);
}