Add taxed prices export

modifié:         core/lib/Thelia/Config/Resources/export.xml
	modifié:         core/lib/Thelia/ImportExport/Export/Type/ProductPricesExport.php
	nouveau fichier: core/lib/Thelia/ImportExport/Export/Type/ProductTaxedPricesExport.php
	nouveau fichier: core/lib/Thelia/Tests/ImportExport/Export/ProductTaxedPricesExportTest.php
This commit is contained in:
Benjamin Perche
2014-08-01 10:24:58 +02:00
parent 9ff74bece8
commit 0e7a1117b0
4 changed files with 200 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\ImportExport\Export;
use Symfony\Component\DependencyInjection\Container;
use Thelia\Core\Translation\Translator;
use Thelia\ImportExport\Export\Type\ProductTaxedPricesExport;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Lang;
use Thelia\Model\ProductSaleElementsQuery;
/**
* Class ProductTaxedPricesExportTest
* @package Thelia\Tests\ImportExport\Export
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ProductTaxedPricesExportTest extends \PHPUnit_Framework_TestCase
{
public function testPrices()
{
$container = new Container();
new Translator($container);
$handler = new ProductTaxedPricesExport($container);
$lang = Lang::getDefaultLanguage();
$data = $handler->buildData($lang)->getData();
foreach ($data as $line) {
$product = ProductSaleElementsQuery::create()->findOneByRef($line["ref"]);
$currency = CurrencyQuery::create()->findOneByCode($line["currency"]);
$this->assertNotNull($product);
$prices = $product->getPricesByCurrency($currency);
$this->assertEquals($prices->getPrice(), $line["price"]);
$this->assertEquals($prices->getPromoPrice(), $line["promo_price"]);
}
}
}