fix cs
This commit is contained in:
@@ -26,7 +26,6 @@ use Thelia\Action\Address;
|
||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Model\Base\CustomerQuery;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* test address eventListener
|
||||
@@ -120,7 +119,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
$actionAddress = new Address($this->getContainer());
|
||||
$actionAddress->update($addressEvent);
|
||||
|
||||
|
||||
$updatedAddress = $addressEvent->getAddress();
|
||||
$this->assertInstanceOf("Thelia\Model\Address", $updatedAddress);
|
||||
$this->assertFalse($updatedAddress->isNew());
|
||||
@@ -142,4 +140,4 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Action\Image;
|
||||
use Thelia\Core\Event\ImageEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class ImageTest
|
||||
@@ -78,7 +77,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
}
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$dir = THELIA_WEB_DIR."/cache/tests";
|
||||
if ($dh = @opendir($dir)) {
|
||||
while ($file = readdir($dh)) {
|
||||
@@ -91,7 +91,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown()
|
||||
{
|
||||
// restore cache configuration.
|
||||
$config = ConfigQuery::create()->filterByName('image_cache_dir_from_web_root')->findOne();
|
||||
|
||||
@@ -249,7 +250,6 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
$image->processImage($event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply all transformations
|
||||
*/
|
||||
@@ -343,7 +343,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
$image->processImage($event);
|
||||
}
|
||||
|
||||
public function testClearTestsCache() {
|
||||
public function testClearTestsCache()
|
||||
{
|
||||
$event = new ImageEvent($this->request);
|
||||
|
||||
$event->setCacheSubdirectory('tests');
|
||||
@@ -353,7 +354,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
$image->clearCache($event);
|
||||
}
|
||||
|
||||
public function testClearWholeCache() {
|
||||
public function testClearWholeCache()
|
||||
{
|
||||
$event = new ImageEvent($this->request);
|
||||
|
||||
$image = new Image($this->getContainer());
|
||||
@@ -366,7 +368,8 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testClearUnallowedPathCache() {
|
||||
public function testClearUnallowedPathCache()
|
||||
{
|
||||
$event = new ImageEvent($this->request);
|
||||
|
||||
$event->setCacheSubdirectory('../../../..');
|
||||
@@ -375,4 +378,4 @@ class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup
|
||||
|
||||
$image->clearCache($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,8 +97,7 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase
|
||||
"command" => $command->getName(),
|
||||
"--env" => "test"
|
||||
));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new \RuntimeException("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,6 @@ class ConstraintFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the Rules serialization module
|
||||
*/
|
||||
@@ -180,8 +179,8 @@ class ConstraintFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
|
||||
$unserializedRules = $constraintFactory->unserializeCouponRuleCollection($serializedRules);
|
||||
|
||||
$expected = (string)$rules;
|
||||
$actual = (string)$unserializedRules;
|
||||
$expected = (string) $rules;
|
||||
$actual = (string) $unserializedRules;
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
AvailableForTotalAmountManager::INPUT2 => 'EUR');
|
||||
$rule1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
|
||||
$rules = new CouponRuleCollection();
|
||||
$rules->add($rule1);
|
||||
|
||||
@@ -111,7 +110,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
AvailableForTotalAmountManager::INPUT2 => 'EUR');
|
||||
$rule1->setValidatorsFromForm($operators, $values);
|
||||
|
||||
|
||||
$rules = new CouponRuleCollection();
|
||||
$rules->add($rule1);
|
||||
|
||||
@@ -216,7 +214,6 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual, 'Constraints validator always think Customer is matching rules');
|
||||
}
|
||||
|
||||
|
||||
public function testVariableOpComparisonSuccess()
|
||||
{
|
||||
$ConstraintValidator = new ConstraintValidator();
|
||||
|
||||
@@ -151,7 +151,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
// $this->assertEquals($expected, $actual);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Check if test inferior operator is working
|
||||
*
|
||||
@@ -512,7 +511,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if test superior operator is working
|
||||
*
|
||||
@@ -585,7 +583,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check currency is checked
|
||||
*
|
||||
@@ -658,7 +655,6 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
|
||||
@@ -177,10 +177,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
// $this->assertEquals($expected, $actual);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check if test inferior operator is working
|
||||
*
|
||||
@@ -501,7 +497,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if test superior operator is working
|
||||
*
|
||||
@@ -661,7 +656,6 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
|
||||
@@ -416,8 +416,6 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
|
||||
// $this->assertFalse($actual);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Coupon;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Thelia\Constraint\Validator\CustomerParam;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\QuantityParam;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\QuantityParam;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Constraint\Validator\RepeatedDateParam;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Thelia\Constraint\Validator\RepeatedIntervalParam;
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,6 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($request->attributes->get('_view'), 'foo');
|
||||
}
|
||||
|
||||
|
||||
public function testNoActionWithAttribute()
|
||||
{
|
||||
$defaultController = new DefaultController();
|
||||
|
||||
@@ -168,7 +168,6 @@ class FormatTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test formatNumber without mandatory parameters
|
||||
*
|
||||
@@ -269,6 +268,4 @@ class FormatTest extends \PHPUnit_Framework_TestCase
|
||||
return $mock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,8 @@ namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Coupon\Type\RemoveXAmountManager;
|
||||
use Thelia\Tools\PhpUnitUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Thelia\Coupon;
|
||||
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\Type\RemoveXAmountManager;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Constraint\Validator\PriceParam;
|
||||
use Thelia\Constraint\Validator\RuleValidator;
|
||||
|
||||
@@ -120,7 +120,7 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
|
||||
$collection = new ObjectCollection();
|
||||
$collection->setModel('\Thelia\Model\RewritingArgument');
|
||||
|
||||
for($i=0; $i<3; $i++) {
|
||||
for ($i=0; $i<3; $i++) {
|
||||
$ra = new RewritingArgument();
|
||||
$ra->setParameter('foo' . $i);
|
||||
$ra->setValue('bar' . $i);
|
||||
@@ -132,7 +132,6 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
|
||||
$collection->append($ra);
|
||||
}
|
||||
|
||||
|
||||
$resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch'));
|
||||
$resolverQuery->expects($this->any())
|
||||
->method('getResolverSearch')
|
||||
|
||||
@@ -28,15 +28,15 @@ namespace Thelia\Tests;
|
||||
*
|
||||
* @package Thelia\Tests\TestCaseWithURLSetup
|
||||
*/
|
||||
class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
|
||||
public function __construct() {
|
||||
class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setupURLTool();
|
||||
}
|
||||
|
||||
protected function setupURLTool() {
|
||||
|
||||
protected function setupURLTool()
|
||||
{
|
||||
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
|
||||
|
||||
$context = new \Symfony\Component\Routing\RequestContext(
|
||||
@@ -61,4 +61,4 @@ class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
new \Thelia\Tools\URL($container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
new \Thelia\Tools\URL($container);
|
||||
}
|
||||
|
||||
public function testGetIndexPage() {
|
||||
|
||||
public function testGetIndexPage()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->getIndexPage();
|
||||
$this->assertEquals('http://localhost/thelia/index.php', $url);
|
||||
@@ -81,7 +81,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://localhost/', $url);
|
||||
}
|
||||
|
||||
public function testGetBaseUrl() {
|
||||
public function testGetBaseUrl()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->getBaseUrl();
|
||||
$this->assertEquals('http://localhost/thelia/index.php', $url);
|
||||
@@ -95,7 +96,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://localhost/', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrl() {
|
||||
public function testAbsoluteUrl()
|
||||
{
|
||||
$this->context->setBaseUrl('/');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action');
|
||||
$this->assertEquals('http://localhost/path/to/action', $url);
|
||||
@@ -113,8 +115,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://localhost/thelia/index.php/path/to/action', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlOnAbsolutePath() {
|
||||
|
||||
public function testAbsoluteUrlOnAbsolutePath()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action');
|
||||
$this->assertEquals('http://myhost/path/to/action', $url);
|
||||
@@ -128,8 +130,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://myhost/path/to/action', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlOnAbsolutePathWithParameters() {
|
||||
|
||||
public function testAbsoluteUrlOnAbsolutePathWithParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2"));
|
||||
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
|
||||
@@ -143,7 +145,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters() {
|
||||
public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2"));
|
||||
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
|
||||
@@ -157,7 +160,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlWithParameters() {
|
||||
public function testAbsoluteUrlWithParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"));
|
||||
$this->assertEquals('http://localhost/thelia/index.php/path/to/action?p1=v1&p2=v2', $url);
|
||||
@@ -179,13 +183,15 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('http://localhost/path/to/action?p1=v1&p2=v2', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlPathOnly() {
|
||||
public function testAbsoluteUrlPathOnly()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array(), URL::PATH_TO_FILE);
|
||||
$this->assertEquals('http://localhost/thelia/path/to/action', $url);
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlPathOnlyWithParameters() {
|
||||
public function testAbsoluteUrlPathOnlyWithParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
|
||||
$this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url);
|
||||
@@ -200,7 +206,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlFromIndexWithParameters() {
|
||||
public function testAbsoluteUrlFromIndexWithParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"));
|
||||
$this->assertEquals('http://localhost/thelia/index.php/?p1=v1&p2=v2', $url);
|
||||
@@ -215,7 +222,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
public function testAbsoluteUrlPathOnlyFromIndexWithParameters() {
|
||||
public function testAbsoluteUrlPathOnlyFromIndexWithParameters()
|
||||
{
|
||||
$this->context->setBaseUrl('/thelia/index.php');
|
||||
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
|
||||
$this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url);
|
||||
|
||||
Reference in New Issue
Block a user