Completed
Push — master ( 858caa...00feaa )
by Aimeos
07:24
created
lib/custom/src/MW/Cache/Flow.php 1 patch
Spacing   +35 added lines, -35 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 \Neos\Cache\Frontend\FrontendInterface $cache Neos cache object
33 33
 	 */
34
-	public function __construct( array $config, \Neos\Cache\Frontend\FrontendInterface $cache )
34
+	public function __construct(array $config, \Neos\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 \Traversable|array $keys List of key strings that identify the cache entries
60 60
 	 * 	that should be removed
61 61
 	 */
62
-	public function deleteMultiple( $keys )
62
+	public function deleteMultiple($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 clear()
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
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 * 	will be in the result list
130 130
 	 * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond
131 131
 	 */
132
-	public function getMultiple( $keys, $default = null )
132
+	public function getMultiple($keys, $default = null)
133 133
 	{
134 134
 		$result = [];
135 135
 
136
-		foreach( $keys as $key )
136
+		foreach ($keys as $key)
137 137
 		{
138
-			if( ( $entry = $this->object->get( $this->prefix . $key ) ) !== false ) {
138
+			if (($entry = $this->object->get($this->prefix.$key)) !== false) {
139 139
 				$result[$key] = $entry;
140 140
 			} else {
141 141
 				$result[$key] = $default;
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 	 * 	entries. If a tag isn't associated to any cache entry, nothing is returned
157 157
 	 * 	for that tag
158 158
 	 */
159
-	public function getMultipleByTags( array $tags )
159
+	public function getMultipleByTags(array $tags)
160 160
 	{
161 161
 		$result = [];
162
-		$len = strlen( $this->prefix );
162
+		$len = strlen($this->prefix);
163 163
 
164
-		foreach( $tags as $tag )
164
+		foreach ($tags as $tag)
165 165
 		{
166
-			foreach( $this->object->getByTag( $this->prefix . $tag ) as $key => $value )
166
+			foreach ($this->object->getByTag($this->prefix.$tag) as $key => $value)
167 167
 			{
168
-				if( strncmp( $key, $this->prefix, $len ) === 0 ) {
169
-					$result[ substr( $key, $len ) ] = $value;
168
+				if (strncmp($key, $this->prefix, $len) === 0) {
169
+					$result[substr($key, $len)] = $value;
170 170
 				} else {
171 171
 					$result[$key] = $value;
172 172
 				}
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
 	 * @param array $tags List of tag strings that should be assoicated to the
191 191
 	 * 	given value in the cache
192 192
 	 */
193
-	public function set( $key, $value, $expires = null, array $tags = [] )
193
+	public function set($key, $value, $expires = null, array $tags = [])
194 194
 	{
195
-		if( is_string( $expires ) ) {
196
-			$expires = date_create( $expires )->getTimestamp() - time();
195
+		if (is_string($expires)) {
196
+			$expires = date_create($expires)->getTimestamp() - time();
197 197
 		}
198 198
 
199
-		$tagList = ( $this->prefix ? array( $this->prefix . 'siteid' ) : [] );
199
+		$tagList = ($this->prefix ? array($this->prefix.'siteid') : []);
200 200
 
201
-		foreach( $tags as $tag ) {
202
-			$tagList[] = $this->prefix . $tag;
201
+		foreach ($tags as $tag) {
202
+			$tagList[] = $this->prefix.$tag;
203 203
 		}
204 204
 
205
-		$this->object->set( $this->prefix . $key, $value, $tagList, $expires );
205
+		$this->object->set($this->prefix.$key, $value, $tagList, $expires);
206 206
 	}
207 207
 
208 208
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
 	 * @return null
223 223
 	 * @throws \Aimeos\MW\Cache\Exception If the cache server doesn't respond
224 224
 	 */
225
-	public function setMultiple( $pairs, $expires = null, array $tags = [] )
225
+	public function setMultiple($pairs, $expires = null, array $tags = [])
226 226
 	{
227
-		foreach( $pairs as $key => $value )
227
+		foreach ($pairs as $key => $value)
228 228
 		{
229
-			$tagList = ( isset( $tags[$key] ) ? (array) $tags[$key] : [] );
230
-			$keyExpire = ( isset( $expires[$key] ) ? $expires[$key] : $expires );
229
+			$tagList = (isset($tags[$key]) ? (array) $tags[$key] : []);
230
+			$keyExpire = (isset($expires[$key]) ? $expires[$key] : $expires);
231 231
 
232
-			$this->set( $key, $value, $keyExpire, $tagList );
232
+			$this->set($key, $value, $keyExpire, $tagList);
233 233
 		}
234 234
 	}
235 235
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Url/FlowTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		if( !class_exists( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder' ) ) {
21
-			$this->markTestSkipped( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder is not available' );
20
+		if (!class_exists('\\Neos\\Flow\\Mvc\\Routing\\UriBuilder')) {
21
+			$this->markTestSkipped('\\Neos\\Flow\\Mvc\\Routing\\UriBuilder is not available');
22 22
 		}
23 23
 
24 24
 		$view = new \Aimeos\MW\View\Standard();
25 25
 
26
-		$this->buildMock = $this->getMockbuilder( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder' )
27
-			->setMethods( array( 'uriFor' ) )
26
+		$this->buildMock = $this->getMockbuilder('\\Neos\\Flow\\Mvc\\Routing\\UriBuilder')
27
+			->setMethods(array('uriFor'))
28 28
 			->disableOriginalConstructor()
29 29
 			->getMock();
30 30
 
31
-		$this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $this->buildMock, array( 'site' => 'unittest' ) );
31
+		$this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $this->buildMock, array('site' => 'unittest'));
32 32
 	}
33 33
 
34 34
 
@@ -40,60 +40,60 @@  discard block
 block discarded – undo
40 40
 
41 41
 	public function testTransform()
42 42
 	{
43
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
44
-			->will( $this->returnValue( '/shop/catalog/lists') );
43
+		$this->buildMock->expects($this->once())->method('uriFor')
44
+			->will($this->returnValue('/shop/catalog/lists'));
45 45
 
46
-		$this->assertEquals( '/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) );
46
+		$this->assertEquals('/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists'));
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testTransformSlashes()
51 51
 	{
52
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
53
-			->will( $this->returnValue( '/shop/catalog/lists?test=a%2Fb') );
52
+		$this->buildMock->expects($this->once())->method('uriFor')
53
+			->will($this->returnValue('/shop/catalog/lists?test=a%2Fb'));
54 54
 
55
-		$this->assertEquals( '/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) );
55
+		$this->assertEquals('/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b')));
56 56
 	}
57 57
 
58 58
 
59 59
 	public function testTransformArrays()
60 60
 	{
61
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
62
-			->will( $this->returnValue( '/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') );
61
+		$this->buildMock->expects($this->once())->method('uriFor')
62
+			->will($this->returnValue('/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b'));
63 63
 
64
-		$this->assertEquals( '/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => array( 'a', 'b' ) ) ) );
64
+		$this->assertEquals('/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('shop', 'catalog', 'lists', array('test' => array('a', 'b'))));
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testTransformTrailing()
69 69
 	{
70
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
71
-			->will( $this->returnValue( '/shop/catalog/lists#a/b') );
70
+		$this->buildMock->expects($this->once())->method('uriFor')
71
+			->will($this->returnValue('/shop/catalog/lists#a/b'));
72 72
 
73
-		$this->assertEquals( '/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', [], array( 'a', 'b' ) ) );
73
+		$this->assertEquals('/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', [], array('a', 'b')));
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testTransformAbsolute()
78 78
 	{
79
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
80
-			->will( $this->returnValue( 'http://localhost/shop/catalog/lists') );
79
+		$this->buildMock->expects($this->once())->method('uriFor')
80
+			->will($this->returnValue('http://localhost/shop/catalog/lists'));
81 81
 
82
-		$options = array( 'absoluteUri' => true );
83
-		$result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options );
82
+		$options = array('absoluteUri' => true);
83
+		$result = $this->object->transform('shop', 'catalog', 'lists', [], [], $options);
84 84
 
85
-		$this->assertEquals( 'http://localhost/shop/catalog/lists', $result );
85
+		$this->assertEquals('http://localhost/shop/catalog/lists', $result);
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testTransformConfig()
90 90
 	{
91
-		$this->buildMock->expects( $this->once() )->method( 'uriFor' )
92
-			->will( $this->returnValue( '/shop/catalog/lists') );
91
+		$this->buildMock->expects($this->once())->method('uriFor')
92
+			->will($this->returnValue('/shop/catalog/lists'));
93 93
 
94
-		$options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' );
95
-		$result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options );
94
+		$options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt');
95
+		$result = $this->object->transform('shop', 'catalog', 'lists', [], [], $options);
96 96
 
97
-		$this->assertEquals( '/shop/catalog/lists', $result );
97
+		$this->assertEquals('/shop/catalog/lists', $result);
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Engine/FlowTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,32 +16,32 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->mock = $this->getMockBuilder( \Neos\FluidAdaptor\View\StandaloneView::class )
20
-			->setMethods( array( 'assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename' ) )
19
+		$this->mock = $this->getMockBuilder(\Neos\FluidAdaptor\View\StandaloneView::class)
20
+			->setMethods(array('assign', 'assignMultiple', 'render', 'setTemplatePathAndFilename'))
21 21
 			->disableOriginalConstructor()
22 22
 			->getMock();
23 23
 
24
-		$this->object = new \Aimeos\MW\View\Engine\Flow( $this->mock );
24
+		$this->object = new \Aimeos\MW\View\Engine\Flow($this->mock);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object, $this->mock );
30
+		unset($this->object, $this->mock);
31 31
 	}
32 32
 
33 33
 
34 34
 	public function testRender()
35 35
 	{
36
-		$v = new \Aimeos\MW\View\Standard( [] );
36
+		$v = new \Aimeos\MW\View\Standard([]);
37 37
 
38
-		$this->mock->expects( $this->once() )->method( 'setTemplatePathAndFilename' );
39
-		$this->mock->expects( $this->once() )->method( 'assignMultiple' );
40
-		$this->mock->expects( $this->once() )->method( 'assign' );
41
-		$this->mock->expects( $this->once() )->method( 'render' )
42
-			->will( $this->returnValue( 'test' ) );
38
+		$this->mock->expects($this->once())->method('setTemplatePathAndFilename');
39
+		$this->mock->expects($this->once())->method('assignMultiple');
40
+		$this->mock->expects($this->once())->method('assign');
41
+		$this->mock->expects($this->once())->method('render')
42
+			->will($this->returnValue('test'));
43 43
 
44
-		$result = $this->object->render( $v, 'filepath', array( 'key' => 'value' ) );
45
-		$this->assertEquals( 'test', $result );
44
+		$result = $this->object->render($v, 'filepath', array('key' => 'value'));
45
+		$this->assertEquals('test', $result);
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Request/FlowTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@
 block discarded – undo
14 14
 
15 15
 	protected function setUp()
16 16
 	{
17
-		if( !class_exists( '\Neos\Flow\Http\Request' ) ) {
18
-			$this->markTestSkipped( '\Neos\Flow\Http\Request is not available' );
17
+		if (!class_exists('\Neos\Flow\Http\Request')) {
18
+			$this->markTestSkipped('\Neos\Flow\Http\Request is not available');
19 19
 		}
20 20
 
21
-		if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) {
22
-			$this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' );
21
+		if (!class_exists('\Zend\Diactoros\ServerRequestFactory')) {
22
+			$this->markTestSkipped('\Zend\Diactoros\ServerRequestFactory is not available');
23 23
 		}
24 24
 
25 25
 		$view = new \Aimeos\MW\View\Standard();
26
-		$server = array( 'REMOTE_ADDR' => '127.0.0.1' );
27
-		$request = new \Neos\Flow\Http\Request( [], [], [], $server );
28
-		$this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $request, [], [], [], [], $server );
26
+		$server = array('REMOTE_ADDR' => '127.0.0.1');
27
+		$request = new \Neos\Flow\Http\Request([], [], [], $server);
28
+		$this->object = new \Aimeos\MW\View\Helper\Request\Flow($view, $request, [], [], [], [], $server);
29 29
 	}
30 30
 
31 31
 
32 32
 	protected function tearDown()
33 33
 	{
34
-		unset( $this->object, $this->mock );
34
+		unset($this->object, $this->mock);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testTransform()
39 39
 	{
40
-		$this->assertInstanceOf( \Aimeos\MW\View\Helper\Request\Flow::class, $this->object->transform() );
40
+		$this->assertInstanceOf(\Aimeos\MW\View\Helper\Request\Flow::class, $this->object->transform());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetClientAddress()
45 45
 	{
46
-		$this->assertEquals( '127.0.0.1', $this->object->getClientAddress() );
46
+		$this->assertEquals('127.0.0.1', $this->object->getClientAddress());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testGetTarget()
51 51
 	{
52
-		$this->assertEquals( null, $this->object->getTarget() );
52
+		$this->assertEquals(null, $this->object->getTarget());
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
lib/custom/tests/MW/View/Helper/Response/FlowTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		if( !class_exists( '\Zend\Diactoros\Response' ) ) {
20
-			$this->markTestSkipped( '\Zend\Diactoros\Response is not available' );
19
+		if (!class_exists('\Zend\Diactoros\Response')) {
20
+			$this->markTestSkipped('\Zend\Diactoros\Response is not available');
21 21
 		}
22 22
 
23 23
 		$view = new \Aimeos\MW\View\Standard();
24
-		$this->object = new \Aimeos\MW\View\Helper\Response\Flow( $view );
24
+		$this->object = new \Aimeos\MW\View\Helper\Response\Flow($view);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object );
30
+		unset($this->object);
31 31
 	}
32 32
 
33 33
 
34 34
 	public function testTransform()
35 35
 	{
36
-		$this->assertInstanceOf( \Aimeos\MW\View\Helper\Response\Flow::class, $this->object->transform() );
36
+		$this->assertInstanceOf(\Aimeos\MW\View\Helper\Response\Flow::class, $this->object->transform());
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
lib/custom/tests/MAdmin/Cache/Proxy/FlowTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,38 +17,38 @@
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		if( class_exists( 'Neos\Cache\Frontend\StringFrontend' ) === false ) {
21
-			$this->markTestSkipped( 'Class \\Neos\\Cache\\Frontend\\StringFrontend not found' );
20
+		if (class_exists('Neos\Cache\Frontend\StringFrontend') === false) {
21
+			$this->markTestSkipped('Class \\Neos\\Cache\\Frontend\\StringFrontend not found');
22 22
 		}
23 23
 
24
-		$localeItem = $this->getMockBuilder( \Aimeos\MShop\Locale\Item\Standard::class )
25
-			->setMethods( ['getSiteId'])
24
+		$localeItem = $this->getMockBuilder(\Aimeos\MShop\Locale\Item\Standard::class)
25
+			->setMethods(['getSiteId'])
26 26
 			->getMock();
27 27
 
28
-		$this->mock = $this->getMockBuilder( 'Neos\Cache\Frontend\StringFrontend' )
28
+		$this->mock = $this->getMockBuilder('Neos\Cache\Frontend\StringFrontend')
29 29
 			->disableOriginalConstructor()
30 30
 			->getMock();
31 31
 
32 32
 		$context = \TestHelper::getContext();
33
-		$context->setLocale( $localeItem );
33
+		$context->setLocale($localeItem);
34 34
 
35
-		$this->object = new \Aimeos\MAdmin\Cache\Proxy\Flow( $context, $this->mock );
35
+		$this->object = new \Aimeos\MAdmin\Cache\Proxy\Flow($context, $this->mock);
36 36
 	}
37 37
 
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 testGetObject()
46 46
 	{
47
-		$class = new \ReflectionClass( \Aimeos\MAdmin\Cache\Proxy\Flow::class );
48
-		$method = $class->getMethod( 'getObject' );
49
-		$method->setAccessible( true );
47
+		$class = new \ReflectionClass(\Aimeos\MAdmin\Cache\Proxy\Flow::class);
48
+		$method = $class->getMethod('getObject');
49
+		$method->setAccessible(true);
50 50
 
51
-		$result = $method->invokeArgs( $this->object, [] );
52
-		$this->assertInstanceOf( \Aimeos\MW\Cache\Iface::class, $result );
51
+		$result = $method->invokeArgs($this->object, []);
52
+		$this->assertInstanceOf(\Aimeos\MW\Cache\Iface::class, $result);
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.