public function UbercartFieldStorageGenerateTest::testValidInputs in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/process/UbercartFieldStorageGenerateTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\UbercartFieldStorageGenerateTest::testValidInputs()
- 3.1.x modules/ubercart/tests/src/Kernel/Plugin/process/UbercartFieldStorageGenerateTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\UbercartFieldStorageGenerateTest::testValidInputs()
Tests UbercartFieldStorageGenerate process plugin.
@dataProvider providerValidInputs
File
- modules/
ubercart/ tests/ src/ Kernel/ Plugin/ process/ UbercartFieldStorageGenerateTest.php, line 50
Class
- UbercartFieldStorageGenerateTest
- Tests the UbercartFieldStorageGenerate plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1Code
public function testValidInputs($value = NULL, $source_properties = NULL, $destination_properties = NULL, $expected = NULL) {
$migrateExecutable = $this
->getMockBuilder('Drupal\\migrate\\MigrateExecutable')
->disableOriginalConstructor()
->getMock();
$migration_plugin_manager = \Drupal::service('plugin.manager.migration');
$plugin = new UbercartFieldStorageGenerate([], 'test', [], $migration_plugin_manager, '');
$row = new Row();
foreach ($source_properties as $name => $datum) {
$row
->setSourceProperty($name, $datum);
}
foreach ($destination_properties as $name => $datum) {
$row
->setDestinationProperty($name, $datum);
}
$new_value = $plugin
->transform($value, $migrateExecutable, $row, 'destination_property');
$this
->assertSame($expected, $new_value);
$config_name = $value . '.' . $source_properties['field_name'];
$storage = FieldStorageConfig::load($config_name);
$this
->assertInstanceOf(FieldStorageConfig::class, $storage);
}