TaxManager is now a service in the container.

This commit is contained in:
Franck Allimant
2014-01-22 01:18:28 +01:00
parent c9c489a76b
commit 5d92ea0bab
23 changed files with 414 additions and 152 deletions

View File

@@ -190,25 +190,25 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
$taxRulesCollection->setModel('\Thelia\Model\Tax');
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 10))
->setVirtualColumn('taxRuleCountryPosition', 1);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 8))
->setVirtualColumn('taxRuleCountryPosition', 1);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('FixAmountTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\FixAmountTaxType')
->setRequirements(array('amount' => 5))
->setVirtualColumn('taxRuleCountryPosition', 2);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 1))
->setVirtualColumn('taxRuleCountryPosition', 3);
$taxRulesCollection->append($tax);
@@ -246,25 +246,25 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
$taxRulesCollection->setModel('\Thelia\Model\Tax');
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 10))
->setVirtualColumn('taxRuleCountryPosition', 1);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 8))
->setVirtualColumn('taxRuleCountryPosition', 1);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('FixAmountTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\FixAmountTaxType')
->setRequirements(array('amount' => 5))
->setVirtualColumn('taxRuleCountryPosition', 2);
$taxRulesCollection->append($tax);
$tax = new Tax();
$tax->setType('PricePercentTaxType')
$tax->setType('\Thelia\TaxEngine\TaxType\PricePercentTaxType')
->setRequirements(array('percent' => 1))
->setVirtualColumn('taxRuleCountryPosition', 3);
$taxRulesCollection->append($tax);

View File

@@ -0,0 +1,61 @@
<?php
use Thelia\TaxEngine\TaxEngine;
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Tests\TaxEngine;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Thelia\TaxEngine\TaxEngine;
/**
*
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class TaxEngineTest extends \PHPUnit_Framework_TestCase
{
protected $request;
public function setUp()
{
$this->request = new Request();
$this->request->setSession(new Session(new MockArraySessionStorage()));
}
/**
*/
public function testGetTaxTypeList()
{
$taxEngine = new TaxEngine($this->request);
$list = $taxEngine->getTaxTypeList();
$this->assertEquals($list[0], "Thelia\TaxEngine\TaxType\FeatureFixAmountTaxType");
$this->assertEquals($list[1], "Thelia\TaxEngine\TaxType\FixAmountTaxType");
$this->assertEquals($list[2], "Thelia\TaxEngine\TaxType\PricePercentTaxType");
}
}