Completed
Push — master ( 561bff...9e9170 )
by Aimeos
08:46
created
lib/custom/src/MW/View/Helper/Response/Flow.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
28 28
 	 */
29
-	public function __construct( \Aimeos\MW\View\Iface $view )
29
+	public function __construct(\Aimeos\MW\View\Iface $view)
30 30
 	{
31
-		parent::__construct( $view, new \Zend\Diactoros\Response() );
31
+		parent::__construct($view, new \Zend\Diactoros\Response());
32 32
 	}
33 33
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Url/FlowTest.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,43 +26,43 @@  discard block
 block discarded – undo
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' )
35
+		$mockHttpRequest = $this->getMockBuilder('TYPO3\Flow\Http\Request')
36 36
 			->disableOriginalConstructor()
37
-			->setMethods( array( 'getBaseUri' ) )
37
+			->setMethods(array('getBaseUri'))
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->getMock( 'TYPO3\Flow\Mvc\ActionRequest',
44
-			array( 'getControllerObjectName', 'getArgumentNamespace' ), array( $mockHttpRequest ) );
45
-		$mockMainRequest->expects( $this->any() )
46
-			->method( 'getArgumentNamespace' )
47
-			->will( $this->returnValue( 'ai' ) );
43
+		$mockMainRequest = $this->getMock('TYPO3\Flow\Mvc\ActionRequest',
44
+			array('getControllerObjectName', 'getArgumentNamespace'), array($mockHttpRequest));
45
+		$mockMainRequest->expects($this->any())
46
+			->method('getArgumentNamespace')
47
+			->will($this->returnValue('ai'));
48 48
 
49
-		$this->mockRouter = $this->getMock( 'TYPO3\Flow\Mvc\Routing\Router' );
50
-		$mockEnv = $this->getMock( 'TYPO3\Flow\Utility\Environment', array( 'isRewriteEnabled' ), array(), '', false );
49
+		$this->mockRouter = $this->getMock('TYPO3\Flow\Mvc\Routing\Router');
50
+		$mockEnv = $this->getMock('TYPO3\Flow\Utility\Environment', array('isRewriteEnabled'), array(), '', false);
51 51
 
52 52
 		$builder = new \TYPO3\Flow\Mvc\Routing\UriBuilder();
53
-		$builder->setRequest( $mockMainRequest );
53
+		$builder->setRequest($mockMainRequest);
54 54
 
55
-		$objectReflection = new \ReflectionObject( $builder );
55
+		$objectReflection = new \ReflectionObject($builder);
56 56
 
57
-		$property = $objectReflection->getProperty( 'router' );
58
-		$property->setAccessible( true );
59
-		$property->setValue( $builder, $this->mockRouter );
57
+		$property = $objectReflection->getProperty('router');
58
+		$property->setAccessible(true);
59
+		$property->setValue($builder, $this->mockRouter);
60 60
 
61
-		$property = $objectReflection->getProperty( 'environment' );
62
-		$property->setAccessible( true );
63
-		$property->setValue( $builder, $mockEnv );
61
+		$property = $objectReflection->getProperty('environment');
62
+		$property->setAccessible(true);
63
+		$property->setValue($builder, $mockEnv);
64 64
 
65
-		$this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) );
65
+		$this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest'));
66 66
 	}
67 67
 
68 68
 
@@ -80,60 +80,60 @@  discard block
 block discarded – undo
80 80
 
81 81
 	public function testTransform()
82 82
 	{
83
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
84
-			->will( $this->returnValue( 'shop/catalog/lists') );
83
+		$this->mockRouter->expects($this->once())->method('resolve')
84
+			->will($this->returnValue('shop/catalog/lists'));
85 85
 
86
-		$this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) );
86
+		$this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists'));
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testTransformSlashes()
91 91
 	{
92
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
93
-			->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') );
92
+		$this->mockRouter->expects($this->once())->method('resolve')
93
+			->will($this->returnValue('shop/catalog/lists?test=a%2Fb'));
94 94
 
95
-		$this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) );
95
+		$this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b')));
96 96
 	}
97 97
 
98 98
 
99 99
 	public function testTransformArrays()
100 100
 	{
101
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
102
-			->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') );
101
+		$this->mockRouter->expects($this->once())->method('resolve')
102
+			->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b'));
103 103
 
104
-		$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' ) ) ) );
104
+		$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'))));
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testTransformTrailing()
109 109
 	{
110
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
111
-			->will( $this->returnValue( 'shop/catalog/lists') );
110
+		$this->mockRouter->expects($this->once())->method('resolve')
111
+			->will($this->returnValue('shop/catalog/lists'));
112 112
 
113
-		$this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', array(), array( 'a', 'b' ) ) );
113
+		$this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', array(), array('a', 'b')));
114 114
 	}
115 115
 
116 116
 
117 117
 	public function testTransformAbsolute()
118 118
 	{
119
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
120
-			->will( $this->returnValue( 'shop/catalog/lists') );
119
+		$this->mockRouter->expects($this->once())->method('resolve')
120
+			->will($this->returnValue('shop/catalog/lists'));
121 121
 
122
-		$options = array( 'absoluteUri' => true );
123
-		$result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options );
122
+		$options = array('absoluteUri' => true);
123
+		$result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options);
124 124
 
125
-		$this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result );
125
+		$this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result);
126 126
 	}
127 127
 
128 128
 
129 129
 	public function testTransformConfig()
130 130
 	{
131
-		$this->mockRouter->expects( $this->once() )->method( 'resolve' )
132
-			->will( $this->returnValue( 'shop/catalog/lists') );
131
+		$this->mockRouter->expects($this->once())->method('resolve')
132
+			->will($this->returnValue('shop/catalog/lists'));
133 133
 
134
-		$options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' );
135
-		$result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options );
134
+		$options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt');
135
+		$result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options);
136 136
 
137
-		$this->assertEquals( '/index.php/shop/catalog/lists', $result );
137
+		$this->assertEquals('/index.php/shop/catalog/lists', $result);
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
lib/custom/src/MW/Cache/Flow.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 * @param array $config List of configuration values
32 32
 	 * @param \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache TYPO3 cache object
33 33
 	 */
34
-	public function __construct( array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache )
34
+	public function __construct(array $config, \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache)
35 35
 	{
36
-		$this->prefix = ( isset( $config['siteid'] ) ? $config['siteid'] . '-' : '' );
36
+		$this->prefix = (isset($config['siteid']) ? $config['siteid'].'-' : '');
37 37
 		$this->object = $cache;
38 38
 	}
39 39
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param string $key Key string that identifies the single cache entry
47 47
 	 */
48
-	public function delete( $key )
48
+	public function delete($key)
49 49
 	{
50
-		$this->object->remove( $this->prefix . $key );
50
+		$this->object->remove($this->prefix.$key);
51 51
 	}
52 52
 
53 53
 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * @param string[] $keys List of key strings that identify the cache entries
60 60
 	 * 	that should be removed
61 61
 	 */
62
-	public function deleteList( array $keys )
62
+	public function deleteList(array $keys)
63 63
 	{
64
-		foreach( $keys as $key ) {
65
-			$this->object->remove( $this->prefix . $key );
64
+		foreach ($keys as $key) {
65
+			$this->object->remove($this->prefix.$key);
66 66
 		}
67 67
 	}
68 68
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @param string[] $tags List of tag strings that are associated to one or more
76 76
 	 * 	cache entries that should be removed
77 77
 	 */
78
-	public function deleteByTags( array $tags )
78
+	public function deleteByTags(array $tags)
79 79
 	{
80
-		foreach( $tags as $tag ) {
81
-			$this->object->flushByTag( $this->prefix . $tag );
80
+		foreach ($tags as $tag) {
81
+			$this->object->flushByTag($this->prefix.$tag);
82 82
 		}
83 83
 	}
84 84
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function flush()
92 92
 	{
93
-		if( $this->prefix ) {
94
-			$this->object->flushByTag( $this->prefix . 'siteid' );
93
+		if ($this->prefix) {
94
+			$this->object->flushByTag($this->prefix.'siteid');
95 95
 		} else {
96 96
 			$this->object->flush();
97 97
 		}
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	 * @param string $default Value returned if requested key isn't found
108 108
 	 * @return mixed Value associated to the requested key
109 109
 	 */
110
-	public function get( $name, $default = null )
110
+	public function get($name, $default = null)
111 111
 	{
112
-		if( ( $entry = $this->object->get( $this->prefix . $name ) ) !== false ) {
112
+		if (($entry = $this->object->get($this->prefix.$name)) !== false) {
113 113
 			return $entry;
114 114
 		}
115 115
 
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 * 	entries. If a cache entry doesn't exist, neither its key nor a value
128 128
 	 * 	will be in the result list
129 129
 	 */
130
-	public function getList( array $keys )
130
+	public function getList(array $keys)
131 131
 	{
132 132
 		$result = array();
133 133
 
134
-		foreach( $keys as $key )
134
+		foreach ($keys as $key)
135 135
 		{
136
-			if( ( $entry = $this->object->get( $this->prefix . $key ) ) !== false ) {
136
+			if (($entry = $this->object->get($this->prefix.$key)) !== false) {
137 137
 				$result[$key] = $entry;
138 138
 			}
139 139
 		}
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 	 * 	entries. If a tag isn't associated to any cache entry, nothing is returned
153 153
 	 * 	for that tag
154 154
 	 */
155
-	public function getListByTags( array $tags )
155
+	public function getListByTags(array $tags)
156 156
 	{
157 157
 		$result = array();
158
-		$len = strlen( $this->prefix );
158
+		$len = strlen($this->prefix);
159 159
 
160
-		foreach( $tags as $tag )
160
+		foreach ($tags as $tag)
161 161
 		{
162
-			foreach( $this->object->getByTag( $this->prefix . $tag ) as $key => $value )
162
+			foreach ($this->object->getByTag($this->prefix.$tag) as $key => $value)
163 163
 			{
164
-				if( strncmp( $key, $this->prefix, $len ) === 0 ) {
165
-					$result[ substr( $key, $len ) ] = $value;
164
+				if (strncmp($key, $this->prefix, $len) === 0) {
165
+					$result[substr($key, $len)] = $value;
166 166
 				} else {
167 167
 					$result[$key] = $value;
168 168
 				}
@@ -186,21 +186,21 @@  discard block
 block discarded – undo
186 186
 	 * @param string|null $expires Date/time string in "YYYY-MM-DD HH:mm:ss"
187 187
 	 * 	format when the cache entry expires
188 188
 	 */
189
-	public function set( $name, $value, array $tags = array(), $expires = null )
189
+	public function set($name, $value, array $tags = array(), $expires = null)
190 190
 	{
191
-		if( $expires !== null && ( $timestamp = strtotime( $expires ) ) !== false ) {
191
+		if ($expires !== null && ($timestamp = strtotime($expires)) !== false) {
192 192
 			$expires = $timestamp;
193 193
 		} else {
194 194
 			$expires = null;
195 195
 		}
196 196
 
197
-		$tagList = ( $this->prefix ? array( $this->prefix . 'siteid' ) : array() );
197
+		$tagList = ($this->prefix ? array($this->prefix.'siteid') : array());
198 198
 
199
-		foreach( $tags as $tag ) {
200
-			$tagList[] = $this->prefix . $tag;
199
+		foreach ($tags as $tag) {
200
+			$tagList[] = $this->prefix.$tag;
201 201
 		}
202 202
 
203
-		$this->object->set( $this->prefix . $name, $value, $tagList, $expires );
203
+		$this->object->set($this->prefix.$name, $value, $tagList, $expires);
204 204
 	}
205 205
 
206 206
 
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
 	 * 	to the key can either be a tag string or an array of tag strings
218 218
 	 * @param array $expires Associative list of key/datetime pairs.
219 219
 	 */
220
-	public function setList( array $pairs, array $tags = array(), array $expires = array() )
220
+	public function setList(array $pairs, array $tags = array(), array $expires = array())
221 221
 	{
222
-		foreach( $pairs as $key => $value )
222
+		foreach ($pairs as $key => $value)
223 223
 		{
224
-			$tagList = ( isset( $tags[$key] ) ? (array) $tags[$key] : array() );
225
-			$keyExpire = ( isset( $expires[$key] ) ? $expires[$key] : null );
224
+			$tagList = (isset($tags[$key]) ? (array) $tags[$key] : array());
225
+			$keyExpire = (isset($expires[$key]) ? $expires[$key] : null);
226 226
 
227
-			$this->set( $key, $value, $tagList, $keyExpire );
227
+			$this->set($key, $value, $tagList, $keyExpire);
228 228
 		}
229 229
 	}
230 230
 }
Please login to merge, or discard this patch.
lib/custom/src/MAdmin/Cache/Proxy/Flow.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
lib/custom/tests/TestHelper.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.