class SkipShippingDefaultTest in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x modules/magento/tests/src/Unit/Plugin/migrate/process/SkipShippingDefaultTest.php \Drupal\Tests\commerce_migrate_magento\Unit\Plugin\migrate\process\SkipShippingDefaultTest
- 3.0.x modules/magento/tests/src/Unit/Plugin/migrate/process/SkipShippingDefaultTest.php \Drupal\Tests\commerce_migrate_magento\Unit\Plugin\migrate\process\SkipShippingDefaultTest
Tests the skip default shipping row process plugin.
@coversDefaultClass \Drupal\commerce_migrate_magento\Plugin\migrate\process\SkipShippingDefault
@group commerce_migrate_magento2
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase
- class \Drupal\Tests\commerce_migrate_magento\Unit\Plugin\migrate\process\SkipShippingDefaultTest
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase
Expanded class hierarchy of SkipShippingDefaultTest
File
- modules/
magento/ tests/ src/ Unit/ Plugin/ migrate/ process/ SkipShippingDefaultTest.php, line 16
Namespace
Drupal\Tests\commerce_migrate_magento\Unit\Plugin\migrate\processView source
class SkipShippingDefaultTest extends MigrateProcessTestCase {
/**
* Tests the skip default shipping row process plugin.
*
* @dataProvider providerTestSkipShippingDefault
*/
public function testSkipShippingDefault($value = NULL, $expected = NULL) {
$configuration = [];
$this->plugin = new SkipShippingDefault($configuration, 'map', []);
$value = $this->plugin
->transform($value, $this->migrateExecutable, $this->row, 'foo');
$this
->assertSame($expected, $value);
}
/**
* Data provider for testSkipShippingDefault().
*/
public function providerTestSkipShippingDefault() {
return [
'billing and no shipping' => [
[
TRUE,
FALSE,
],
NULL,
],
];
}
/**
* Tests that exception is thrown when input is not an array.
*
* @dataProvider providerTestShippingRow
*/
public function testShippingRow($value = NULL) {
$configuration = [];
$this->plugin = new SkipShippingDefault($configuration, 'map', []);
$this
->expectExceptionMessage('Skip default shipping row.');
$this->plugin
->transform($value, $this->migrateExecutable, $this->row, 'foo');
}
/**
* Data provider for testShippingRow().
*/
public function providerTestShippingRow() {
return [
'no billing and shipping' => [
[
FALSE,
TRUE,
],
],
];
}
/**
* Tests that exception is thrown when input is not an array.
*
* @dataProvider providerTestInvalidType
*/
public function testInvalidType($value = NULL) {
$configuration = [];
$this->plugin = new CommercePrice($configuration, 'map', []);
$type = gettype($value);
$this
->expectExceptionMessage(sprintf("Input should be an array, instead it was of type '%s'", $type));
$this->plugin
->transform($value, $this->migrateExecutable, $this->row, 'foo');
}
/**
* Data provider for testInvalidType().
*/
public function providerTestInvalidType() {
$xml_str = <<<XML
<?xml version='1.0'?>
<mathematician>
<name>Ada Lovelace</name>
</mathematician>
XML;
$object = (object) [
'one' => 'test1',
'two' => 'test2',
'three' => 'test3',
];
return [
'empty string' => [
'',
],
'string' => [
'Extract Test',
],
'integer' => [
1,
],
'float' => [
1.0,
],
'NULL' => [
NULL,
],
'boolean' => [
TRUE,
],
'xml' => [
$xml_str,
],
'object' => [
$object,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateProcessTestCase:: |
protected | property | ||
MigrateProcessTestCase:: |
protected | property | ||
MigrateProcessTestCase:: |
protected | property | ||
MigrateProcessTestCase:: |
protected | function |
Overrides UnitTestCase:: |
19 |
MigrateTestCase:: |
protected | property | The migration ID map. | |
MigrateTestCase:: |
protected | property | An array of migration configuration values. | 16 |
MigrateTestCase:: |
protected | property | Local store for mocking setStatus()/getStatus(). | |
MigrateTestCase:: |
protected | function | Generates a table schema from a row. | |
MigrateTestCase:: |
protected | function | Gets an SQLite database connection object for use in tests. | |
MigrateTestCase:: |
protected | function | Retrieves a mocked migration. | 1 |
MigrateTestCase:: |
protected | function | Gets the value on a row for a given key. | 1 |
MigrateTestCase:: |
public | function | Tests a query. | |
MigrateTestCase:: |
protected | function | Asserts tested values during test retrieval. | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
SkipShippingDefaultTest:: |
public | function | Data provider for testInvalidType(). | |
SkipShippingDefaultTest:: |
public | function | Data provider for testShippingRow(). | |
SkipShippingDefaultTest:: |
public | function | Data provider for testSkipShippingDefault(). | |
SkipShippingDefaultTest:: |
public | function | Tests that exception is thrown when input is not an array. | |
SkipShippingDefaultTest:: |
public | function | Tests that exception is thrown when input is not an array. | |
SkipShippingDefaultTest:: |
public | function | Tests the skip default shipping row process plugin. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |