CommerceRefreshModeTest.php in Commerce Migrate 3.1.x
File
modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceRefreshModeTest.php
View source
<?php
namespace Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
use Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1\CommerceRefreshMode;
class CommerceRefreshModeTest extends MigrateProcessTestCase {
public function testCommercePrice($value = NULL, $expected = NULL) {
$configuration = [];
$this->plugin = new CommerceRefreshMode($configuration, 'map', []);
$value = $this->plugin
->transform($value, $this->migrateExecutable, $this->row, 'destination_property');
$this
->assertSame($expected, $value);
}
public function providerTestCommercePrice() {
$tests[0]['value'] = [
'always',
'not_owner_only',
];
$tests[0]['new_value'] = 'always';
$tests[0]['value'] = [
'always',
'owner_only',
];
$tests[0]['new_value'] = 'always';
$tests[1]['value'] = [
FALSE,
'not_owner_only',
];
$tests[1]['new_value'] = 'customer';
$tests[2]['value'] = [
FALSE,
'owner_only',
];
$tests[2]['new_value'] = 'customer';
$tests[3]['value'] = 'string';
$tests[3]['new_value'] = NULL;
$tests[4]['value'] = 1;
$tests[4]['new_value'] = NULL;
$tests[5]['value'] = [];
$tests[5]['new_value'] = NULL;
return $tests;
}
}