18 $this->_importHandler =
$objectManager->create(\
Magento\TaxImportExport\Model\Rate\CsvImportHandler::class);
23 $this->_importHandler =
null;
31 $importFileName =
__DIR__ .
'/_files/correct_rates_import_file.csv';
32 $this->_importHandler->importFromCsvFile([
'tmp_name' => $importFileName]);
37 \
Magento\Tax\Model\Calculation\Rate::class
39 'US-CA-*-Rate Import Test' 41 $this->assertNotEmpty($importedRuleCA->getId());
42 $this->assertEquals(8.25, (
double)$importedRuleCA->getRate());
43 $this->assertEquals(
'US', $importedRuleCA->getTaxCountryId());
44 $this->assertEquals(
'*', $importedRuleCA->getTaxPostcode());
47 \
Magento\Tax\Model\Calculation\Rate::class
49 'US-FL-*-Rate Import Test' 51 $this->assertNotEmpty($importedRuleFL->getId());
52 $this->assertEquals(15, (
double)$importedRuleFL->getRate());
53 $this->assertEquals(
'US', $importedRuleFL->getTaxCountryId());
54 $this->assertNull($importedRuleFL->getTaxPostcode());
64 $importFileName =
__DIR__ .
'/_files/rates_import_file_incorrect_country.csv';
65 $this->_importHandler->importFromCsvFile([
'tmp_name' => $importFileName]);
testImportFromCsvFileWithCorrectData()
defined('TESTS_BP')||define('TESTS_BP' __DIR__
testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid()
static getObjectManager()