You are here

public function CommerceAdjustmentsTest::providerValidCommerceAdjustments in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x tests/src/Kernel/Plugin/migrate/process/CommerceAdjustmentsTest.php \Drupal\Tests\commerce_migrate\Kernel\Plugin\migrate\process\CommerceAdjustmentsTest::providerValidCommerceAdjustments()
  2. 3.0.x tests/src/Kernel/Plugin/migrate/process/CommerceAdjustmentsTest.php \Drupal\Tests\commerce_migrate\Kernel\Plugin\migrate\process\CommerceAdjustmentsTest::providerValidCommerceAdjustments()

Data provider for testValidCommerceAdjustments.

@dataProvider providerValidCommerceAdjustments

File

tests/src/Kernel/Plugin/migrate/process/CommerceAdjustmentsTest.php, line 83

Class

CommerceAdjustmentsTest
Tests the CommerceAdjustment plugin.

Namespace

Drupal\Tests\commerce_migrate\Kernel\Plugin\migrate\process

Code

public function providerValidCommerceAdjustments() {
  $tests = [
    // Single adjustment.
    [
      [
        [
          'type' => 'custom',
          'title' => '10% off',
          'amount' => '1.23',
          'currency_code' => 'CAD',
        ],
      ],
    ],
    // An untrimmed source amount.
    [
      [
        [
          'type' => 'custom',
          'title' => '10% off',
          'amount' => '1.23000',
          'currency_code' => 'CAD',
        ],
      ],
    ],
    // Multiple adjustments.
    [
      [
        [
          'type' => 'custom',
          'title' => '10% off',
          'amount' => '1.23',
          'currency_code' => 'CAD',
        ],
        [
          'type' => 'custom',
          'title' => '$ off',
          'amount' => '20.00',
          'currency_code' => 'CAD',
        ],
      ],
    ],
    // Empty type field.
    [
      [
        [
          'type' => '',
          'title' => 'No type',
          'amount' => '1.00',
          'currency_code' => 'CAD',
        ],
      ],
    ],
    // Empty title field with no label.
    [
      [
        [
          'type' => 'custom',
          'title' => '',
          'label' => 'Empty title',
          'amount' => '2.00',
          'currency_code' => 'CAD',
        ],
      ],
    ],
    // Empty label field with no title.
    [
      [
        [
          'type' => 'custom',
          'title' => 'Empty label',
          'label' => '',
          'amount' => '2.00',
          'currency_code' => 'CAD',
        ],
      ],
    ],
  ];
  return $tests;
}