Merge branch 'master' of https://github.com/thelia/thelia into upload_management
# By Manuel Raynaud (60) and others # Via Manuel Raynaud (16) and others * 'master' of https://github.com/thelia/thelia: (113 commits) implement process for changing folder position allow possibility to change folder visibility allow to create folder add dispatcher before/after for folder crud management icreate folder delete event process folder update action create folder events display info in folders edition template push model re-add home link in menu comment dev menu in layout translate some missing string fixes order integration order process change some informations in layou fix query in Thelia\Model\Folder::countAllContents allow to order products on category page Add default language & editing language default field Vertical align middle tables Fixed translations ... Conflicts: core/lib/Thelia/Tools/I18n.php templates/admin/default/category-edit.html
This commit is contained in:
106
core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php
Executable file
106
core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Tests\Command;
|
||||
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Thelia\Command\ModuleActivateCommand;
|
||||
use Thelia\Core\Application;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Module\BaseModule;
|
||||
|
||||
/**
|
||||
* Class ModuleActivateCommandTest
|
||||
*
|
||||
* @package Thelia\Tests\Command
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testModuleActivateCommand()
|
||||
{
|
||||
$module = ModuleQuery::create()->findOne();
|
||||
|
||||
if(null !== $module) {
|
||||
$application = new Application($this->getKernel());
|
||||
|
||||
$module->setActivate(BaseModule::IS_NOT_ACTIVATED);
|
||||
$module->save();
|
||||
|
||||
$moduleActivate = new ModuleActivateCommand();
|
||||
$moduleActivate->setContainer($this->getContainer());
|
||||
|
||||
$application->add($moduleActivate);
|
||||
|
||||
$command = $application->find("module:activate");
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->execute(array(
|
||||
"command" => $command->getName(),
|
||||
"module" => $module->getCode(),
|
||||
));
|
||||
|
||||
$this->assertEquals(BaseModule::IS_ACTIVATED, ModuleQuery::create()->findPk($module->getId())->getActivate());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage module Letshopethismoduledoesnotexists not found
|
||||
*/
|
||||
public function testModuleActivateCommandUnknownModule()
|
||||
{
|
||||
$testedModule = ModuleQuery::create()->findOneByCode('Letshopethismoduledoesnotexists');
|
||||
|
||||
if(null == $testedModule) {
|
||||
$application = new Application($this->getKernel());
|
||||
|
||||
|
||||
$moduleActivate = new ModuleActivateCommand();
|
||||
$moduleActivate->setContainer($this->getContainer());
|
||||
|
||||
$application->add($moduleActivate);
|
||||
|
||||
$command = $application->find("module:activate");
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->execute(array(
|
||||
"command" => $command->getName(),
|
||||
"module" => "letshopethismoduledoesnotexists",
|
||||
));
|
||||
|
||||
$out = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function getKernel()
|
||||
{
|
||||
$kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
|
||||
|
||||
return $kernel;
|
||||
}
|
||||
|
||||
public function getContainer()
|
||||
{
|
||||
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
|
||||
|
||||
return $container;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf('\Thelia\Core\Template\Element\LoopResult', $methodReturn);
|
||||
}
|
||||
|
||||
public function baseTestSearchById($id)
|
||||
public function baseTestSearchById($id, $other_args = array())
|
||||
{
|
||||
$this->instance->initializeArgs(array_merge(
|
||||
$this->getMandatoryArguments(),
|
||||
@@ -140,7 +140,8 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
|
||||
"type" => "foo",
|
||||
"name" => "foo",
|
||||
"id" => $id,
|
||||
)
|
||||
),
|
||||
$other_args
|
||||
));
|
||||
|
||||
$dummy = null;
|
||||
|
||||
@@ -58,32 +58,27 @@ class DocumentTest extends BaseLoopTestor
|
||||
{
|
||||
$document = ProductDocumentQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($document->getId());
|
||||
$this->baseTestSearchById($document->getId(), array('source' => 'product'));
|
||||
}
|
||||
|
||||
public function testSearchByFolderId()
|
||||
{
|
||||
$document = FolderDocumentQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($document->getId());
|
||||
$this->baseTestSearchById($document->getId(), array('source' => 'folder'));
|
||||
}
|
||||
|
||||
public function testSearchByContentId()
|
||||
{
|
||||
$document = ContentDocumentQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($document->getId());
|
||||
$this->baseTestSearchById($document->getId(), array('source' => 'content'));
|
||||
}
|
||||
|
||||
public function testSearchByCategoryId()
|
||||
{
|
||||
$document = CategoryDocumentQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($document->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(1);
|
||||
$this->baseTestSearchById($document->getId(), array('source' => 'category'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,32 +58,27 @@ class ImageTest extends BaseLoopTestor
|
||||
{
|
||||
$image = ProductImageQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($image->getId());
|
||||
$this->baseTestSearchById($image->getId(), array('source' => 'product'));
|
||||
}
|
||||
|
||||
public function testSearchByFolderId()
|
||||
{
|
||||
$image = FolderImageQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($image->getId());
|
||||
$this->baseTestSearchById($image->getId(), array('source' => 'folder'));
|
||||
}
|
||||
|
||||
public function testSearchByContentId()
|
||||
{
|
||||
$image = ContentImageQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($image->getId());
|
||||
$this->baseTestSearchById($image->getId(), array('source' => 'content'));
|
||||
}
|
||||
|
||||
public function testSearchByCategoryId()
|
||||
{
|
||||
$image = CategoryImageQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($image->getId());
|
||||
}
|
||||
|
||||
public function testSearchLimit()
|
||||
{
|
||||
$this->baseTestSearchWithLimit(1);
|
||||
$this->baseTestSearchById($image->getId(), array('source' => 'category'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use Thelia\Model\ProductQuery;
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\Product;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -52,7 +53,7 @@ class ProductTest extends BaseLoopTestor
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$product = ProductQuery::create()->findOne();
|
||||
$product = ProductQuery::create()->orderById(Criteria::ASC)->findOne();
|
||||
|
||||
$this->baseTestSearchById($product->getId());
|
||||
}
|
||||
|
||||
60
core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
Normal file
60
core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Core\Template\Loop;
|
||||
|
||||
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||
|
||||
use Thelia\Core\Template\Loop\TaxRule;
|
||||
use Thelia\Model\TaxRuleQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class TaxRuleTest extends BaseLoopTestor
|
||||
{
|
||||
public function getTestedClassName()
|
||||
{
|
||||
return 'Thelia\Core\Template\Loop\TaxRule';
|
||||
}
|
||||
|
||||
public function getTestedInstance()
|
||||
{
|
||||
return new TaxRule($this->container);
|
||||
}
|
||||
|
||||
public function getMandatoryArguments()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function testSearchById()
|
||||
{
|
||||
$tr = TaxRuleQuery::create()->findOne();
|
||||
|
||||
$this->baseTestSearchById($tr->getId(), array('force_return' => true));
|
||||
}
|
||||
|
||||
}
|
||||
53
core/lib/Thelia/Tests/Module/BaseModuleTestor.php
Normal file
53
core/lib/Thelia/Tests/Module/BaseModuleTestor.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Module;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
abstract class BaseModuleTestor extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $instance;
|
||||
|
||||
abstract public function getTestedClassName();
|
||||
abstract public function getTestedInstance();
|
||||
|
||||
/*protected function getMethod($name)
|
||||
{
|
||||
$class = new \ReflectionClass($this->getTestedClassName());
|
||||
$method = $class->getMethod($name);
|
||||
$method->setAccessible(true);
|
||||
|
||||
return $method;
|
||||
}*/
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->instance = $this->getTestedInstance();
|
||||
}
|
||||
}
|
||||
|
||||
108
core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php
Normal file
108
core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
|
||||
|
||||
/**
|
||||
* Class BaseRewritingObject
|
||||
* @package Thelia\Tests\Rewriting
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
abstract class BaseRewritingObject extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @return mixed an instance of Product, Folder, Content or Category Model
|
||||
*/
|
||||
abstract function getObject();
|
||||
|
||||
/**
|
||||
* @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
|
||||
*/
|
||||
public function testSimpleFrenchRewrittenUrl()
|
||||
{
|
||||
$object = $this->getObject();
|
||||
$object->setVisible(1)
|
||||
->setPosition(1)
|
||||
->setLocale('fr_FR')
|
||||
->setTitle('Mon super titre en français')
|
||||
->save();
|
||||
|
||||
$this->assertRegExp('/^mon-super-titre-en-français(-[0-9]+)?\.html$/', $object->getRewrittenUrl('fr_FR'));
|
||||
|
||||
$rewrittenUrl = $object->generateRewrittenUrl('fr_FR');
|
||||
$this->assertNotNull($rewrittenUrl, "rewritten url can not be null");
|
||||
$this->assertRegExp('/^mon-super-titre-en-français(-[0-9]+)?\.html$/', $rewrittenUrl);
|
||||
//mon-super-titre-en-français-2.html
|
||||
|
||||
$object->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
|
||||
*/
|
||||
public function testSimpleEnglishRewrittenUrl()
|
||||
{
|
||||
$object = $this->getObject();
|
||||
$object->setVisible(1)
|
||||
->setPosition(1)
|
||||
->setLocale('en_US')
|
||||
->setTitle('My english super Title')
|
||||
->save();
|
||||
|
||||
$this->assertRegExp('/^my-english-super-title(-[0-9]+)?\.html$/', $object->getRewrittenUrl('en_US'));
|
||||
|
||||
$rewrittenUrl = $object->generateRewrittenUrl('en_US');
|
||||
$this->assertNotNull($rewrittenUrl, "rewritten url can not be null");
|
||||
$this->assertRegExp('/^my-english-super-title(-[0-9]+)?\.html$/', $rewrittenUrl);
|
||||
|
||||
$object->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Impossible to create an url if title is null
|
||||
*/
|
||||
public function testRewrittenWithoutTitle()
|
||||
{
|
||||
$object = $this->getObject();
|
||||
$object->setVisible(1)
|
||||
->setPosition(1)
|
||||
->setLocale('en_US')
|
||||
->setDescription('My english super Description')
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testOnNotSavedObject()
|
||||
{
|
||||
$object = $this->getObject();
|
||||
|
||||
$object->generateRewrittenUrl('fr_FR');
|
||||
}
|
||||
}
|
||||
43
core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php
Normal file
43
core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
use Thelia\Model\Category;
|
||||
|
||||
|
||||
/**
|
||||
* Class CategoryRewritingTest
|
||||
* @package Thelia\Tests\Rewriting
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CategoryRewritingTest extends BaseRewritingObject
|
||||
{
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Category
|
||||
*/
|
||||
function getObject()
|
||||
{
|
||||
return new Category();
|
||||
}
|
||||
}
|
||||
43
core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php
Normal file
43
core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
use Thelia\Model\Content;
|
||||
|
||||
|
||||
/**
|
||||
* Class ContentRewritingTest
|
||||
* @package Thelia\Tests\Rewriting
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ContentRewritingTest extends BaseRewritingObject
|
||||
{
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Content
|
||||
*/
|
||||
function getObject()
|
||||
{
|
||||
return new Content();
|
||||
}
|
||||
}
|
||||
43
core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php
Normal file
43
core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
use Thelia\Model\Folder;
|
||||
|
||||
|
||||
/**
|
||||
* Class FolderRewritingTest
|
||||
* @package Thelia\Tests\Rewriting
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderRewritingTest extends BaseRewritingObject
|
||||
{
|
||||
|
||||
/**
|
||||
* @return mixed an instance of Product, Folder, Content or Category Model
|
||||
*/
|
||||
function getObject()
|
||||
{
|
||||
return new Folder();
|
||||
}
|
||||
}
|
||||
44
core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
Normal file
44
core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Rewriting;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Model\ProductQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class ProductRewriteTest
|
||||
* @package Thelia\Tests\Rewriting
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ProductRewriteTest extends BaseRewritingObject
|
||||
{
|
||||
|
||||
/**
|
||||
* @return mixed an instance of Product, Folder, Content or Category Model
|
||||
*/
|
||||
function getObject()
|
||||
{
|
||||
return new Product();
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLoad()
|
||||
{
|
||||
$productQuery = ProductQuery::create()->findOneById(1);
|
||||
$productQuery = ProductQuery::create()->findOne();
|
||||
$countryQuery = CountryQuery::create()->findOneById(64);
|
||||
|
||||
$calculator = new Calculator();
|
||||
@@ -86,7 +86,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
$taxRuleQuery = $this->getMock('\Thelia\Model\TaxRuleQuery', array('getTaxCalculatorCollection'));
|
||||
$taxRuleQuery->expects($this->once())
|
||||
->method('getTaxCalculatorCollection')
|
||||
->with($productQuery, $countryQuery)
|
||||
->with($productQuery->getTaxRule(), $countryQuery)
|
||||
->will($this->returnValue('foo'));
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRuleQuery');
|
||||
|
||||
Reference in New Issue
Block a user