MigrateAcquiaSearchConfigurationTest.php in Acquia Search 3.x
File
tests/src/Kernel/Migrate/d7/MigrateAcquiaSearchConfigurationTest.php
View source
<?php
namespace Drupal\Tests\acquia_search\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateAcquiaSearchConfigurationTest extends MigrateDrupal7TestBase {
public static $modules = [
'acquia_search',
'search_api_solr',
'views',
'search_api',
];
protected $expectedConfig = [
'acquia_search.settings' => [
'api_host' => 'https://api.sr-prod02.acquia.com',
'read_only' => FALSE,
],
];
protected $expectedIndexBundles = [
'node' => [
'page',
'article',
],
];
protected function setUp() {
parent::setUp();
$this
->loadFixture(implode(DIRECTORY_SEPARATOR, [
DRUPAL_ROOT,
drupal_get_path('module', 'acquia_search'),
'tests',
'fixtures',
'drupal7.php',
]));
$migrations = [
'd7_acquia_search_settings',
'd7_acquia_search_index',
];
$this
->executeMigrations($migrations);
}
public function testConfigurationMigration() {
foreach ($this->expectedConfig as $config_id => $values) {
$actual = \Drupal::config($config_id)
->get();
$this
->assertSame($values, $actual);
}
}
public function testSearchIndex() {
foreach ($this->expectedIndexBundles as $entityType => $bundle) {
$path = 'datasource_settings.entity:' . $entityType . '.bundles.selected';
$actual = \Drupal::config('search_api.index.acquia_search_index')
->get($path);
$this
->assertEquals(sort($bundle), sort($actual));
}
}
}