View source
<?php
namespace Drupal\Tests\webform_migrate\Kernel\Migrate\d7;
use Drupal\Tests\webform_migrate\Traits\WebformMigrateAssertionsTrait;
class WebformMigrateTest extends WebformMigrateTestBase {
use WebformMigrateAssertionsTrait;
protected $profile = 'minimal';
public static $modules = [
'datetime',
'editor',
'field',
'file',
'filter',
'migrate',
'migrate_drupal',
'node',
'options',
'system',
'text',
'user',
'webform',
'webform_migrate',
'webform_node',
];
public function getDatabaseFixtureFilePath() {
return drupal_get_path('module', 'webform_migrate') . '/tests/fixtures/drupal7_webform.php';
}
public function getFilesystemFixturePath() {
return implode(DIRECTORY_SEPARATOR, [
DRUPAL_ROOT,
drupal_get_path('module', 'webform_migrate'),
'tests',
'fixtures',
'files',
]);
}
public function testWebformMigrations(bool $classic_node_migration) {
$this
->setClassicNodeMigration($classic_node_migration);
$this
->executeWebformMigrations($classic_node_migration);
$this
->assertWebform3Values();
$this
->assertWebform4Values();
$this
->assertWebform5Values();
$this
->assertWebformSubmission1Values();
$this
->assertWebformSubmission2Values();
$this
->assertWebformSubmission3Values();
$this
->assertWebformSubmission4Values();
$this
->assertWebformSubmission5Values();
$this
->assertWebformSubmission6Values();
$this
->assertWebformSubmission7Values();
$this
->assertWebformSubmission8Values();
$this
->assertWebformSubmission9Values();
$this
->assertWebformSubmission10Values();
}
public function providerWebformMigrations() {
$test_cases = [
'Classic node migration' => [
'Classic node migration' => TRUE,
],
'Complete node migration' => [
'Classic node migration' => FALSE,
],
];
if (version_compare(\Drupal::VERSION, '8.9', '<')) {
$test_cases = array_filter($test_cases, function ($test_case) {
return $test_case['Classic node migration'];
});
}
return $test_cases;
}
}