Merge branch 'frontend' of https://github.com/thelia/thelia into frontend

This commit is contained in:
touffies
2013-12-11 18:53:42 +01:00
15 changed files with 980 additions and 728 deletions

View File

@@ -250,7 +250,7 @@ class TemplateHelper
$translation = str_replace("'", "\'", $translations[$key]); $translation = str_replace("'", "\'", $translations[$key]);
fwrite($fp, sprintf("\t'%s' => '%s',\n", $text, $translation)); fwrite($fp, sprintf(" '%s' => '%s',\n", $text, $translation));
} }
} }

View File

@@ -35,13 +35,14 @@ use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderQuery; use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery; use Thelia\Model\ContentQuery;
use Thelia\Model\FolderQuery; use Thelia\Model\FolderQuery;
use Thelia\Tests\TestCaseWithURLToolSetup;
/** /**
* Class ContentTest * Class ContentTest
* @package Thelia\Tests\Action * @package Thelia\Tests\Action
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
class ContentTest extends BaseAction class ContentTest extends TestCaseWithURLToolSetup
{ {
public function getUpdateEvent(&$content) public function getUpdateEvent(&$content)

View File

@@ -31,14 +31,45 @@ use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
use Thelia\Core\Event\Folder\FolderUpdateEvent; use Thelia\Core\Event\Folder\FolderUpdateEvent;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Model\FolderQuery; use Thelia\Model\FolderQuery;
use Thelia\Tests\TestCaseWithURLToolSetup;
/** /**
* Class FolderTest * Class FolderTest
* @package Thelia\Tests\Action\ImageTest * @package Thelia\Tests\Action\ImageTest
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
class FolderTest extends BaseAction class FolderTest extends TestCaseWithURLToolSetup
{ {
use RewrittenUrlTestTrait;
public function getUpdateEvent(&$folder)
{
if(!$folder instanceof \Thelia\Model\Folder) {
$folder = $this->getRandomFolder();
}
$event = new FolderUpdateEvent($folder->getId());
$event
->setVisible(1)
->setLocale($folder->getLocale())
->setTitle($folder->getTitle())
->setChapo($folder->getChapo())
->setDescription($folder->getDescription())
->setPostscriptum($folder->getPostscriptum())
->setParent($folder->getParent())
;
return $event;
}
public function processUpdateAction($event)
{
$contentAction = new Folder($this->getContainer());
$contentAction->update($event);
return $event->getFolder();
}
/** /**
* test folder creation * test folder creation
* @covers Thelia\Action\Folder::create * @covers Thelia\Action\Folder::create

View File

@@ -8,30 +8,17 @@ use Thelia\Model\ConfigQuery;
use Thelia\Rewriting\RewritingResolver; use Thelia\Rewriting\RewritingResolver;
use Thelia\Tools\URL; use Thelia\Tools\URL;
/**
* Class RewrittenUrlTestTrait
* @package Thelia\Tests\Action
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
trait RewrittenUrlTestTrait trait RewrittenUrlTestTrait
{ {
abstract public function getUpdateEvent(&$object); abstract public function getUpdateEvent(&$object);
abstract public function processUpdateAction($event); abstract public function processUpdateAction($event);
public function setUp()
{
new URL(null);
}
/**
* @expectedException \Thelia\Form\Exception\FormValidationException
* @expectedExceptionCode 100
*/
public function testUpdateEmptyUrl()
{
$object = null;
$event = $this->getUpdateEvent($object);
$event->setUrl('');
$updatedObject = $this->processUpdateAction($event);
}
/** /**
* @expectedException \Thelia\Form\Exception\FormValidationException * @expectedException \Thelia\Form\Exception\FormValidationException
* @expectedExceptionCode 100 * @expectedExceptionCode 100
@@ -54,7 +41,7 @@ trait RewrittenUrlTestTrait
$event->setUrl($existingUrl->getUrl()); $event->setUrl($existingUrl->getUrl());
$updatedObject = $this->processUpdateAction($event); $this->processUpdateAction($event);
} }
public function testUpdateUrl() public function testUpdateUrl()

View File

@@ -30,15 +30,21 @@ namespace Thelia\Tests;
*/ */
class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase
{ {
private $container = null;
public function __construct() public function __construct()
{ {
$this->container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
$this->container->set("event_dispatcher", $dispatcher);
$this->setupURLTool(); $this->setupURLTool();
} }
protected function setupURLTool() protected function setupURLTool()
{ {
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$context = new \Symfony\Component\Routing\RequestContext( $context = new \Symfony\Component\Routing\RequestContext(
'/thelia/index.php', '/thelia/index.php',
'GET', 'GET',
@@ -57,8 +63,13 @@ class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase
->method('getContext') ->method('getContext')
->will($this->returnValue($context)); ->will($this->returnValue($context));
$container->set("router.admin", $router); $this->container->set("router.admin", $router);
new \Thelia\Tools\URL($container); new \Thelia\Tools\URL($this->container);
}
public function getContainer()
{
return $this->container;
} }
} }

View File

@@ -51,17 +51,12 @@ class URL
self::$instance = $this; self::$instance = $this;
if ($container !== null) if ($container !== null)
$this->requestContext = $this->getContext($container); $this->requestContext = $container->get('router.admin')->getContext();
$this->retriever = new RewritingRetriever(); $this->retriever = new RewritingRetriever();
$this->resolver = new RewritingResolver(); $this->resolver = new RewritingResolver();
} }
public function getContext($container)
{
return $container->get('router.admin')->getContext();
}
/** /**
* Return this class instance, only once instanciated. * Return this class instance, only once instanciated.
* *

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@
{if !$IS_ENABLED} {if !$IS_ENABLED}
<div class="alert alert-info"> <div class="alert alert-info">
<span class="glyphicon glyphicon-question-sign"></span> <span class="glyphicon glyphicon-question-sign"></span>
{intl l='This coupon is disabled, you can enable to the bottom of this form.'} {intl l='This coupon is disabled, you can enable at the bottom of this form.'}
</div> </div>
{/if} {/if}

View File

@@ -46,7 +46,7 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if} {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<p class="title title-without-tabs">{intl l="Image informations"}</p> <p class="title title-without-tabs">{intl l="Image information"}</p>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">

View File

@@ -7,7 +7,7 @@
<form method="POST" action="{url path='/admin/content/folder/add'}" id="related_content_form"> <form method="POST" action="{url path='/admin/content/folder/add'}" id="related_content_form">
<p class="title title-without-tabs">{intl l='Additional Folders'}</p> <p class="title title-without-tabs">{intl l='Additional Folders'}</p>
<p>{intl l='A content could be attached to more than one folder. Select here the additional fodlers for this content.'} <p>{intl l='A content could be attached to more than one folder. Select here the additional folders for this content.'}
{loop name="default_folder" type="folder" id=$DEFAULT_FOLDER} {loop name="default_folder" type="folder" id=$DEFAULT_FOLDER}
{intl l='You can change the default folder (%title) in the "General" tab.' title=$TITLE} {intl l='You can change the default folder (%title) in the "General" tab.' title=$TITLE}
{/loop} {/loop}

View File

@@ -25,7 +25,7 @@
<div class="alert alert-info"> <div class="alert alert-info">
<p>{intl l="In order to manges your shop taxes you can manage"} <strong>{intl l="taxes"}</strong> {intl l="and"} <strong>{intl l="tax rules"}</strong>.</p> <p>{intl l="In order to manges your shop taxes you can manage"} <strong>{intl l="taxes"}</strong> {intl l="and"} <strong>{intl l="tax rules"}</strong>.</p>
<p>{intl l="Taxes define the amount of money which is add to a bought product."}</p> <p>{intl l="Taxes define the amount of money which is added to a bought product."}</p>
<p> <p>
{intl l="Example :"} {intl l="Example :"}
<ul> <ul>

0
templates/email/default/I18n/en_US.php Normal file → Executable file
View File

0
templates/email/default/I18n/es_ES.php Normal file → Executable file
View File

0
templates/email/default/I18n/fr_FR.php Normal file → Executable file
View File

0
templates/email/default/I18n/it_IT.php Normal file → Executable file
View File