![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Tax/Model/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Tax\Model; use Magento\TestFramework\Helper\Bootstrap; class TaxRateCollectionTest extends \PHPUnit\Framework\TestCase { public function testCreateTaxRateCollectionItem() { /** @var \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection $collection */ $collection = Bootstrap::getObjectManager()->get( \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection::class ); $dbTaxRatesQty = $collection->count(); if (($dbTaxRatesQty == 0) || ($collection->getFirstItem()->getId() != 1)) { $this->fail("Preconditions failed."); } /** @var \Magento\Tax\Model\TaxRateCollection $taxRatesCollection */ $taxRatesCollection = Bootstrap::getObjectManager() ->create(\Magento\Tax\Model\TaxRateCollection::class); $collectionTaxRatesQty = $taxRatesCollection->count(); $this->assertEquals($dbTaxRatesQty, $collectionTaxRatesQty, 'Tax rates quantity is invalid.'); $taxRate = $taxRatesCollection->getFirstItem()->getData(); $expectedTaxRateData = [ 'code' => 'US-CA-*-Rate 1', 'tax_calculation_rate_id' => '1', 'rate' => 8.25, 'region_name' => 'CA', 'tax_country_id' => 'US', 'tax_postcode' => '*', 'tax_region_id' => '12', 'titles' => [], 'zip_is_range' => null, 'zip_from' => null, 'zip_to' => null, ]; $this->assertEquals($expectedTaxRateData, $taxRate, 'Tax rate data is invalid.'); } }