Merge branch 'master' into modules

Conflicts:
	templates/backOffice/default/product-edit.html
This commit is contained in:
Manuel Raynaud
2013-12-17 10:48:59 +01:00
121 changed files with 4530 additions and 2203 deletions

View File

@@ -44,7 +44,6 @@ use Thelia\Tests\TestCaseWithURLToolSetup;
*/
class ContentTest extends TestCaseWithURLToolSetup
{
use RewrittenUrlTestTrait;
public function getUpdateEvent(&$content)
{
@@ -111,7 +110,6 @@ class ContentTest extends TestCaseWithURLToolSetup
->setChapo('test update content short description')
->setDescription('test update content description')
->setPostscriptum('test update content postscriptum')
->setUrl($content->getRewrittenUrl('en_US'))
->setDefaultFolder($folder->getId())
;

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/
namespace Thelia\Tests\Action;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Action\Folder;
use Thelia\Core\Event\Folder\FolderCreateEvent;
@@ -29,6 +30,7 @@ use Thelia\Core\Event\Folder\FolderDeleteEvent;
use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
use Thelia\Core\Event\Folder\FolderUpdateEvent;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Model\FolderQuery;
use Thelia\Tests\TestCaseWithURLToolSetup;
@@ -61,6 +63,29 @@ class FolderTest extends TestCaseWithURLToolSetup
return $event;
}
public function getUpdateSeoEvent(&$folder)
{
if(!$folder instanceof \Thelia\Model\Folder) {
$folder = $this->getRandomFolder();
}
$event = new UpdateSeoEvent($folder->getId());
$event
->setLocale($folder->getLocale())
->setMetaTitle($folder->getMetaTitle())
->setMetaDescription($folder->getMetaDescription())
->setMetaKeywords($folder->getMetaKeywords());
return $event;
}
public function processUpdateSeoAction($event)
{
$contentAction = new Folder($this->getContainer());
return $contentAction->updateSeo($event);
}
public function processUpdateAction($event)
{
$contentAction = new Folder($this->getContainer());
@@ -113,7 +138,6 @@ class FolderTest extends TestCaseWithURLToolSetup
->setChapo('test folder update chapo')
->setDescription('update folder description')
->setPostscriptum('update folder postscriptum')
->setUrl($folder->getRewrittenUrl('en_US'))
->setParent(0)
;

View File

@@ -17,7 +17,9 @@ use Thelia\Rewriting\RewritingResolver;
trait RewrittenUrlTestTrait
{
abstract public function getUpdateEvent(&$object);
abstract public function getUpdateSeoEvent(&$object);
abstract public function processUpdateAction($event);
abstract public function processUpdateSeoAction($event);
/**
* @expectedException \Thelia\Form\Exception\FormValidationException
@@ -26,7 +28,7 @@ trait RewrittenUrlTestTrait
public function testUpdateExistingUrl()
{
$object = null;
$event = $this->getUpdateEvent($object);
$event = $this->getUpdateSeoEvent($object);
/* get an existing url */
$existingUrl = RewritingUrlQuery::create()
@@ -41,13 +43,13 @@ trait RewrittenUrlTestTrait
$event->setUrl($existingUrl->getUrl());
$this->processUpdateAction($event);
$this->processUpdateSeoAction($event);
}
public function testUpdateUrl()
{
$object = null;
$event = $this->getUpdateEvent($object);
$event = $this->getUpdateSeoEvent($object);
$currentUrl = $object->getRewrittenUrl($object->getLocale());
@@ -69,7 +71,7 @@ trait RewrittenUrlTestTrait
$event->setUrl($newUrl);
$updatedObject = $this->processUpdateAction($event);
$updatedObject = $this->processUpdateSeoAction($event);
/* new URL is updated */
$this->assertEquals($newUrl, $updatedObject->getRewrittenUrl($object->getLocale()));