diff --git a/modules/ubercart/tests/src/Kernel/Migrate/d6/TaxTest.php b/modules/ubercart/tests/src/Kernel/Migrate/d6/TaxTest.php index 29f050e..4f92226 100644 --- a/modules/ubercart/tests/src/Kernel/Migrate/d6/TaxTest.php +++ b/modules/ubercart/tests/src/Kernel/Migrate/d6/TaxTest.php @@ -34,13 +34,7 @@ class TaxTest extends Ubercart6TestBase { * Test tax migration from Drupal 6 to 8. */ public function testTaxType() { - $this->assertTaxType('handling', 'Handling', 'custom'); - - $tax = TaxType::load('handling'); - $tax_config = $tax->getPluginConfiguration(); - $this->assertNotEmpty($tax_config['rates'][0]['amount']); - $this->assertSame('Handling', $tax_config['rates'][0]['label']); - $this->assertSame('0.04', $tax_config['rates'][0]['amount']); + $this->assertTaxType('handling', 'Handling', 'custom', '0.04'); } } diff --git a/src/EventSubscriber/MigrateTaxType.php b/src/EventSubscriber/MigrateTaxType.php index ac8788f..8059f64 100644 --- a/src/EventSubscriber/MigrateTaxType.php +++ b/src/EventSubscriber/MigrateTaxType.php @@ -61,4 +61,4 @@ class MigrateTaxType implements EventSubscriberInterface { } } -} \ No newline at end of file +} diff --git a/tests/src/Kernel/CommerceMigrateTestTrait.php b/tests/src/Kernel/CommerceMigrateTestTrait.php index 6ad0e0a..c53e4b2 100644 --- a/tests/src/Kernel/CommerceMigrateTestTrait.php +++ b/tests/src/Kernel/CommerceMigrateTestTrait.php @@ -324,13 +324,20 @@ trait CommerceMigrateTestTrait { * The label for the TaxType. * @param string $expected_plugin * The TaxType plugin. + * @param string $rate + * The TaxType rate. */ - public function assertTaxType($id, $expected_label, $expected_plugin) { + public function assertTaxType($id, $expected_label, $expected_plugin, $rate) { $tax = TaxType::load($id); $this->assertNotNull($tax); $this->assertInstanceOf(TaxType::class, $tax); $this->assertSame($expected_label, $tax->label()); $this->assertSame($expected_plugin, $tax->getPluginId()); + + $tax_config = $tax->getPluginConfiguration(); + $this->assertNotEmpty($tax_config['rates'][0]['id']); + $this->assertSame($expected_label, $tax_config['rates'][0]['label']); + $this->assertSame($rate, $tax_config['rates'][0]['amount']); } }