Fix cs
modifié: core/lib/Thelia/ImportExport/AbstractHandler.php modifié: core/lib/Thelia/ImportExport/Export/DocumentsExportInterface.php modifié: core/lib/Thelia/ImportExport/Export/ExportHandler.php modifié: core/lib/Thelia/ImportExport/Export/ImagesExportInterface.php modifié: core/lib/Thelia/ImportExport/Export/Type/CustomerExport.php modifié: core/lib/Thelia/ImportExport/Export/Type/MailingExport.php modifié: core/lib/Thelia/ImportExport/Export/Type/ProductPricesExport.php modifié: core/lib/Thelia/ImportExport/Export/Type/ProductSEOExport.php modifié: core/lib/Thelia/ImportExport/Import/ImportHandler.php modifié: core/lib/Thelia/ImportExport/Import/Type/ProductPricesImport.php modifié: core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php modifié: core/lib/Thelia/Tests/ContainerAwareTestCase.php modifié: core/lib/Thelia/Tests/ImportExport/Export/CustomerExportTest.php modifié: core/lib/Thelia/Tests/ImportExport/Export/ExportHandlerTest.php modifié: core/lib/Thelia/Tests/ImportExport/Export/MailingExportTest.php modifié: core/lib/Thelia/Tests/ImportExport/Export/ProductPricesExportTest.php modifié: core/lib/Thelia/Tests/ImportExport/Export/ProductSEOExportTest.php modifié: core/lib/Thelia/Tests/ImportExport/Import/ProductPricesImportTest.php modifié: core/lib/Thelia/Tests/ImportExport/Import/ProductStockImportTest.php
This commit is contained in:
@@ -30,13 +30,13 @@ abstract class AbstractHandler
|
||||
*
|
||||
* Dependency injection: load the container to be able to get parameters and services
|
||||
*/
|
||||
public function __construct(ContainerInterface $container) {
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->defaultLocale = Lang::getDefaultLanguage()->getLocale();
|
||||
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
|
||||
public function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
@@ -66,4 +66,4 @@ abstract class AbstractHandler
|
||||
* );
|
||||
*/
|
||||
abstract public function getHandledTypes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,4 @@ interface DocumentsExportInterface
|
||||
* return an array with the paths to the documents to include in the archive
|
||||
*/
|
||||
public function getDocumentsPaths();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class ExportHandler extends AbstractHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Lang $lang
|
||||
* @param \Thelia\Model\Lang $lang
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds the FormatterData for the formatter
|
||||
@@ -92,10 +92,8 @@ abstract class ExportHandler extends AbstractHandler
|
||||
$query = $this->buildDataSet($lang);
|
||||
|
||||
if ($query instanceof ModelCriteria) {
|
||||
|
||||
return $data->loadModelCriteria($query);
|
||||
} elseif (is_array($query)) {
|
||||
|
||||
return $data->setData($query);
|
||||
} elseif ($query instanceof BaseLoop) {
|
||||
$pagination = null;
|
||||
@@ -160,7 +158,7 @@ abstract class ExportHandler extends AbstractHandler
|
||||
$return = "CONCAT(";
|
||||
$len = strlen($str);
|
||||
|
||||
for($i = 0; $i < $len; ++$i) {
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
$return .= "CHAR(".ord($str[$i])."),";
|
||||
}
|
||||
|
||||
@@ -212,8 +210,8 @@ abstract class ExportHandler extends AbstractHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Lang $lang
|
||||
* @param Lang $lang
|
||||
* @return ModelCriteria|array|BaseLoop
|
||||
*/
|
||||
abstract public function buildDataSet(Lang $lang);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\ImportExport\Export;
|
||||
|
||||
|
||||
/**
|
||||
* interface ImagesExportInterface
|
||||
* @package Thelia\ImportExport
|
||||
@@ -27,4 +26,4 @@ interface ImagesExportInterface
|
||||
* return an array with the paths to the images to include in the archive
|
||||
*/
|
||||
public function getImagesPaths();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ use Thelia\Model\Map\CountryI18nTableMap;
|
||||
use Thelia\Model\Map\CountryTableMap;
|
||||
use Thelia\Model\Map\CustomerTableMap;
|
||||
use Thelia\Model\Map\CustomerTitleI18nTableMap;
|
||||
use Thelia\Model\Map\CustomerTitleTableMap;
|
||||
use Thelia\Model\Map\NewsletterTableMap;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
@@ -215,7 +214,6 @@ class CustomerExport extends ExportHandler
|
||||
$dateTime = new \DateTime($date);
|
||||
$currentCustomer[CustomerTableMap::CREATED_AT] = $dateTime->format($lang->getDatetimeFormat());
|
||||
|
||||
|
||||
/**
|
||||
* Then compute everything about the orders
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Export\Type;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\Core\FileFormat\FormatType;
|
||||
use Thelia\ImportExport\Export\ExportHandler;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
@@ -28,7 +27,7 @@ use Thelia\Model\NewsletterQuery;
|
||||
class MailingExport extends ExportHandler
|
||||
{
|
||||
/**
|
||||
* @param Lang $lang
|
||||
* @param Lang $lang
|
||||
* @return array|\Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildDataSet(Lang $lang)
|
||||
@@ -42,7 +41,7 @@ class MailingExport extends ExportHandler
|
||||
->find()
|
||||
->toArray()
|
||||
;
|
||||
|
||||
|
||||
$customers = CustomerQuery::create()
|
||||
->select([
|
||||
CustomerTableMap::EMAIL,
|
||||
@@ -96,4 +95,4 @@ class MailingExport extends ExportHandler
|
||||
FormatType::UNBOUNDED,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ProductPricesExport extends ExportHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Lang $lang
|
||||
* @param Lang $lang
|
||||
* @return FormatterData
|
||||
*/
|
||||
public function buildDataSet(Lang $lang)
|
||||
@@ -126,5 +126,4 @@ class ProductPricesExport extends ExportHandler
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
namespace Thelia\ImportExport\Export\Type;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\Core\FileFormat\FormatType;
|
||||
use Thelia\ImportExport\Export\ExportHandler;
|
||||
use Thelia\Model\Map\ProductI18nTableMap;
|
||||
@@ -54,7 +53,7 @@ class ProductSEOExport extends ExportHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Lang $lang
|
||||
* @param Lang $lang
|
||||
* @return array|\Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildDataSet(Lang $lang)
|
||||
@@ -126,4 +125,4 @@ class ProductSEOExport extends ExportHandler
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,4 @@ abstract class ImportHandler extends AbstractHandler
|
||||
* The method does the import routine from a FormatterData
|
||||
*/
|
||||
abstract public function retrieveFromFormatterData(FormatterData $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class ProductPricesImport extends ImportHandler
|
||||
if (isset($row["promo"])) {
|
||||
$price
|
||||
->getProductSaleElements()
|
||||
->setPromo((int)$row["promo"])
|
||||
->setPromo((int) $row["promo"])
|
||||
->save()
|
||||
;
|
||||
}
|
||||
@@ -133,5 +133,4 @@ class ProductPricesImport extends ImportHandler
|
||||
return ["ref", "price"];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -91,4 +91,4 @@ class ProductStockImport extends ImportHandler
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,4 +75,4 @@ abstract class ContainerAwareTestCase extends \PHPUnit_Framework_TestCase
|
||||
* Use this method to build the container with the services that you need.
|
||||
*/
|
||||
abstract protected function buildContainer(ContainerBuilder $container);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,4 +193,4 @@ class CustomerExportTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ use Thelia\Core\FileFormat\FormatType;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\Map\AddressTableMap;
|
||||
use Thelia\Tests\ContainerAwareTestCase;
|
||||
|
||||
/**
|
||||
@@ -41,12 +40,10 @@ class ExportHandlerTest extends ContainerAwareTestCase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
$this->handler = $this->getMock(
|
||||
"Thelia\\ImportExport\\Export\\ExportHandler",
|
||||
[
|
||||
@@ -121,4 +118,4 @@ class ExportHandlerTest extends ContainerAwareTestCase
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,4 +49,4 @@ class MailingExportTest extends \PHPUnit_Framework_TestCase
|
||||
$this->handler->getHandledTypes()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use Thelia\ImportExport\Export\Type\ProductPricesExport;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
/**
|
||||
* Class ProductPricesExportTest
|
||||
@@ -47,8 +46,7 @@ class ProductPricesExportTest extends \PHPUnit_Framework_TestCase
|
||||
$max = 50;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $max; ++$i)
|
||||
{
|
||||
for ($i = 0; $i < $max; ++$i) {
|
||||
$row = $rawData[$i];
|
||||
|
||||
$rowKeys = array_keys($row);
|
||||
@@ -87,4 +85,4 @@ class ProductPricesExportTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($attributes, $rowAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,7 @@ namespace Thelia\Tests\ImportExport\Export;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\ImportExport\Export\Type\ProductSEOExport;
|
||||
use Thelia\Model\Base\ProductAssociatedContentQuery;
|
||||
use Thelia\Model\ContentI18nQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Model\ProductAssociatedContent;
|
||||
use Thelia\Model\ProductQuery;
|
||||
|
||||
/**
|
||||
@@ -49,8 +45,7 @@ class ProductSEOExportTest extends \PHPUnit_Framework_TestCase
|
||||
$max = 50;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $max; ++$i)
|
||||
{
|
||||
for ($i = 0; $i < $max; ++$i) {
|
||||
$row = $rawData[$i];
|
||||
$rowKeys = array_keys($row);
|
||||
|
||||
@@ -69,4 +64,4 @@ class ProductSEOExportTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($product->getRewrittenUrl("en_US"), $row["url"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ use Thelia\ImportExport\Import\Type\ProductPricesImport;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Thelia\Tests\Controller\ControllerTestBase;
|
||||
use Thelia\Tests\Controller\ImportExportControllerTrait;
|
||||
|
||||
/**
|
||||
* Class ProductPricesImportTest
|
||||
@@ -35,7 +34,6 @@ class ProductPricesImportTest extends ControllerTestBase
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Thelia\Controller\BaseController The controller you want to test
|
||||
*/
|
||||
@@ -44,7 +42,6 @@ class ProductPricesImportTest extends ControllerTestBase
|
||||
return new ImportController();
|
||||
}
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -112,4 +109,4 @@ class ProductPricesImportTest extends ControllerTestBase
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ class ProductStockImportTest extends ControllerTestBase
|
||||
return new ImportController();
|
||||
}
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -92,4 +91,4 @@ class ProductStockImportTest extends ControllerTestBase
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user