diff --git a/composer.json b/composer.json index c4a2b665f..8788db05d 100644 --- a/composer.json +++ b/composer.json @@ -33,10 +33,11 @@ "simplepie/simplepie": "dev-master", "imagine/imagine": "0.*", "symfony/icu": "1.0", - "swiftmailer/swiftmailer": "5.0.*", + "swiftmailer/swiftmailer": "5.2.*", "symfony/serializer": "2.3.*", "ensepar/html2pdf": "1.0.1", - "symfony/finder": "~2.2" + "symfony/finder": "~2.2", + "symfony/browser-kit": "2.3.*" }, "require-dev": { "phpunit/phpunit": "4.1.*", diff --git a/composer.lock b/composer.lock index 30991c403..2f1e713a0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "73a6895063dd76bcb25eb14ef329e745", + "hash": "4606e1d72b13b6b8fa84dca5f7bac16b", "packages": [ { "name": "doctrine/cache", @@ -608,25 +608,28 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.0.2", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "f3917ecef35a4e4d98b303eb9fee463bc983f379" + "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/f3917ecef35a4e4d98b303eb9fee463bc983f379", - "reference": "f3917ecef35a4e4d98b303eb9fee463bc983f379", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/2b9af56cc676c338d52fca4c657e5bdff73bb7af", + "reference": "2b9af56cc676c338d52fca4c657e5bdff73bb7af", "shasum": "" }, "require": { "php": ">=5.2.4" }, + "require-dev": { + "mockery/mockery": "~0.9.1" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-master": "5.2-dev" } }, "autoload": { @@ -641,7 +644,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Chris Corbyn" @@ -653,7 +658,7 @@ "mail", "mailer" ], - "time": "2013-08-30 12:35:21" + "time": "2014-06-13 11:44:54" }, { "name": "symfony-cmf/routing", @@ -704,6 +709,63 @@ ], "time": "2013-03-25 15:02:40" }, + { + "name": "symfony/browser-kit", + "version": "v2.3.13", + "target-dir": "Symfony/Component/BrowserKit", + "source": { + "type": "git", + "url": "https://github.com/symfony/BrowserKit.git", + "reference": "97563874c24b65ea8d31b82fe051a161caf83e10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/97563874c24b65ea8d31b82fe051a161caf83e10", + "reference": "97563874c24b65ea8d31b82fe051a161caf83e10", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/dom-crawler": "~2.0" + }, + "require-dev": { + "symfony/css-selector": "~2.0", + "symfony/process": "~2.0" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\BrowserKit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "http://symfony.com", + "time": "2014-04-18 20:35:25" + }, { "name": "symfony/class-loader", "version": "v2.2.6", @@ -903,6 +965,61 @@ "homepage": "http://symfony.com", "time": "2013-07-21 09:38:59" }, + { + "name": "symfony/dom-crawler", + "version": "v2.4.4", + "target-dir": "Symfony/Component/DomCrawler", + "source": { + "type": "git", + "url": "https://github.com/symfony/DomCrawler.git", + "reference": "e94b29c7cac964e58c406408d238ceeaa3604e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/e94b29c7cac964e58c406408d238ceeaa3604e78", + "reference": "e94b29c7cac964e58c406408d238ceeaa3604e78", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/css-selector": "~2.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DomCrawler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "http://symfony.com", + "time": "2014-04-18 20:37:09" + }, { "name": "symfony/event-dispatcher", "version": "v2.2.6", diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index e6e9b9f65..17ae95cc8 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -79,7 +79,7 @@ class Address extends BaseAction implements EventSubscriberInterface ->save() ; - if ($event->getIsDefault()) { + if ($event->getIsDefault() && !$addressModel->getIsDefault()) { $addressModel->makeItDefault(); } diff --git a/core/lib/Thelia/Condition/Implementation/StartDate.php b/core/lib/Thelia/Condition/Implementation/StartDate.php index 2524e1b6d..d086fb39a 100644 --- a/core/lib/Thelia/Condition/Implementation/StartDate.php +++ b/core/lib/Thelia/Condition/Implementation/StartDate.php @@ -127,10 +127,6 @@ class StartDate extends ConditionAbstract */ public function getSummary() { - $i18nOperator = Operators::getI18n( - $this->translator, $this->operators[self::START_DATE] - ); - $date = new \DateTime(); $date->setTimestamp($this->values[self::START_DATE]); $strDate = $date->format($this->getDateFormat()); diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 7dcd827b1..42696a22c 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -1165,7 +1165,7 @@ - Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction + Thelia\Controller\Admin\CustomerExportController::newsletterExportAction diff --git a/core/lib/Thelia/Config/Resources/test.xml b/core/lib/Thelia/Config/Resources/test.xml new file mode 100644 index 000000000..b1190195e --- /dev/null +++ b/core/lib/Thelia/Config/Resources/test.xml @@ -0,0 +1,28 @@ + + + + + + Thelia\Core\HttpKernel\Client + + Symfony\Component\BrowserKit\History + Symfony\Component\BrowserKit\CookieJar + + + + + + %test.client.parameters% + + + + + + + + + + + diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 06f81aaaa..370b504c1 100644 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -14,7 +14,6 @@ namespace Thelia\Controller\Admin; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Router; use Thelia\Condition\ConditionFactory; diff --git a/core/lib/Thelia/Controller/Admin/CustomerExportController.php b/core/lib/Thelia/Controller/Admin/CustomerExportController.php index 5e9900dba..0036f2d53 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerExportController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerExportController.php @@ -25,7 +25,7 @@ use Thelia\Model\NewsletterQuery; class CustomerExportController extends BaseAdminController { - public function NewsletterExportAction() + public function newsletterExportAction() { if (null !== $response = $this->checkAuth([AdminResources::EXPORT_CUSTOMER_NEWSLETTER], [], [AccessManager::VIEW])) { return $response; diff --git a/core/lib/Thelia/Controller/Admin/TranslationsController.php b/core/lib/Thelia/Controller/Admin/TranslationsController.php index 93aab31cb..6c2aed749 100644 --- a/core/lib/Thelia/Controller/Admin/TranslationsController.php +++ b/core/lib/Thelia/Controller/Admin/TranslationsController.php @@ -181,13 +181,6 @@ class TranslationsController extends BaseAdminController case 'ma' : $template = new TemplateDefinition($item_name, TemplateDefinition::EMAIL); break; - - default: - /* - throw new \InvalidArgumentException( - $this->getTranslator()->trans("Undefined translation type: %item", ['%item' => $item_to_translate]) - ); - */ } if ($template) { diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php index ae2312aae..9b3a979da 100644 --- a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php @@ -14,7 +14,6 @@ namespace Thelia\Core\Event\Coupon; use Thelia\Core\Event\ActionEvent; use Thelia\Condition\ConditionCollection; use Thelia\Model\Coupon; -use Thelia\Model\Exception\InvalidArgumentException; /** * Occurring when a Coupon is created or updated diff --git a/core/lib/Thelia/Core/HttpKernel/Client.php b/core/lib/Thelia/Core/HttpKernel/Client.php new file mode 100644 index 000000000..fca5066d5 --- /dev/null +++ b/core/lib/Thelia/Core/HttpKernel/Client.php @@ -0,0 +1,43 @@ + + */ +class Client extends BaseClient +{ + + /** + * Converts the BrowserKit request to a HttpKernel request. + * + * @param DomRequest $request A Request instance + * + * @return Request A Request instance + */ + protected function filterRequest(DomRequest $request) + { + $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); + + $httpRequest->files->replace($this->filterFiles($httpRequest->files->all())); + + return $httpRequest; + } + +} diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index 1038541de..e08d13dd6 100644 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -536,4 +536,4 @@ abstract class BaseLoop */ abstract protected function getArgDefinitions(); -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 90b54e3fd..e416aa9a1 100644 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -190,9 +190,6 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface, Search } } - /* @todo */ - $notEmpty = $this->getNot_empty(); - return $search; } @@ -217,6 +214,7 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface, Search ->set("DESCRIPTION" , $category->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM" , $category->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("PARENT" , $category->getParent()) + ->set("ROOT" , $category->getRoot($category->getId())) ->set("URL" , $category->getUrl($this->locale)) ->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE')) ->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php index c46739aa9..310a760e2 100644 --- a/core/lib/Thelia/Core/Template/Loop/Coupon.php +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -152,9 +152,6 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface /** @var ConditionFactory $conditionFactory */ $conditionFactory = $this->container->get('thelia.condition.factory'); - /** @var Request $request */ - $request = $this->container->get('request'); - /** @var MCoupon $coupon */ foreach ($loopResult->getResultDataCollection() as $coupon) { diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 618c411e3..73719a775 100644 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -157,9 +157,6 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLo } } - /* @todo */ - $notEmpty = $this->getNot_empty(); - return $search; } @@ -178,6 +175,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLo ->set("DESCRIPTION" , $folder->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM" , $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("PARENT" , $folder->getParent()) + ->set("ROOT" , $folder->getRoot($folder->getId())) ->set("URL" , $folder->getUrl($this->locale)) ->set("META_TITLE" , $folder->getVirtualColumn('i18n_META_TITLE')) ->set("META_DESCRIPTION" , $folder->getVirtualColumn('i18n_META_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index b10c1f1ad..b987d6912 100644 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -69,7 +69,7 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('id', 'id_reverse', 'code', 'code_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'enabled', 'enabled_reverse')) + new Type\EnumListType(array('id', 'id_reverse', 'code', 'code_reverse', 'title', 'title_reverse', 'manual', 'manual_reverse', 'enabled', 'enabled_reverse')) ), 'manual' ), @@ -133,10 +133,10 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface case "id_reverse": $search->orderById(Criteria::DESC); break; - case "alpha": + case "title": $search->addAscendingOrderByColumn('i18n_TITLE'); break; - case "alpha_reverse": + case "title_reverse": $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "code": diff --git a/core/lib/Thelia/Coupon/Type/FreeProduct.php b/core/lib/Thelia/Coupon/Type/FreeProduct.php index 5fe65b1b0..3032813a8 100644 --- a/core/lib/Thelia/Coupon/Type/FreeProduct.php +++ b/core/lib/Thelia/Coupon/Type/FreeProduct.php @@ -230,17 +230,10 @@ class FreeProduct extends AbstractRemoveOnProducts $this->setRelatedCartItem($eligibleProduct, $cartEvent->getCartItem()->getId()); $freeProductCartItem = $cartEvent->getCartItem(); - - // Setting product price is dangerous, as the customer could change the ordered quantity of this product. - // We will instead add the product price to the order discount. - // $cartEvent->getCartItem()->setPrice(0)->save(); } } if ($freeProductCartItem instanceof CartItem) { - - $taxCountry = $this->facade->getDeliveryCountry(); - // The discount is the product price. $discount = $freeProductCartItem->getPromo() ? $freeProductCartItem->getPromoPrice() : $freeProductCartItem->getPrice(); diff --git a/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php b/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php index caa446cd7..957114ffb 100644 --- a/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php +++ b/core/lib/Thelia/Coupon/Type/PercentageCouponTrait.php @@ -11,6 +11,7 @@ /*************************************************************************************/ namespace Thelia\Coupon\Type; +use Thelia\Core\Translation\Translator; /** * A trait to manage a coupon which removes a percentage of cart items from the order total. diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php index 1aade8a5c..2f36f085f 100644 --- a/core/lib/Thelia/Log/Tlog.php +++ b/core/lib/Thelia/Log/Tlog.php @@ -78,7 +78,7 @@ class Tlog Implements LoggerInterface protected $mode_back_office = false; protected $level = self::MUET; - protected $prefixe = ""; + protected $prefix = ""; protected $files = array(); protected $all_files = false; protected $show_redirect = false; @@ -194,9 +194,9 @@ class Tlog Implements LoggerInterface return $this; } - public function setPrefix($prefixe) + public function setPrefix($prefix) { - $this->prefixe = $prefixe; + $this->prefix = $prefix; return $this; } @@ -609,7 +609,7 @@ class Tlog Implements LoggerInterface private function findOrigin() { - $origine = array(); + $origin = array(); if (function_exists('debug_backtrace')) { @@ -624,8 +624,8 @@ class Tlog Implements LoggerInterface $className = $hop['class']; if (! empty($className) && ($className == ltrim(__CLASS__,'\\') || strtolower(get_parent_class($className)) == ltrim(__CLASS__,'\\'))) { - $origine['line'] = $hop['line']; - $origine['file'] = $hop['file']; + $origin['line'] = $hop['line']; + $origin['file'] = $hop['file']; break; } } @@ -633,7 +633,7 @@ class Tlog Implements LoggerInterface $hop = array_pop($trace); } - $origine['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main'; + $origin['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main'; if(isset($prevHop['function']) && $prevHop['function'] !== 'include' && @@ -641,13 +641,13 @@ class Tlog Implements LoggerInterface $prevHop['function'] !== 'require' && $prevHop['function'] !== 'require_once') { - $origine['function'] = $prevHop['function']; + $origin['function'] = $prevHop['function']; } else { - $origine['function'] = 'main'; + $origin['function'] = 'main'; } } - return $origine; + return $origin; } protected function interpolate($message, array $context = array()) @@ -676,22 +676,22 @@ class Tlog Implements LoggerInterface $text = $this->interpolate($text, $context); - $origine = $this->findOrigin(); + $origin = $this->findOrigin(); - $file = basename($origine['file']); + $file = basename($origin['file']); if ($this->isActivedFile($file)) { - $function = $origine['function']; - $line = $origine['line']; + $function = $origin['function']; + $line = $origin['line']; - $prefixe = str_replace( + $prefix = str_replace( array("#INDEX", "#LEVEL", "#FILE", "#FUNCTION", "#LINE", "#DATE", "#HOUR"), array(1+$this->linecount, $level, $file, $function, $line, date("Y-m-d"), date("G:i:s")), - $this->prefixe + $this->prefix ); - $trace = $prefixe . $text; + $trace = $prefix . $text; foreach ($this->destinations as $dest) { $dest->add($trace); @@ -706,7 +706,7 @@ class Tlog Implements LoggerInterface * @param type $destinations * @param array $actives array containing classes instanceof AbstractTlogDestination */ - protected function loadDestinations(&$destinations, array $actives = NULL) + protected function loadDestinations(&$destinations, array $actives = null) { foreach ($actives as $active) { if (class_exists($active)) { diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index 298650626..8e188c265 100644 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -60,6 +60,28 @@ class Category extends BaseCategory implements FileModelParentInterface return $countProduct; } + /** + * Get the root category + * @param int $categoryId + * @return mixed + */ + public function getRoot($categoryId) + { + + $category = CategoryQuery::create()->findPk($categoryId); + + if(0 !== $category->getParent()) { + $parentCategory = CategoryQuery::create()->findPk($category->getParent()); + + if (null !== $parentCategory) { + $categoryId = $this->getRoot($parentCategory->getId()); + } + } + + return $categoryId; + + } + /** * Calculate next position relative to our parent */ diff --git a/core/lib/Thelia/Model/Folder.php b/core/lib/Thelia/Model/Folder.php index 43fda79c0..e722a560c 100644 --- a/core/lib/Thelia/Model/Folder.php +++ b/core/lib/Thelia/Model/Folder.php @@ -56,6 +56,28 @@ class Folder extends BaseFolder implements FileModelParentInterface } + /** + * Get the root folder + * @param int $folderId + * @return mixed + */ + public function getRoot($folderId) + { + + $folder = FolderQuery::create()->findPk($folderId); + + if(0 !== $folder->getParent()) { + $parentFolder = FolderQuery::create()->findPk($folder->getParent()); + + if (null !== $parentFolder) { + $folderId = $this->getRoot($parentFolder->getId()); + } + } + + return $folderId; + + } + /** * Calculate next position relative to our parent */ diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php index 91101544c..7677e66d8 100644 --- a/core/lib/Thelia/Tests/Action/AddressTest.php +++ b/core/lib/Thelia/Tests/Action/AddressTest.php @@ -12,8 +12,11 @@ namespace Thelia\Tests\Action; +use Propel\Runtime\Propel; use Thelia\Action\Address; use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\AddressQuery; use Thelia\Model\CustomerQuery; /** @@ -121,4 +124,71 @@ class AddressTest extends \PHPUnit_Framework_TestCase } + /** + * Bug found in Thelia 2.0.2 + */ + public function testUpdateDefaultAddress() + { + /** + * Disable propel cache in order to get a new instance of the + * active record in $updatedAddress + */ + Propel::disableInstancePooling(); + + /** + * Get a customer and it's default address + */ + $customer = CustomerQuery::create()->findOne(); + $defaultAddress = $customer->getDefaultAddress(); + $addressId = $defaultAddress->getId(); + + /** + * Try to update the address, and set the isDefault argument, + * that should keep this address as the default one. + */ + $addressEvent = new AddressCreateOrUpdateEvent( + "", + 1, + "Thelia modif", + "Thelia modif", + "cour des étoiles", + "rue des miracles", + "", + "63000", + "clermont-ferrand", + 64, + "0102030405", + "", + "", + 1 + ); + + $addressEvent->setAddress($defaultAddress); + $addressEvent->setDispatcher( + $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface") + ); + + /** + * Do the update + */ + $actionAddress = new Address(); + $actionAddress->update($addressEvent); + + $updatedAddress = AddressQuery::create() + ->findPk($addressId); + + /** + * This address should still be the default address + */ + $this->assertEquals( + 1, + $updatedAddress->getIsDefault() + ); + + /** + * Renable it after + */ + Propel::enableInstancePooling(); + } + } diff --git a/core/lib/Thelia/Tests/WebTestCase.php b/core/lib/Thelia/Tests/WebTestCase.php new file mode 100644 index 000000000..2976b6dfa --- /dev/null +++ b/core/lib/Thelia/Tests/WebTestCase.php @@ -0,0 +1,59 @@ + + */ +class WebTestCase extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Thelia\Core\Thelia + */ + protected static $kernel; + + /** + * @param array $options + * @param array $server + * @return \Symfony\Component\HttpKernel\Client + */ + protected static function createClient(array $options = [], array $server = []) + { + if (null !== static::$kernel) { + static::$kernel->shutdown(); + } + + static::$kernel = new Thelia('test', true); + static::$kernel->boot(); + + $client = static::$kernel->getContainer()->get('test.client'); + $client->setServerParameters($server); + + return $client; + } + + /** + * Shuts the kernel down if it was used in the test. + */ + protected function tearDown() + { + if (null !== static::$kernel) { + static::$kernel->shutdown(); + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/bootstrap.php b/core/lib/Thelia/Tests/bootstrap.php index 86f6d8355..c4733ca1d 100755 --- a/core/lib/Thelia/Tests/bootstrap.php +++ b/core/lib/Thelia/Tests/bootstrap.php @@ -5,6 +5,7 @@ * @file * Functions needed for Thelia bootstrap */ +ini_set('session.use_cookies', 0); $env = "test"; require_once __DIR__ . '/../../../bootstrap.php'; diff --git a/local/modules/Colissimo/Config/prices.json b/local/modules/Colissimo/Config/prices.json index 1b23c825c..f1e040600 100755 --- a/local/modules/Colissimo/Config/prices.json +++ b/local/modules/Colissimo/Config/prices.json @@ -1,17 +1,17 @@ {"1": { "_info": "area 1 : France", "slices": { - "0.25": "5.23", - "0.5": 5.8, - "0.75": 6.56, - "1": 7.13, - "2": 8.08, - "3": 9.22, - "5": 11.31, - "7": 13.4, - "10": 16.53, - "15": 19.14, - "30": 26.93 + "0.25": 5.23, + "0.5": 5.99, + "0.75": 6.75, + "1": 7.36, + "2": 8.36, + "3": 9.55, + "5": 11.73, + "7": 13.92, + "10": 17.15, + "15": 19.81, + "30": 27.79 } }, "2": { "_info": "area 2 : A Zone - Union Europ\u00e9enne et Suisse", @@ -34,87 +34,87 @@ }, "3": { "_info": "area 3 : B Zone - Pays de l\u2019Europe de l\u2019Est (hors Union Europ\u00e9enne), Norv\u00e8ge, Maghreb", "slices": { - "1": 18.81, - "2": 20.62, - "3": 24.94, - "4": 29.26, - "5": 33.58, - "6": 37.91, - "7": 42.23, - "8": 46.55, - "9": 50.87, - "10": 55.2, - "15": 65.08, - "20": 74.96 + "1": 19.38, + "2": 22.23, + "3": 26.46, + "4": 30.69, + "5": 34.96, + "6": 39.24, + "7": 43.51, + "8": 47.79, + "9": 52.06, + "10": 56.34, + "15": 66.79, + "20": 77.24 } }, "4": { "_info": "area 4 : C Zone - Pays d\u2019Afrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient", "slices": { - "1": 22.04, - "2": 29.55, - "3": 38.86, - "4": 48.17, - "5": 57.48, - "6": 66.79, - "7": 76.1, - "8": 85.41, - "9": 94.72, - "10": 104.03, - "15": 126.92, - "20": 149.82 + "1": 23.66, + "2": 31.26, + "3": 40.47, + "4": 49.69, + "5": 58.90, + "6": 68.12, + "7": 77.33, + "8": 86.55, + "9": 95.76, + "10": 104.98, + "15": 129.87, + "20": 154.76 } }, "5": { "_info": "area 5 : D Zone - Autres destinations", "slices": { - "1": 25.08, - "2": 37.72, - "3": 50.26, - "4": 62.8, - "5": 75.34, - "6": 87.88, - "7": 100.42, - "8": 112.96, - "9": 125.5, - "10": 138.04, - "15": 162.74, - "20": 187.44 + "1": 26.27, + "2": 38.81, + "3": 51.35, + "4": 63.89, + "5": 76.43, + "6": 88.97, + "7": 101.51, + "8": 114.05, + "9": 126.59, + "10": 139.13, + "15": 163.83, + "20": 188.53 } }, "6": { "_info": "area 6 : France OM1", "slices": { - "0.5": 8.27, - "1": 12.49, - "2": 17.05, - "3": 21.61, - "4": 26.17, - "5": 30.73, - "6": 35.29, - "7": 39.85, - "8": 44.41, - "9": 48.97, - "10": 53.53, - "15": 76.33, - "20": 99.13, - "25": 121.93, - "30": 144.73 + "0.5": 8.5, + "1": 12.87, + "2": 17.58, + "3": 22.28, + "4": 26.98, + "5": 31.68, + "6": 36.39, + "7": 41.09, + "8": 45.79, + "9": 50.49, + "10": 55.2, + "15": 78.95, + "20": 102.7, + "25": 126.45, + "30": 150.2 } }, "7": { "_info": "area 7 : France OM2", "slices": { - "0.5": 9.88, - "1": 14.92, - "2": 26.32, - "3": 37.72, - "4": 49.12, - "5": 60.52, - "6": 71.92, - "7": 83.32, - "8": 94.72, - "9": 106.12, - "10": 117.52, - "15": 174.52, - "20": 231.52, - "25": 288.52, - "30": 345.52 + "0.5": 10.17, + "1": 15.39, + "2": 27.12, + "3": 38.86, + "4": 50.59, + "5": 62.32, + "6": 74.05, + "7": 85.79, + "8": 97.52, + "9": 109.25, + "10": 120.98, + "15": 179.69, + "20": 238.4, + "25": 297.11, + "30": 355.82 } -}} \ No newline at end of file +}} diff --git a/setup/update/2.0.3.sql b/setup/update/2.0.3.sql index 230c3e1cf..05993427a 100644 --- a/setup/update/2.0.3.sql +++ b/setup/update/2.0.3.sql @@ -44,16 +44,70 @@ CREATE TABLE `order_version` REFERENCES `order` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB CHARACTER SET='utf8'; +UPDATE `order` SET + `version` = 1, + `version_created_at` = NOW(), + `version_created_by` = 'Thelia' +WHERE `version` = 0; + +INSERT INTO `order_version`( + `id`, + `ref`, + `customer_id`, + `invoice_order_address_id`, + `delivery_order_address_id`, + `invoice_date`, + `currency_id`, + `currency_rate`, + `transaction_ref`, + `delivery_ref`, + `invoice_ref`, + `discount`, + `postage`, + `payment_module_id`, + `delivery_module_id`, + `status_id`, + `lang_id`, + `created_at`, + `updated_at`, + `version`, + `version_created_at`, + `version_created_by`) + SELECT + `id`, + `ref`, + `customer_id`, + `invoice_order_address_id`, + `delivery_order_address_id`, + `invoice_date`, + `currency_id`, + `currency_rate`, + `transaction_ref`, + `delivery_ref`, + `invoice_ref`, + `discount`, + `postage`, + `payment_module_id`, + `delivery_module_id`, + `status_id`, + `lang_id`, + `created_at`, + `updated_at`, + `version`, + `version_created_at`, + `version_created_by` + FROM `order`; + # Add missing columns to coupon (version_created_at, version_created_by) ALTER TABLE `coupon` ADD `version_created_at` DATE AFTER `version`; ALTER TABLE `coupon` ADD `version_created_by` VARCHAR(100) AFTER `version_created_at`; +# Add Brand tables and related resources + # Add the "brand" resource INSERT INTO resource (`code`, `created_at`, `updated_at`) VALUES ('admin.brand', NOW(), NOW()); -# Add Brand tables - -- --------------------------------------------------------------------- -- brand -- ---------------------------------------------------------------------