MigrateCaptchaSimpleConfigurationTest.php in CAPTCHA 8
File
tests/src/Kernel/Migrate/d7/MigrateCaptchaSimpleConfigurationTest.php
View source
<?php
namespace Drupal\Tests\captcha\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateCaptchaSimpleConfigurationTest extends MigrateDrupal7TestBase {
protected static $modules = [
'captcha',
];
protected $expectedConfig = [
'captcha.settings' => [
'enabled_default' => 1,
'default_challenge' => 'captcha/Math',
'description' => 'This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.',
'administration_mode' => TRUE,
'allow_on_admin_pages' => FALSE,
'add_captcha_description' => TRUE,
'default_validation' => 1,
'persistence' => 1,
'enable_stats' => TRUE,
'log_wrong_responses' => TRUE,
],
];
protected function setUp() : void {
parent::setUp();
$this
->loadFixture(implode(DIRECTORY_SEPARATOR, [
DRUPAL_ROOT,
drupal_get_path('module', 'captcha'),
'tests',
'fixtures',
'drupal7.php',
]));
$migrations = [
'd7_captcha_settings',
];
$this
->executeMigrations($migrations);
}
public function testConfigurationMigration() {
foreach ($this->expectedConfig as $config_id => $values) {
$actual = \Drupal::config($config_id)
->get();
$this
->assertSame($values, $actual);
}
}
}