init
This commit is contained in:
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\Tax\Controller\Adminhtml;
|
||||
|
||||
use Magento\Framework\App\Request\Http as HttpRequest;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class RateTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* @dataProvider ajaxSaveActionDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*/
|
||||
public function testAjaxSaveAction($postData, $expectedData)
|
||||
{
|
||||
$this->getRequest()->setPostValue($postData)->setMethod('POST');
|
||||
|
||||
$this->dispatch('backend/tax/rate/ajaxSave');
|
||||
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
$result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\Json\Helper\Data::class
|
||||
)->jsonDecode(
|
||||
$jsonBody
|
||||
);
|
||||
|
||||
$this->assertArrayHasKey('tax_calculation_rate_id', $result);
|
||||
|
||||
$rateId = $result['tax_calculation_rate_id'];
|
||||
/** @var $rate \Magento\Tax\Model\Calculation\Rate */
|
||||
$rate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\Tax\Model\Calculation\Rate::class
|
||||
)->load(
|
||||
$rateId,
|
||||
'tax_calculation_rate_id'
|
||||
);
|
||||
|
||||
$this->assertEquals($expectedData['zip_is_range'], $rate->getZipIsRange());
|
||||
$this->assertEquals($expectedData['zip_from'], $rate->getZipFrom());
|
||||
$this->assertEquals($expectedData['zip_to'], $rate->getZipTo());
|
||||
$this->assertEquals($expectedData['tax_postcode'], $rate->getTaxPostcode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testAjaxSaveAction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ajaxSaveActionDataProvider()
|
||||
{
|
||||
$postData = ['rate' => '10.0000', 'tax_country_id' => 'US', 'tax_region_id' => '1'];
|
||||
return [
|
||||
[
|
||||
$postData + [
|
||||
'code' => 'Rate ' . uniqid(rand()),
|
||||
'zip_is_range' => '1',
|
||||
'zip_from' => '10000',
|
||||
'zip_to' => '20000',
|
||||
'tax_postcode' => '*',
|
||||
],
|
||||
['zip_is_range' => 1, 'zip_from' => '10000', 'zip_to' => '20000', 'tax_postcode' => '10000-20000'],
|
||||
],
|
||||
[
|
||||
$postData + [
|
||||
'code' => 'Rate ' . uniqid(rand()),
|
||||
'zip_is_range' => '0',
|
||||
'zip_from' => '10000',
|
||||
'zip_to' => '20000',
|
||||
'tax_postcode' => '*',
|
||||
],
|
||||
['zip_is_range' => null, 'zip_from' => null, 'zip_to' => null, 'tax_postcode' => '*']
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test wrong data conditions
|
||||
*
|
||||
* @dataProvider ajaxSaveActionDataInvalidDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*/
|
||||
public function testAjaxSaveActionInvalidData($postData, $expectedData)
|
||||
{
|
||||
$this->getRequest()->setPostValue($postData)->setMethod('POST');
|
||||
|
||||
$this->dispatch('backend/tax/rate/ajaxSave');
|
||||
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
$result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\Json\Helper\Data::class
|
||||
)->jsonDecode(
|
||||
$jsonBody
|
||||
);
|
||||
|
||||
$this->assertEquals($expectedData['success'], $result['success']);
|
||||
$this->assertArrayHasKey('error_message', $result);
|
||||
$this->assertGreaterThan(1, strlen($result['error_message']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testAjaxSaveActionInvalidData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ajaxSaveActionDataInvalidDataProvider()
|
||||
{
|
||||
$expectedData = [
|
||||
'success' => false,
|
||||
'error_message' => 'The required information is invalid. Verify the information and try again.',
|
||||
];
|
||||
return [
|
||||
[
|
||||
// Zip as range but no range values provided
|
||||
[
|
||||
'rate' => rand(1, 10000),
|
||||
'tax_country_id' => 'US',
|
||||
'tax_region_id' => '0',
|
||||
'code' => 'Rate ' . uniqid(),
|
||||
'zip_is_range' => '1',
|
||||
'zip_from' => '',
|
||||
'zip_to' => '',
|
||||
'tax_postcode' => '*'
|
||||
],
|
||||
$expectedData,
|
||||
],
|
||||
// Code is empty
|
||||
[
|
||||
[
|
||||
'rate' => rand(1, 10000),
|
||||
'tax_country_id' => 'US',
|
||||
'tax_region_id' => '0',
|
||||
'code' => '',
|
||||
'zip_is_range' => '0',
|
||||
'zip_from' => '10000',
|
||||
'zip_to' => '20000',
|
||||
'tax_postcode' => '*',
|
||||
],
|
||||
$expectedData
|
||||
],
|
||||
// Country ID empty
|
||||
[
|
||||
[
|
||||
'rate' => rand(1, 10000),
|
||||
'tax_country_id' => '',
|
||||
'tax_region_id' => '0',
|
||||
'code' => 'Rate ' . uniqid(),
|
||||
'zip_is_range' => '0',
|
||||
'zip_from' => '10000',
|
||||
'zip_to' => '20000',
|
||||
'tax_postcode' => '*',
|
||||
],
|
||||
$expectedData
|
||||
],
|
||||
// Tax zip code is empty
|
||||
[
|
||||
[
|
||||
'rate' => rand(1, 10000),
|
||||
'tax_country_id' => 'US',
|
||||
'tax_region_id' => '0',
|
||||
'code' => 'Rate ' . uniqid(),
|
||||
'zip_is_range' => '0',
|
||||
'zip_from' => '10000',
|
||||
'zip_to' => '20000',
|
||||
'tax_postcode' => '',
|
||||
],
|
||||
$expectedData
|
||||
],
|
||||
// All params empty
|
||||
[
|
||||
[
|
||||
'rate' => '',
|
||||
'tax_country_id' => '',
|
||||
'tax_region_id' => '1',
|
||||
'code' => '',
|
||||
'zip_is_range' => '0',
|
||||
'zip_from' => '',
|
||||
'zip_to' => '',
|
||||
'tax_postcode' => '',
|
||||
],
|
||||
$expectedData
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ajaxSaveActionDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*
|
||||
* @param array $rateClassData
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
*/
|
||||
public function testAjaxLoadAction($rateClassData)
|
||||
{
|
||||
/** @var \Magento\Tax\Api\Data\TaxRateInterfaceFactory $rateClassFactory */
|
||||
$rateClassFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Tax\Api\Data\TaxRateInterfaceFactory::class
|
||||
);
|
||||
|
||||
$rateClass = $rateClassFactory->create();
|
||||
$rateClass->setRate($rateClassData['rate'])
|
||||
->setTaxCountryId($rateClassData['tax_country_id'])
|
||||
->setTaxRegionId($rateClassData['tax_region_id'])
|
||||
->setCode($rateClassData['code'])
|
||||
->setZipFrom($rateClassData['zip_from'])
|
||||
->setZipIsRange($rateClassData['zip_is_range'])
|
||||
->setZipFrom($rateClassData['zip_from'])
|
||||
->setZipTo($rateClassData['zip_to'])
|
||||
->setTaxPostcode($rateClassData['tax_postcode']);
|
||||
|
||||
$rateClass->save($rateClass);
|
||||
|
||||
$rateClassId=$rateClass->getTaxCalculationRateId();
|
||||
/** @var $class \Magento\Tax\Model\Calculation\Rate */
|
||||
$class = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
|
||||
->create(\Magento\Tax\Model\Calculation\Rate::class)
|
||||
->load($rateClassId, 'tax_calculation_rate_id');
|
||||
|
||||
$this->assertEquals($rateClassData['tax_country_id'], $class->getTaxCountryId());
|
||||
$this->assertEquals($rateClassData['tax_region_id'], $class->getTaxRegionId());
|
||||
$this->assertEquals($rateClassData['code'], $class->getCode());
|
||||
$this->assertEquals($rateClassData['rate'], $class->getRate());
|
||||
$this->assertEquals($rateClassData['zip_is_range']==1 ? 1 : 0, $class->getZipIsRange() ? 1 : 0);
|
||||
if ($rateClassData['zip_is_range']=='1') {
|
||||
$this->assertEquals($rateClassData['zip_from'], $class->getZipFrom());
|
||||
$this->assertEquals($rateClassData['zip_to'], $class->getZipTo());
|
||||
}
|
||||
|
||||
$postData = [ 'id' => $rateClassId ];
|
||||
$this->getRequest()->setPostValue($postData);
|
||||
$this->dispatch('backend/tax/rate/ajaxLoad');
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
|
||||
$result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\Json\Helper\Data::class
|
||||
)->jsonDecode(
|
||||
$jsonBody
|
||||
);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('success', $result);
|
||||
$this->assertTrue($result['success'] == true);
|
||||
$this->assertArrayHasKey('result', $result);
|
||||
$this->assertIsArray($result['result']);
|
||||
$this->assertEquals($result['result']['tax_country_id'], $class->getTaxCountryId());
|
||||
$this->assertEquals($result['result']['tax_region_id'], $class->getTaxRegionId());
|
||||
$this->assertEquals($result['result']['tax_postcode'], $class->getTaxPostcode());
|
||||
$this->assertEquals($result['result']['code'], $class->getCode());
|
||||
$this->assertEquals($result['result']['rate'], $class->getRate());
|
||||
|
||||
$expectedZipIsRange=$result['result']['zip_is_range'] == 1 ? 1 : 0;
|
||||
$this->assertEquals($expectedZipIsRange, $class->getZipIsRange() ? 1 : 0);
|
||||
if ($expectedZipIsRange) {
|
||||
$this->assertEquals($result['result']['zip_from'], $class->getZipFrom());
|
||||
$this->assertEquals($result['result']['zip_to'], $class->getZipTo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoDbIsolation enabled
|
||||
*
|
||||
*/
|
||||
public function testAjaxNonLoadAction()
|
||||
{
|
||||
$postData = [ 'id' => 99999999 ];
|
||||
$this->getRequest()->setPostValue($postData);
|
||||
$this->dispatch('backend/tax/rate/ajaxLoad');
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
|
||||
$result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\Json\Helper\Data::class
|
||||
)->jsonDecode(
|
||||
$jsonBody
|
||||
);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('success', $result);
|
||||
$this->assertTrue($result['success'] == false);
|
||||
$this->assertTrue(!array_key_exists('result', $result));
|
||||
$this->assertArrayHasKey('error_message', $result);
|
||||
$this->assertTrue(strlen($result['error_message'])>0);
|
||||
}
|
||||
|
||||
/** Test Delete Tax Rate
|
||||
* @magentoAppIsolation enabled
|
||||
* @magentoDbIsolation enabled
|
||||
* @return void
|
||||
*/
|
||||
public function testDeleteRate(): void
|
||||
{
|
||||
$rateId = 2;
|
||||
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
|
||||
$this->getRequest()->setPostValue(['rate' => $rateId]);
|
||||
$this->dispatch('backend/tax/rate/delete');
|
||||
$successMessage = (string)__('You deleted the tax rate.');
|
||||
$this->assertSessionMessages($this->equalTo([$successMessage]));
|
||||
}
|
||||
|
||||
/** Test Delete Incorrect Tax Rate
|
||||
* @magentoAppIsolation enabled
|
||||
* @magentoDbIsolation enabled
|
||||
* @return void
|
||||
*/
|
||||
public function testDeleteIncorrectRate(): void
|
||||
{
|
||||
$incorrectRateId = 20999;
|
||||
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
|
||||
$this->getRequest()->setPostValue(['rate' => $incorrectRateId]);
|
||||
$this->dispatch('backend/tax/rate/delete');
|
||||
$errorMessage = (string)_("We can't delete this rate because of an incorrect rate ID.");
|
||||
$this->assertSessionMessages($this->equalTo([$errorMessage]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Tax\Controller\Adminhtml;
|
||||
|
||||
use Magento\Directory\Model\CountryFactory;
|
||||
use Magento\Directory\Model\RegionFactory;
|
||||
use Magento\Framework\Api\DataObjectHelper;
|
||||
use Magento\Framework\Json\Helper\Data;
|
||||
use Magento\Tax\Api\Data\TaxRateInterfaceFactory;
|
||||
use Magento\Tax\Api\TaxRateRepositoryInterface;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
use Magento\Tax\Api\Data\TaxRateInterface;
|
||||
use Magento\Tax\Model\TaxRuleFixtureFactory;
|
||||
use Magento\Tax\Model\Rate\Provider as RatesProvider;
|
||||
|
||||
/**
|
||||
* Tests for Tax Rules controllers.
|
||||
*
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class RuleTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* TaxRate factory
|
||||
*
|
||||
* @var TaxRateInterfaceFactory
|
||||
*/
|
||||
private $taxRateFactory;
|
||||
|
||||
/**
|
||||
* TaxRateService
|
||||
*
|
||||
* @var TaxRateRepositoryInterface
|
||||
*/
|
||||
private $rateRepository;
|
||||
|
||||
/**
|
||||
* Helps in creating required tax rules.
|
||||
*
|
||||
* @var TaxRuleFixtureFactory
|
||||
*/
|
||||
private $taxRateFixtureFactory;
|
||||
|
||||
/**
|
||||
* @var CountryFactory
|
||||
*/
|
||||
private $countryFactory;
|
||||
|
||||
/**
|
||||
* @var RegionFactory
|
||||
*/
|
||||
private $regionFactory;
|
||||
|
||||
/**
|
||||
* @var DataObjectHelper
|
||||
*/
|
||||
private $dataObjectHelper;
|
||||
|
||||
/**
|
||||
* @var RatesProvider
|
||||
*/
|
||||
private $taxRatesProvider;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->rateRepository = $this->_objectManager->get(TaxRateRepositoryInterface::class);
|
||||
$this->taxRateFactory = $this->_objectManager->create(TaxRateInterfaceFactory::class);
|
||||
$this->dataObjectHelper = $this->_objectManager->create(DataObjectHelper::class);
|
||||
$this->taxRateFixtureFactory = new TaxRuleFixtureFactory();
|
||||
$this->countryFactory = $this->_objectManager->create(CountryFactory::class);
|
||||
$this->regionFactory = $this->_objectManager->create(RegionFactory::class);
|
||||
$this->taxRatesProvider = $this->_objectManager->create(RatesProvider::class);
|
||||
|
||||
$this->_generateTaxRates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests request of tax rates collection set.
|
||||
*
|
||||
* @param array $postData
|
||||
* @param int $itemsCount
|
||||
* @dataProvider ajaxActionDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*/
|
||||
public function testAjaxLoadRates($postData, $itemsCount)
|
||||
{
|
||||
$this->getRequest()->setPostValue($postData);
|
||||
$this->dispatch('backend/tax/rule/ajaxLoadRates');
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
|
||||
$response = Bootstrap::getObjectManager()->get(Data::class)
|
||||
->jsonDecode($jsonBody);
|
||||
|
||||
$this->assertArrayHasKey('success', $response);
|
||||
$this->assertTrue($response['success']);
|
||||
$this->assertArrayHasKey('errorMessage', $response);
|
||||
$this->assertEmpty($response['errorMessage']);
|
||||
$this->assertArrayHasKey('result', $response);
|
||||
$this->assertCount($itemsCount, $response['result']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates tax rates items in repository.
|
||||
*/
|
||||
private function _generateTaxRates()
|
||||
{
|
||||
$ratesCount = $this->taxRatesProvider->getPageSize() + 1;
|
||||
for ($i = 0; $i <= $ratesCount; $i++) {
|
||||
$taxData = [
|
||||
'tax_country_id' => 'US',
|
||||
'tax_region_id' => '8',
|
||||
'rate' => '8.25',
|
||||
'code' => 'US-CA-*-Rate' . $i . rand(),
|
||||
'zip_is_range' => true,
|
||||
'zip_from' => 78765,
|
||||
'zip_to' => 78780,
|
||||
];
|
||||
|
||||
// Tax rate data object created
|
||||
$taxRate = $this->taxRateFactory->create();
|
||||
$this->dataObjectHelper->populateWithArray($taxRate, $taxData, TaxRateInterface::class);
|
||||
|
||||
//Tax rate service call
|
||||
$this->rateRepository->save($taxRate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides POST data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ajaxActionDataProvider()
|
||||
{
|
||||
$taxRatesProvider = Bootstrap::getObjectManager()->create(RatesProvider::class);
|
||||
|
||||
return [
|
||||
[['p' => 1], $taxRatesProvider->getPageSize()],
|
||||
[['p' => 1, 's' => 'no_such_code'], 0]
|
||||
];
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\Tax\Controller\Adminhtml\System;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class ConfigTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* Check Additionally Show Order Total Without Tax Label
|
||||
*/
|
||||
public function testAdditionallyShowOrderTotalWithoutTax()
|
||||
{
|
||||
$this->dispatch('backend/admin/system_config/edit/section/tax/');
|
||||
$body = $this->getResponse()->getBody();
|
||||
$this->assertStringContainsString('id="tax_cart_display_grandtotal"', $body);
|
||||
$this->assertStringContainsString('id="tax_sales_display_grandtotal"', $body);
|
||||
$this->assertStringContainsString('Additionally Show Order Total Without Tax', $body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Tax\Controller\Adminhtml;
|
||||
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class TaxTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* @dataProvider ajaxActionDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*
|
||||
* @param array $postData
|
||||
* @param array $expectedData
|
||||
*/
|
||||
public function testAjaxSaveAction($postData, $expectedData)
|
||||
{
|
||||
$this->getRequest()->setPostValue($postData);
|
||||
|
||||
$this->dispatch('backend/tax/tax/ajaxSave');
|
||||
|
||||
$jsonBody = $this->getResponse()->getBody();
|
||||
$result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\Json\Helper\Data::class
|
||||
)->jsonDecode(
|
||||
$jsonBody
|
||||
);
|
||||
|
||||
$this->assertArrayHasKey('class_id', $result);
|
||||
|
||||
$classId = $result['class_id'];
|
||||
/** @var $class \Magento\Tax\Model\ClassModel */
|
||||
$class = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\Tax\Model\ClassModel::class
|
||||
)->load($classId, 'class_id');
|
||||
$this->assertEquals($expectedData['class_name'], $class->getClassName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ajaxActionDataProvider
|
||||
* @magentoDbIsolation enabled
|
||||
*
|
||||
* @param array $taxClassData
|
||||
*/
|
||||
public function testAjaxDeleteAction($taxClassData)
|
||||
{
|
||||
/** @var \Magento\Tax\Api\TaxClassRepositoryInterface $taxClassService */
|
||||
$taxClassService = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Tax\Api\TaxClassRepositoryInterface::class
|
||||
);
|
||||
|
||||
$taxClassFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Tax\Api\Data\TaxClassInterfaceFactory::class
|
||||
);
|
||||
$taxClass = $taxClassFactory->create();
|
||||
$taxClass->setClassName($taxClassData['class_name'])
|
||||
->setClassType($taxClassData['class_type']);
|
||||
|
||||
$taxClassId = $taxClassService->save($taxClass);
|
||||
|
||||
/** @var $class \Magento\Tax\Model\ClassModel */
|
||||
$class = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\Tax\Model\ClassModel::class
|
||||
)->load($taxClassId, 'class_id');
|
||||
$this->assertEquals($taxClassData['class_name'], $class->getClassName());
|
||||
$this->assertEquals($taxClassData['class_type'], $class->getClassType());
|
||||
|
||||
$postData = [ 'class_id' => $taxClassId ];
|
||||
$this->getRequest()->setPostValue($postData);
|
||||
$this->dispatch('backend/tax/tax/ajaxDelete');
|
||||
|
||||
$isFound = true;
|
||||
try {
|
||||
$taxClassId = $taxClassService->get($taxClassId);
|
||||
} catch (NoSuchEntityException $e) {
|
||||
$isFound = false;
|
||||
}
|
||||
$this->assertFalse($isFound, "Tax Class was found when it should have been deleted.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function ajaxActionDataProvider()
|
||||
{
|
||||
return [
|
||||
[
|
||||
['class_type' => 'CUSTOMER', 'class_name' => 'Class Name'],
|
||||
['class_name' => 'Class Name'],
|
||||
],
|
||||
[
|
||||
['class_type' => 'PRODUCT', 'class_name' => '11111<22222'],
|
||||
['class_name' => '11111<22222']
|
||||
],
|
||||
[
|
||||
['class_type' => 'CUSTOMER', 'class_name' => ' 12<>sa&df '],
|
||||
['class_name' => '12<>sa&df']
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user