@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | - if( !class_exists( '\Symfony\Component\Routing\Router' ) ) { |
|
| 29 | - $this->markTestSkipped( 'Symfony\Component\Routing\Router is not available' ); |
|
| 28 | + if (!class_exists('\Symfony\Component\Routing\Router')) { |
|
| 29 | + $this->markTestSkipped('Symfony\Component\Routing\Router is not available'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $view = new \Aimeos\MW\View\Standard(); |
| 33 | 33 | |
| 34 | - $loc = new \Symfony\Component\Config\FileLocator( array( __DIR__ . DIRECTORY_SEPARATOR . '_testfiles' ) ); |
|
| 35 | - $loader = new \Symfony\Component\Routing\Loader\PhpFileLoader( $loc ); |
|
| 36 | - $router = new \Symfony\Component\Routing\Router( $loader, 'routing.php' ); |
|
| 34 | + $loc = new \Symfony\Component\Config\FileLocator(array(__DIR__ . DIRECTORY_SEPARATOR . '_testfiles')); |
|
| 35 | + $loader = new \Symfony\Component\Routing\Loader\PhpFileLoader($loc); |
|
| 36 | + $router = new \Symfony\Component\Routing\Router($loader, 'routing.php'); |
|
| 37 | 37 | |
| 38 | - $this->object = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $router, array( 'site' => 'unittest' ) ); |
|
| 38 | + $this->object = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $router, array('site' => 'unittest')); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -53,32 +53,32 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function testTransform() |
| 55 | 55 | { |
| 56 | - $this->assertEquals( '/unittest/lists', $this->object->transform( 'catalog_list' ) ); |
|
| 56 | + $this->assertEquals('/unittest/lists', $this->object->transform('catalog_list')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | public function testTransformSlashes() |
| 61 | 61 | { |
| 62 | - $this->assertEquals( '/unittest/lists?test=a/b', $this->object->transform( 'catalog_list', null, null, array( 'test' => 'a/b' ) ) ); |
|
| 62 | + $this->assertEquals('/unittest/lists?test=a/b', $this->object->transform('catalog_list', null, null, array('test' => 'a/b'))); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | public function testTransformArrays() |
| 67 | 67 | { |
| 68 | - $this->assertEquals( '/unittest/lists?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'catalog_list', null, null, array( 'test' => array( 'a', 'b' ) ) ) ); |
|
| 68 | + $this->assertEquals('/unittest/lists?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('catalog_list', null, null, array('test' => array('a', 'b')))); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | public function testTransformTrailing() |
| 73 | 73 | { |
| 74 | - $this->assertEquals( '/unittest/lists?trailing=a_b', $this->object->transform( 'catalog_list', null, null, array(), array( 'a', 'b' ) ) ); |
|
| 74 | + $this->assertEquals('/unittest/lists?trailing=a_b', $this->object->transform('catalog_list', null, null, array(), array('a', 'b'))); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | public function testTransformAbsolute() |
| 79 | 79 | { |
| 80 | - $options = array( 'absoluteUri' => true ); |
|
| 81 | - $result = $this->object->transform( 'catalog_list', null, null, array(), array(), $options ); |
|
| 82 | - $this->assertEquals( 'http://localhost/unittest/lists', $result ); |
|
| 80 | + $options = array('absoluteUri' => true); |
|
| 81 | + $result = $this->object->transform('catalog_list', null, null, array(), array(), $options); |
|
| 82 | + $this->assertEquals('http://localhost/unittest/lists', $result); |
|
| 83 | 83 | } |
| 84 | 84 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | $collection = new RouteCollection(); |
| 13 | 13 | |
| 14 | -$route = new Route( '/{site}/lists', array( '_controller' => 'AimeosShopBundle:Catalog:list' ) ); |
|
| 15 | -$collection->add( 'catalog_list', $route ); |
|
| 14 | +$route = new Route('/{site}/lists', array('_controller' => 'AimeosShopBundle:Catalog:list')); |
|
| 15 | +$collection->add('catalog_list', $route); |
|
| 16 | 16 | |
| 17 | 17 | return $collection; |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $includepaths = $mshop->getIncludePaths(); |
| 19 | 19 | $includepaths[] = get_include_path(); |
| 20 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
| 20 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public static function getContext( $site = 'unittest' ) |
|
| 24 | + public static function getContext($site = 'unittest') |
|
| 25 | 25 | { |
| 26 | - if( !isset( self::$context[$site] ) ) { |
|
| 27 | - self::$context[$site] = self::createContext( $site ); |
|
| 26 | + if (!isset(self::$context[$site])) { |
|
| 27 | + self::$context[$site] = self::createContext($site); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return clone self::$context[$site]; |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | private static function getAimeos() |
| 35 | 35 | { |
| 36 | - if( !isset( self::$aimeos ) ) |
|
| 36 | + if (!isset(self::$aimeos)) |
|
| 37 | 37 | { |
| 38 | 38 | require_once 'Bootstrap.php'; |
| 39 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 39 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 40 | 40 | |
| 41 | - $extdir = dirname( dirname( dirname( __DIR__ ) ) ); |
|
| 42 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
| 41 | + $extdir = dirname(dirname(dirname(__DIR__))); |
|
| 42 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | return self::$aimeos; |
@@ -52,37 +52,37 @@ discard block |
||
| 52 | 52 | * @param string $site Unique site code |
| 53 | 53 | * @return \\Aimeos\MShop\Context\Item\Iface Context object |
| 54 | 54 | */ |
| 55 | - private static function createContext( $site ) |
|
| 55 | + private static function createContext($site) |
|
| 56 | 56 | { |
| 57 | 57 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 58 | 58 | $mshop = self::getAimeos(); |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - $paths = $mshop->getConfigPaths( 'mysql' ); |
|
| 61 | + $paths = $mshop->getConfigPaths('mysql'); |
|
| 62 | 62 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 63 | 63 | |
| 64 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
| 65 | - $ctx->setConfig( $conf ); |
|
| 64 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
| 65 | + $ctx->setConfig($conf); |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 69 | - $ctx->setDatabaseManager( $dbm ); |
|
| 68 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 69 | + $ctx->setDatabaseManager($dbm); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 73 | - $ctx->setLogger( $logger ); |
|
| 72 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 73 | + $ctx->setLogger($logger); |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | $session = new \Aimeos\MW\Session\None(); |
| 77 | - $ctx->setSession( $session ); |
|
| 77 | + $ctx->setSession($session); |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 81 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 80 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 81 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 82 | 82 | |
| 83 | - $ctx->setLocale( $localeItem ); |
|
| 83 | + $ctx->setLocale($localeItem); |
|
| 84 | 84 | |
| 85 | - $ctx->setEditor( 'ai-symfony:unittest' ); |
|
| 85 | + $ctx->setEditor('ai-symfony:unittest'); |
|
| 86 | 86 | |
| 87 | 87 | return $ctx; |
| 88 | 88 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * Set error reporting to maximum |
| 10 | 10 | */ |
| 11 | 11 | error_reporting( -1 ); |
| 12 | -ini_set( 'display_errors', '1' ); |
|
| 12 | +ini_set('display_errors', '1'); |
|
| 13 | 13 | |
| 14 | 14 | date_default_timezone_set('UTC'); |
| 15 | 15 | |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | /* |
| 18 | 18 | * Set locale settings to reasonable defaults |
| 19 | 19 | */ |
| 20 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 21 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 23 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 24 | -date_default_timezone_set( 'UTC' ); |
|
| 20 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 21 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 23 | +setlocale(LC_TIME, 'POSIX'); |
|
| 24 | +date_default_timezone_set('UTC'); |
|
| 25 | 25 | |
| 26 | 26 | require_once 'TestHelper.php'; |
| 27 | 27 | TestHelper::bootstrap(); |
@@ -15,51 +15,51 @@ |
||
| 15 | 15 | |
| 16 | 16 | protected function setUp() |
| 17 | 17 | { |
| 18 | - if( !class_exists( '\Symfony\Component\HttpFoundation\Request' ) ) { |
|
| 19 | - $this->markTestSkipped( '\Symfony\Component\HttpFoundation\Request is not available' ); |
|
| 18 | + if (!class_exists('\Symfony\Component\HttpFoundation\Request')) { |
|
| 19 | + $this->markTestSkipped('\Symfony\Component\HttpFoundation\Request is not available'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $view = new \Aimeos\MW\View\Standard(); |
| 23 | - $this->mock = $this->getMock( '\Symfony\Component\HttpFoundation\Request' ); |
|
| 24 | - $this->object = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $this->mock, array() ); |
|
| 23 | + $this->mock = $this->getMock('\Symfony\Component\HttpFoundation\Request'); |
|
| 24 | + $this->object = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $this->mock, array()); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | public function testTransform() |
| 29 | 29 | { |
| 30 | - $this->assertInstanceOf( '\\Aimeos\\MW\\View\\Helper\\Request\\Symfony2', $this->object->transform() ); |
|
| 30 | + $this->assertInstanceOf('\\Aimeos\\MW\\View\\Helper\\Request\\Symfony2', $this->object->transform()); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testGetBody() |
| 35 | 35 | { |
| 36 | - $this->mock->expects( $this->once() )->method( 'getContent' ) |
|
| 37 | - ->will( $this->returnValue( 'body' ) ); |
|
| 36 | + $this->mock->expects($this->once())->method('getContent') |
|
| 37 | + ->will($this->returnValue('body')); |
|
| 38 | 38 | |
| 39 | - $this->assertEquals( 'body', $this->object->transform()->getBody() ); |
|
| 39 | + $this->assertEquals('body', $this->object->transform()->getBody()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testGetClientAddress() |
| 44 | 44 | { |
| 45 | - $this->mock->expects( $this->once() )->method( 'getClientIp' ) |
|
| 46 | - ->will( $this->returnValue( '127.0.0.1' ) ); |
|
| 45 | + $this->mock->expects($this->once())->method('getClientIp') |
|
| 46 | + ->will($this->returnValue('127.0.0.1')); |
|
| 47 | 47 | |
| 48 | - $this->assertEquals( '127.0.0.1', $this->object->transform()->getClientAddress() ); |
|
| 48 | + $this->assertEquals('127.0.0.1', $this->object->transform()->getClientAddress()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testGetTarget() |
| 53 | 53 | { |
| 54 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 55 | - ->will( $this->returnValue( 'test' ) ); |
|
| 54 | + $this->mock->expects($this->once())->method('get') |
|
| 55 | + ->will($this->returnValue('test')); |
|
| 56 | 56 | |
| 57 | - $this->assertEquals( 'test', $this->object->transform()->getTarget() ); |
|
| 57 | + $this->assertEquals('test', $this->object->transform()->getTarget()); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | public function testGetUploadedFiles() |
| 62 | 62 | { |
| 63 | - $this->assertEquals( array(), $this->object->transform()->getUploadedFiles() ); |
|
| 63 | + $this->assertEquals(array(), $this->object->transform()->getUploadedFiles()); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -95,8 +95,7 @@ |
||
| 95 | 95 | $value->getClientMimeType(), |
| 96 | 96 | $value->getError() |
| 97 | 97 | ); |
| 98 | - } |
|
| 99 | - elseif( is_array( $value ) ) |
|
| 98 | + } elseif( is_array( $value ) ) |
|
| 100 | 99 | { |
| 101 | 100 | $list[$key] = $this->createUploadedFiles( $value ); |
| 102 | 101 | } |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers |
| 34 | 34 | * @param \Symfony\Component\HttpFoundation\Request $request Symfony2 request object |
| 35 | 35 | */ |
| 36 | - public function __construct( $view, \Symfony\Component\HttpFoundation\Request $request ) |
|
| 36 | + public function __construct($view, \Symfony\Component\HttpFoundation\Request $request) |
|
| 37 | 37 | { |
| 38 | - $files = ( $request->files ?: array() ); |
|
| 39 | - parent::__construct( $view, null, null, null, $files ); |
|
| 38 | + $files = ($request->files ?: array()); |
|
| 39 | + parent::__construct($view, null, null, null, $files); |
|
| 40 | 40 | |
| 41 | 41 | $this->request = $request; |
| 42 | 42 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getTarget() |
| 73 | 73 | { |
| 74 | - return $this->request->get( '_route' ); |
|
| 74 | + return $this->request->get('_route'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | * @param \Traversable|array $files File upload data |
| 82 | 82 | * @return array Multi-dimensional list of file objects |
| 83 | 83 | */ |
| 84 | - protected function createUploadedFiles( $files ) |
|
| 84 | + protected function createUploadedFiles($files) |
|
| 85 | 85 | { |
| 86 | 86 | $list = array(); |
| 87 | 87 | |
| 88 | - foreach( $files as $key => $value ) |
|
| 88 | + foreach ($files as $key => $value) |
|
| 89 | 89 | { |
| 90 | - if( $value instanceof UploadedFile ) |
|
| 90 | + if ($value instanceof UploadedFile) |
|
| 91 | 91 | { |
| 92 | 92 | $list[$key] = new \Aimeos\MW\View\Helper\Request\File\Standard( |
| 93 | 93 | $value->getRealPath(), |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | $value->getError() |
| 98 | 98 | ); |
| 99 | 99 | } |
| 100 | - elseif( is_array( $value ) ) |
|
| 100 | + elseif (is_array($value)) |
|
| 101 | 101 | { |
| 102 | - $list[$key] = $this->createUploadedFiles( $value ); |
|
| 102 | + $list[$key] = $this->createUploadedFiles($value); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |