@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
| 33 | 33 | * @param \TYPO3\Flow\Cache\Frontend\StringFrontend $cache Flow cache object |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \TYPO3\Flow\Cache\Frontend\StringFrontend $cache ) |
|
| 35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \TYPO3\Flow\Cache\Frontend\StringFrontend $cache) |
|
| 36 | 36 | { |
| 37 | 37 | $this->context = $context; |
| 38 | 38 | $this->cache = $cache; |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | protected function getObject() |
| 48 | 48 | { |
| 49 | - if( !isset( $this->object ) ) |
|
| 49 | + if (!isset($this->object)) |
|
| 50 | 50 | { |
| 51 | 51 | $siteid = $this->context->getLocale()->getSiteId(); |
| 52 | - $conf = array( 'siteid' => $this->context->getConfig()->get( 'madmin/cache/prefix' ) . $siteid ); |
|
| 53 | - $this->object = \Aimeos\MW\Cache\Factory::createManager( 'Flow', $conf, $this->cache ); |
|
| 52 | + $conf = array('siteid' => $this->context->getConfig()->get('madmin/cache/prefix').$siteid); |
|
| 53 | + $this->object = \Aimeos\MW\Cache\Factory::createManager('Flow', $conf, $this->cache); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $this->object; |
@@ -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( dirname( __FILE__ ) ) ) ); |
|
| 42 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
| 41 | + $extdir = dirname(dirname(dirname(dirname(__FILE__)))); |
|
| 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' ); |
|
| 62 | - $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
| 61 | + $paths = $mshop->getConfigPaths('mysql'); |
|
| 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-flow:unittest' ); |
|
| 85 | + $ctx->setEditor('ai-flow:unittest'); |
|
| 86 | 86 | |
| 87 | 87 | return $ctx; |
| 88 | 88 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param \TYPO3\Flow\Mvc\Routing\UriBuilder $builder Flow URI builder object |
| 32 | 32 | * @param array Associative list of fixed parameters that should be available for all routes |
| 33 | 33 | */ |
| 34 | - public function __construct( $view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed ) |
|
| 34 | + public function __construct($view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed) |
|
| 35 | 35 | { |
| 36 | - parent::__construct( $view ); |
|
| 36 | + parent::__construct($view); |
|
| 37 | 37 | |
| 38 | 38 | $this->builder = $builder; |
| 39 | 39 | $this->fixed = $fixed; |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | * @param array $config Additional configuration parameter per URL |
| 52 | 52 | * @return string Complete URL that can be used in the template |
| 53 | 53 | */ |
| 54 | - public function transform( $target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array() ) |
|
| 54 | + public function transform($target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array()) |
|
| 55 | 55 | { |
| 56 | - $params = $this->sanitize( $params ); |
|
| 57 | - $values = $this->getValues( $config ); |
|
| 56 | + $params = $this->sanitize($params); |
|
| 57 | + $values = $this->getValues($config); |
|
| 58 | 58 | |
| 59 | 59 | $this->builder |
| 60 | 60 | ->reset() |
| 61 | - ->setSection( join( '/', $trailing ) ) |
|
| 62 | - ->setCreateAbsoluteUri( $values['absoluteUri'] ) |
|
| 63 | - ->setFormat( $values['format'] ); |
|
| 61 | + ->setSection(join('/', $trailing)) |
|
| 62 | + ->setCreateAbsoluteUri($values['absoluteUri']) |
|
| 63 | + ->setFormat($values['format']); |
|
| 64 | 64 | |
| 65 | 65 | $params['node'] = $target; |
| 66 | 66 | |
| 67 | - return $this->builder->uriFor( $action, $params + $this->fixed, $controller, $values['package'], $values['subpackage'] ); |
|
| 67 | + return $this->builder->uriFor($action, $params + $this->fixed, $controller, $values['package'], $values['subpackage']); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param array $config Associative list of key/value pairs |
| 75 | 75 | * @return array Associative list of sanitized key/value pairs |
| 76 | 76 | */ |
| 77 | - protected function getValues( array $config ) |
|
| 77 | + protected function getValues(array $config) |
|
| 78 | 78 | { |
| 79 | 79 | $values = array( |
| 80 | 80 | 'package' => null, |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | 'format' => 'html', |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - if( isset( $config['package'] ) ) { |
|
| 86 | + if (isset($config['package'])) { |
|
| 87 | 87 | $values['package'] = (string) $config['package']; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if( isset( $config['subpackage'] ) ) { |
|
| 90 | + if (isset($config['subpackage'])) { |
|
| 91 | 91 | $values['subpackage'] = (string) $config['subpackage']; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if( isset( $config['absoluteUri'] ) ) { |
|
| 94 | + if (isset($config['absoluteUri'])) { |
|
| 95 | 95 | $values['absoluteUri'] = (bool) $config['absoluteUri']; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if( isset( $config['format'] ) ) { |
|
| 98 | + if (isset($config['format'])) { |
|
| 99 | 99 | $values['format'] = (string) $config['format']; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | - if( interface_exists( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' ) === false ) { |
|
| 25 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found' ); |
|
| 24 | + if (interface_exists('TYPO3\Flow\Cache\Frontend\FrontendInterface') === false) { |
|
| 25 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $this->mock = $this->getMockBuilder( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' )->getMock(); |
|
| 29 | - $this->object = new \Aimeos\MW\Cache\Flow( array(), $this->mock ); |
|
| 28 | + $this->mock = $this->getMockBuilder('TYPO3\Flow\Cache\Frontend\FrontendInterface')->getMock(); |
|
| 29 | + $this->object = new \Aimeos\MW\Cache\Flow(array(), $this->mock); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -38,190 +38,190 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | protected function tearDown() |
| 40 | 40 | { |
| 41 | - unset( $this->mock, $this->object ); |
|
| 41 | + unset($this->mock, $this->object); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testDelete() |
| 46 | 46 | { |
| 47 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 48 | - $this->object->delete( 'key' ); |
|
| 47 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('key')); |
|
| 48 | + $this->object->delete('key'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testDeleteWithSiteId() |
| 53 | 53 | { |
| 54 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 54 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 55 | 55 | |
| 56 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 57 | - $object->delete( 'key' ); |
|
| 56 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 57 | + $object->delete('key'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | public function testDeleteList() |
| 62 | 62 | { |
| 63 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 64 | - $this->object->deleteList( array( 'key', 'key' ) ); |
|
| 63 | + $this->mock->expects($this->exactly(2))->method('remove')->with($this->equalTo('key')); |
|
| 64 | + $this->object->deleteList(array('key', 'key')); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testDeleteListWithSiteId() |
| 69 | 69 | { |
| 70 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 70 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 71 | 71 | |
| 72 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 73 | - $object->deleteList( array( 'key' ) ); |
|
| 72 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 73 | + $object->deleteList(array('key')); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testDeleteByTags() |
| 78 | 78 | { |
| 79 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'flushByTag' )->with( $this->equalTo( 'tag' ) ); |
|
| 80 | - $this->object->deleteByTags( array( 'tag', 'tag' ) ); |
|
| 79 | + $this->mock->expects($this->exactly(2))->method('flushByTag')->with($this->equalTo('tag')); |
|
| 80 | + $this->object->deleteByTags(array('tag', 'tag')); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testDeleteByTagsWithSiteId() |
| 85 | 85 | { |
| 86 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 86 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 87 | 87 | |
| 88 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-tag' ) ); |
|
| 89 | - $object->deleteByTags( array( 'tag' ) ); |
|
| 88 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-tag')); |
|
| 89 | + $object->deleteByTags(array('tag')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testFlush() |
| 94 | 94 | { |
| 95 | - $this->mock->expects( $this->once() )->method( 'flush' ); |
|
| 95 | + $this->mock->expects($this->once())->method('flush'); |
|
| 96 | 96 | $this->object->flush(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public function testFlushWithSiteId() |
| 101 | 101 | { |
| 102 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 102 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 103 | 103 | |
| 104 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-siteid' ) ); |
|
| 104 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-siteid')); |
|
| 105 | 105 | $object->flush(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGet() |
| 110 | 110 | { |
| 111 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 112 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( 'value' ) ); |
|
| 111 | + $this->mock->expects($this->once())->method('get') |
|
| 112 | + ->with($this->equalTo('key'))->will($this->returnValue('value')); |
|
| 113 | 113 | |
| 114 | - $this->assertEquals( 'value', $this->object->get( 'key', 'default' ) ); |
|
| 114 | + $this->assertEquals('value', $this->object->get('key', 'default')); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testGetDefault() |
| 119 | 119 | { |
| 120 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 121 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( false ) ); |
|
| 120 | + $this->mock->expects($this->once())->method('get') |
|
| 121 | + ->with($this->equalTo('key'))->will($this->returnValue(false)); |
|
| 122 | 122 | |
| 123 | - $this->assertEquals( 'default', $this->object->get( 'key', 'default' ) ); |
|
| 123 | + $this->assertEquals('default', $this->object->get('key', 'default')); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | public function testGetWithSiteId() |
| 128 | 128 | { |
| 129 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 129 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 130 | 130 | |
| 131 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 132 | - $object->get( 'key', 'default' ); |
|
| 131 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 132 | + $object->get('key', 'default'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | public function testGetList() |
| 137 | 137 | { |
| 138 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
| 139 | - ->will( $this->returnValue( 'value' ) ); |
|
| 138 | + $this->mock->expects($this->exactly(2))->method('get') |
|
| 139 | + ->will($this->returnValue('value')); |
|
| 140 | 140 | |
| 141 | - $expected = array( 'key1' => 'value', 'key2' => 'value' ); |
|
| 142 | - $this->assertEquals( $expected, $this->object->getList( array( 'key1', 'key2' ) ) ); |
|
| 141 | + $expected = array('key1' => 'value', 'key2' => 'value'); |
|
| 142 | + $this->assertEquals($expected, $this->object->getList(array('key1', 'key2'))); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | 146 | public function testGetListWithSiteId() |
| 147 | 147 | { |
| 148 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 148 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 149 | 149 | |
| 150 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 151 | - $object->getList( array( 'key' ) ); |
|
| 150 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 151 | + $object->getList(array('key')); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | public function testGetListByTags() |
| 156 | 156 | { |
| 157 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'getByTag' ) |
|
| 158 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( array( 'key' => 'value' ) ) ); |
|
| 157 | + $this->mock->expects($this->exactly(2))->method('getByTag') |
|
| 158 | + ->with($this->equalTo('key'))->will($this->returnValue(array('key' => 'value'))); |
|
| 159 | 159 | |
| 160 | - $this->assertEquals( array( 'key' => 'value' ), $this->object->getListByTags( array( 'key', 'key' ) ) ); |
|
| 160 | + $this->assertEquals(array('key' => 'value'), $this->object->getListByTags(array('key', 'key'))); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | public function testGetListByTagsWithSiteId() |
| 165 | 165 | { |
| 166 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 166 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 167 | 167 | |
| 168 | - $this->mock->expects( $this->once() )->method( 'getByTag' ) |
|
| 169 | - ->with( $this->equalTo( '1-key' ) )->will( $this->returnValue( array( '1-key' => 'value' ) ) ); |
|
| 168 | + $this->mock->expects($this->once())->method('getByTag') |
|
| 169 | + ->with($this->equalTo('1-key'))->will($this->returnValue(array('1-key' => 'value'))); |
|
| 170 | 170 | |
| 171 | - $this->assertEquals( array( 'key' => 'value' ), $object->getListByTags( array( 'key' ) ) ); |
|
| 171 | + $this->assertEquals(array('key' => 'value'), $object->getListByTags(array('key'))); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | public function testSet() |
| 176 | 176 | { |
| 177 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 177 | + $this->mock->expects($this->once())->method('set') |
|
| 178 | 178 | ->with( |
| 179 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 180 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 179 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 180 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - $this->object->set( 'key', 'value', array( 'tag' ), '2000-01-01 00:00:00' ); |
|
| 183 | + $this->object->set('key', 'value', array('tag'), '2000-01-01 00:00:00'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | public function testSetWithSiteId() |
| 188 | 188 | { |
| 189 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 189 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 190 | 190 | |
| 191 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 191 | + $this->mock->expects($this->once())->method('set') |
|
| 192 | 192 | ->with( |
| 193 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 194 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 193 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 194 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $object->set( 'key', 'value', array( 'tag' ), null ); |
|
| 197 | + $object->set('key', 'value', array('tag'), null); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | public function testSetList() |
| 202 | 202 | { |
| 203 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 203 | + $this->mock->expects($this->once())->method('set') |
|
| 204 | 204 | ->with( |
| 205 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 206 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 205 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 206 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | - $expires = array( 'key' => '2000-01-01 00:00:00' ); |
|
| 210 | - $this->object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), $expires ); |
|
| 209 | + $expires = array('key' => '2000-01-01 00:00:00'); |
|
| 210 | + $this->object->setList(array('key' => 'value'), array('key' => array('tag')), $expires); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | public function testSetListWithSiteId() |
| 215 | 215 | { |
| 216 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 216 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 217 | 217 | |
| 218 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 218 | + $this->mock->expects($this->once())->method('set') |
|
| 219 | 219 | ->with( |
| 220 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 221 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 220 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 221 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - $object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), array() ); |
|
| 224 | + $object->setList(array('key' => 'value'), array('key' => array('tag')), array()); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | } |
@@ -26,48 +26,48 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function setUp() |
| 28 | 28 | { |
| 29 | - if( !class_exists( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder' ) ) { |
|
| 30 | - $this->markTestSkipped( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available' ); |
|
| 29 | + if (!class_exists('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder')) { |
|
| 30 | + $this->markTestSkipped('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $view = new \Aimeos\MW\View\Standard(); |
| 34 | 34 | |
| 35 | - $mockHttpRequest = $this->getMockBuilder( 'TYPO3\Flow\Http\Request' ) |
|
| 36 | - ->setMethods( array( 'getBaseUri' ) ) |
|
| 35 | + $mockHttpRequest = $this->getMockBuilder('TYPO3\Flow\Http\Request') |
|
| 36 | + ->setMethods(array('getBaseUri')) |
|
| 37 | 37 | ->disableOriginalConstructor() |
| 38 | 38 | ->getMock(); |
| 39 | - $mockHttpRequest->expects( $this->any() ) |
|
| 40 | - ->method( 'getBaseUri' ) |
|
| 41 | - ->will( $this->returnValue( 'http://localhost/' ) ); |
|
| 39 | + $mockHttpRequest->expects($this->any()) |
|
| 40 | + ->method('getBaseUri') |
|
| 41 | + ->will($this->returnValue('http://localhost/')); |
|
| 42 | 42 | |
| 43 | - $mockMainRequest = $this->getMockBuilder( 'TYPO3\Flow\Mvc\ActionRequest' ) |
|
| 44 | - ->setMethods( array( 'getControllerObjectName', 'getArgumentNamespace' ) ) |
|
| 45 | - ->setConstructorArgs( array( $mockHttpRequest ) ) |
|
| 43 | + $mockMainRequest = $this->getMockBuilder('TYPO3\Flow\Mvc\ActionRequest') |
|
| 44 | + ->setMethods(array('getControllerObjectName', 'getArgumentNamespace')) |
|
| 45 | + ->setConstructorArgs(array($mockHttpRequest)) |
|
| 46 | 46 | ->getMock(); |
| 47 | - $mockMainRequest->expects( $this->any() ) |
|
| 48 | - ->method( 'getArgumentNamespace' ) |
|
| 49 | - ->will( $this->returnValue( 'ai' ) ); |
|
| 47 | + $mockMainRequest->expects($this->any()) |
|
| 48 | + ->method('getArgumentNamespace') |
|
| 49 | + ->will($this->returnValue('ai')); |
|
| 50 | 50 | |
| 51 | - $this->mockRouter = $this->getMockBuilder( 'TYPO3\Flow\Mvc\Routing\Router' )->getMock(); |
|
| 52 | - $mockEnv = $this->getMockBuilder( 'TYPO3\Flow\Utility\Environment' ) |
|
| 53 | - ->setMethods( array( 'isRewriteEnabled' ) ) |
|
| 51 | + $this->mockRouter = $this->getMockBuilder('TYPO3\Flow\Mvc\Routing\Router')->getMock(); |
|
| 52 | + $mockEnv = $this->getMockBuilder('TYPO3\Flow\Utility\Environment') |
|
| 53 | + ->setMethods(array('isRewriteEnabled')) |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | 55 | ->getMock(); |
| 56 | 56 | |
| 57 | 57 | $builder = new \TYPO3\Flow\Mvc\Routing\UriBuilder(); |
| 58 | - $builder->setRequest( $mockMainRequest ); |
|
| 58 | + $builder->setRequest($mockMainRequest); |
|
| 59 | 59 | |
| 60 | - $objectReflection = new \ReflectionObject( $builder ); |
|
| 60 | + $objectReflection = new \ReflectionObject($builder); |
|
| 61 | 61 | |
| 62 | - $property = $objectReflection->getProperty( 'router' ); |
|
| 63 | - $property->setAccessible( true ); |
|
| 64 | - $property->setValue( $builder, $this->mockRouter ); |
|
| 62 | + $property = $objectReflection->getProperty('router'); |
|
| 63 | + $property->setAccessible(true); |
|
| 64 | + $property->setValue($builder, $this->mockRouter); |
|
| 65 | 65 | |
| 66 | - $property = $objectReflection->getProperty( 'environment' ); |
|
| 67 | - $property->setAccessible( true ); |
|
| 68 | - $property->setValue( $builder, $mockEnv ); |
|
| 66 | + $property = $objectReflection->getProperty('environment'); |
|
| 67 | + $property->setAccessible(true); |
|
| 68 | + $property->setValue($builder, $mockEnv); |
|
| 69 | 69 | |
| 70 | - $this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) ); |
|
| 70 | + $this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -85,60 +85,60 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function testTransform() |
| 87 | 87 | { |
| 88 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 89 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 88 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 89 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 90 | 90 | |
| 91 | - $this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
|
| 91 | + $this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists')); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | public function testTransformSlashes() |
| 96 | 96 | { |
| 97 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 98 | - ->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') ); |
|
| 97 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 98 | + ->will($this->returnValue('shop/catalog/lists?test=a%2Fb')); |
|
| 99 | 99 | |
| 100 | - $this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
|
| 100 | + $this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b'))); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | public function testTransformArrays() |
| 105 | 105 | { |
| 106 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 107 | - ->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
|
| 106 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 107 | + ->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b')); |
|
| 108 | 108 | |
| 109 | - $this->assertEquals( '/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => array( 'a', 'b' ) ) ) ); |
|
| 109 | + $this->assertEquals('/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('shop', 'catalog', 'lists', array('test' => array('a', 'b')))); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | public function testTransformTrailing() |
| 114 | 114 | { |
| 115 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 116 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 115 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 116 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 117 | 117 | |
| 118 | - $this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', array(), array( 'a', 'b' ) ) ); |
|
| 118 | + $this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', array(), array('a', 'b'))); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testTransformAbsolute() |
| 123 | 123 | { |
| 124 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 125 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 124 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 125 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 126 | 126 | |
| 127 | - $options = array( 'absoluteUri' => true ); |
|
| 128 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
| 127 | + $options = array('absoluteUri' => true); |
|
| 128 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
| 129 | 129 | |
| 130 | - $this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result ); |
|
| 130 | + $this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | public function testTransformConfig() |
| 135 | 135 | { |
| 136 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 137 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 136 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 137 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 138 | 138 | |
| 139 | - $options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' ); |
|
| 140 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
| 139 | + $options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt'); |
|
| 140 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
| 141 | 141 | |
| 142 | - $this->assertEquals( '/index.php/shop/catalog/lists', $result ); |
|
| 142 | + $this->assertEquals('/index.php/shop/catalog/lists', $result); |
|
| 143 | 143 | } |
| 144 | 144 | } |