Completed
Push — master ( 30e75e...337e63 )
by Aimeos
07:00
created
admin/jsonadm/src/Admin/JsonAdm/Factory.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@
 block discarded – undo
136 136
 			if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) {
137 137
 				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
138 138
 			}
139
-		}
140
-		else
139
+		} else
141 140
 		{
142 141
 			$client = self::createClientRoot( $context, $view, $templatePaths, $path, $name );
143 142
 		}
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	 * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface)
34 34
 	 * @param string $path Path describing the client to clear, e.g. "product/lists/type"
35 35
 	 */
36
-	static public function clear( $id = null, $path = null )
36
+	static public function clear($id = null, $path = null)
37 37
 	{
38
-		if( $id !== null )
38
+		if ($id !== null)
39 39
 		{
40
-			if( $path !== null ) {
40
+			if ($path !== null) {
41 41
 				self::$clients[$id][$path] = null;
42 42
 			} else {
43 43
 				self::$clients[$id] = [];
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 	 * @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance
66 66
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
67 67
 	 */
68
-	static public function createClient( \Aimeos\MShop\Context\Item\Iface $context,
69
-		array $templatePaths, $path, $name = null )
68
+	static public function createClient(\Aimeos\MShop\Context\Item\Iface $context,
69
+		array $templatePaths, $path, $name = null)
70 70
 	{
71
-		$path = strtolower( trim( $path, "/ \n\t\r\0\x0B" ) );
71
+		$path = strtolower(trim($path, "/ \n\t\r\0\x0B"));
72 72
 
73
-		if( empty( $path ) ) {
74
-			return self::createClientRoot( $context, $context->getView(), $templatePaths, $path, $name );
73
+		if (empty($path)) {
74
+			return self::createClientRoot($context, $context->getView(), $templatePaths, $path, $name);
75 75
 		}
76 76
 
77 77
 		$id = (string) $context;
78 78
 
79
-		if( self::$cache === false || !isset( self::$clients[$id][$path] ) ) {
80
-			self::$clients[$id][$path] = self::createClientNew( $context, $templatePaths, $path, $name );
79
+		if (self::$cache === false || !isset(self::$clients[$id][$path])) {
80
+			self::$clients[$id][$path] = self::createClientNew($context, $templatePaths, $path, $name);
81 81
 		}
82 82
 
83 83
 		return self::$clients[$id][$path];
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param boolean $value True to enable caching, false to disable it.
91 91
 	 * @return boolean Previous cache setting
92 92
 	 */
93
-	static public function setCache( $value )
93
+	static public function setCache($value)
94 94
 	{
95 95
 		$old = self::$cache;
96 96
 		self::$cache = (boolean) $value;
@@ -109,37 +109,37 @@  discard block
 block discarded – undo
109 109
 	 * @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance
110 110
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
111 111
 	 */
112
-	protected static function createClientNew( \Aimeos\MShop\Context\Item\Iface $context,
113
-		array $templatePaths, $path, $name )
112
+	protected static function createClientNew(\Aimeos\MShop\Context\Item\Iface $context,
113
+		array $templatePaths, $path, $name)
114 114
 	{
115
-		$parts = explode( '/', $path );
115
+		$parts = explode('/', $path);
116 116
 
117
-		foreach( $parts as $key => $part )
117
+		foreach ($parts as $key => $part)
118 118
 		{
119
-			if( ctype_alnum( $part ) === false )
119
+			if (ctype_alnum($part) === false)
120 120
 			{
121
-				$msg = sprintf( 'Invalid client "%1$s" in "%2$s"', $part, $path );
122
-				throw new \Aimeos\Admin\JsonAdm\Exception( $msg, 400 );
121
+				$msg = sprintf('Invalid client "%1$s" in "%2$s"', $part, $path);
122
+				throw new \Aimeos\Admin\JsonAdm\Exception($msg, 400);
123 123
 			}
124 124
 
125
-			$parts[$key] = ucwords( $part );
125
+			$parts[$key] = ucwords($part);
126 126
 		}
127 127
 
128 128
 
129 129
 		$view = $context->getView();
130
-		$factory = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\Factory';
130
+		$factory = '\\Aimeos\\Admin\\JsonAdm\\' . join('\\', $parts) . '\\Factory';
131 131
 
132
-		if( class_exists( $factory ) === true )
132
+		if (class_exists($factory) === true)
133 133
 		{
134
-			$args = array( $context, $view, $templatePaths, $path, $name );
134
+			$args = array($context, $view, $templatePaths, $path, $name);
135 135
 
136
-			if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) {
137
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
136
+			if (($client = @call_user_func_array(array($factory, 'createClient'), $args)) === false) {
137
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid factory "%1$s"', $factory), 400);
138 138
 			}
139 139
 		}
140 140
 		else
141 141
 		{
142
-			$client = self::createClientRoot( $context, $view, $templatePaths, $path, $name );
142
+			$client = self::createClientRoot($context, $view, $templatePaths, $path, $name);
143 143
 		}
144 144
 
145 145
 		return $client;
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance
158 158
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the client couldn't be created
159 159
 	 */
160
-	protected static function createClientRoot( \Aimeos\MShop\Context\Item\Iface $context,
161
-		\Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null )
160
+	protected static function createClientRoot(\Aimeos\MShop\Context\Item\Iface $context,
161
+		\Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null)
162 162
 	{
163 163
 		/** admin/jsonadm/name
164 164
 		 * Class name of the used JSON API client implementation
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
 		 * @since 2015.12
194 194
 		 * @category Developer
195 195
 		 */
196
-		if( $name === null ) {
197
-			$name = $context->getConfig()->get( 'admin/jsonadm/name', 'Standard' );
196
+		if ($name === null) {
197
+			$name = $context->getConfig()->get('admin/jsonadm/name', 'Standard');
198 198
 		}
199 199
 
200
-		if( ctype_alnum( $name ) === false )
200
+		if (ctype_alnum($name) === false)
201 201
 		{
202
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>';
203
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) );
202
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>';
203
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname));
204 204
 		}
205 205
 
206 206
 		$iface = '\\Aimeos\\Admin\\JsonAdm\\Iface';
207 207
 		$classname = '\\Aimeos\\Admin\\JsonAdm\\' . $name;
208 208
 
209
-		$client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path );
209
+		$client = self::createClientBase($classname, $iface, $context, $view, $templatePaths, $path);
210 210
 
211 211
 		/** admin/jsonadm/decorators/excludes
212 212
 		 * Excludes decorators added by the "common" option from the JSON API clients
@@ -286,6 +286,6 @@  discard block
 block discarded – undo
286 286
 		 * @see admin/jsonadm/decorators/global
287 287
 		 */
288 288
 
289
-		return self::addClientDecorators( $client, $context, $view, $templatePaths, $path );
289
+		return self::addClientDecorators($client, $context, $view, $templatePaths, $path);
290 290
 	}
291 291
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Catalog/StandardTest.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJadm::getContext();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard( $this->context, $this->view, $templatePaths, 'catalog' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard($this->context, $this->view, $templatePaths, 'catalog');
26 26
 	}
27 27
 
28 28
 
@@ -30,145 +30,145 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'catalog.code' => 'cafe' )
33
+				'==' => array('catalog.code' => 'cafe')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'catalog', $result['data'][0]['type'] );
50
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 6, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('catalog', $result['data'][0]['type']);
50
+		$this->assertEquals(6, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(6, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetTree()
58 58
 	{
59 59
 		$params = array(
60
-			'id' => $this->getCatalogItem( 'group' )->getId(),
60
+			'id' => $this->getCatalogItem('group')->getId(),
61 61
 			'filter' => array(
62
-				'==' => array( 'catalog.status' => 1 )
62
+				'==' => array('catalog.status' => 1)
63 63
 			),
64 64
 			'include' => 'catalog,text'
65 65
 		);
66
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
67
-		$this->view->addHelper( 'param', $helper );
66
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
67
+		$this->view->addHelper('param', $helper);
68 68
 
69
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
70
-		$result = json_decode( (string) $response->getBody(), true );
69
+		$response = $this->object->get($this->view->request(), $this->view->response());
70
+		$result = json_decode((string) $response->getBody(), true);
71 71
 
72 72
 
73
-		$this->assertEquals( 200, $response->getStatusCode() );
74
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
73
+		$this->assertEquals(200, $response->getStatusCode());
74
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
75 75
 
76
-		$this->assertEquals( 1, $result['meta']['total'] );
77
-		$this->assertEquals( 'catalog', $result['data']['type'] );
78
-		$this->assertEquals( 2, count( $result['data']['relationships']['catalog'] ) );
79
-		$this->assertEquals( 2, count( $result['included'] ) );
76
+		$this->assertEquals(1, $result['meta']['total']);
77
+		$this->assertEquals('catalog', $result['data']['type']);
78
+		$this->assertEquals(2, count($result['data']['relationships']['catalog']));
79
+		$this->assertEquals(2, count($result['included']));
80 80
 
81
-		$this->assertArrayNotHasKey( 'errors', $result );
81
+		$this->assertArrayNotHasKey('errors', $result);
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testPatch()
86 86
 	{
87
-		$stub = $this->getCatalogMock( array( 'getItem', 'moveItem', 'saveItem' ) );
87
+		$stub = $this->getCatalogMock(array('getItem', 'moveItem', 'saveItem'));
88 88
 
89
-		$stub->expects( $this->once() )->method( 'moveItem' );
90
-		$stub->expects( $this->once() )->method( 'saveItem' );
91
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
92
-			->will( $this->returnValue( $stub->createItem() ) );
89
+		$stub->expects($this->once())->method('moveItem');
90
+		$stub->expects($this->once())->method('saveItem');
91
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
92
+			->will($this->returnValue($stub->createItem()));
93 93
 
94 94
 
95
-		$params = array( 'id' => '-1' );
96
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
97
-		$this->view->addHelper( 'param', $helper );
95
+		$params = array('id' => '-1');
96
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
97
+		$this->view->addHelper('param', $helper);
98 98
 
99 99
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "catalog", "attributes": {"catalog.label": "test"}}}';
100
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
100
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
101 101
 
102
-		$response = $this->object->patch( $request, $this->view->response() );
103
-		$result = json_decode( (string) $response->getBody(), true );
102
+		$response = $this->object->patch($request, $this->view->response());
103
+		$result = json_decode((string) $response->getBody(), true);
104 104
 
105 105
 
106
-		$this->assertEquals( 200, $response->getStatusCode() );
107
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
106
+		$this->assertEquals(200, $response->getStatusCode());
107
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
108 108
 
109
-		$this->assertEquals( 1, $result['meta']['total'] );
110
-		$this->assertArrayHasKey( 'data', $result );
111
-		$this->assertEquals( 'catalog', $result['data']['type'] );
109
+		$this->assertEquals(1, $result['meta']['total']);
110
+		$this->assertArrayHasKey('data', $result);
111
+		$this->assertEquals('catalog', $result['data']['type']);
112 112
 
113
-		$this->assertArrayNotHasKey( 'included', $result );
114
-		$this->assertArrayNotHasKey( 'errors', $result );
113
+		$this->assertArrayNotHasKey('included', $result);
114
+		$this->assertArrayNotHasKey('errors', $result);
115 115
 	}
116 116
 
117 117
 
118 118
 	public function testPost()
119 119
 	{
120
-		$stub = $this->getCatalogMock( array( 'getItem', 'insertItem' ) );
120
+		$stub = $this->getCatalogMock(array('getItem', 'insertItem'));
121 121
 
122
-		$stub->expects( $this->any() )->method( 'getItem' )
123
-			->will( $this->returnValue( $stub->createItem() ) );
124
-		$stub->expects( $this->once() )->method( 'insertItem' );
122
+		$stub->expects($this->any())->method('getItem')
123
+			->will($this->returnValue($stub->createItem()));
124
+		$stub->expects($this->once())->method('insertItem');
125 125
 
126 126
 
127 127
 		$body = '{"data": {"type": "catalog", "attributes": {"catalog.code": "test", "catalog.label": "Test catalog"}}}';
128
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
128
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
129 129
 
130
-		$response = $this->object->post( $request, $this->view->response() );
131
-		$result = json_decode( (string) $response->getBody(), true );
130
+		$response = $this->object->post($request, $this->view->response());
131
+		$result = json_decode((string) $response->getBody(), true);
132 132
 
133 133
 
134
-		$this->assertEquals( 201, $response->getStatusCode() );
135
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
134
+		$this->assertEquals(201, $response->getStatusCode());
135
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
136 136
 
137
-		$this->assertEquals( 1, $result['meta']['total'] );
138
-		$this->assertArrayHasKey( 'data', $result );
139
-		$this->assertEquals( 'catalog', $result['data']['type'] );
137
+		$this->assertEquals(1, $result['meta']['total']);
138
+		$this->assertArrayHasKey('data', $result);
139
+		$this->assertEquals('catalog', $result['data']['type']);
140 140
 
141
-		$this->assertArrayNotHasKey( 'included', $result );
142
-		$this->assertArrayNotHasKey( 'errors', $result );
141
+		$this->assertArrayNotHasKey('included', $result);
142
+		$this->assertArrayNotHasKey('errors', $result);
143 143
 	}
144 144
 
145 145
 
146
-	protected function getCatalogItem( $code )
146
+	protected function getCatalogItem($code)
147 147
 	{
148
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context );
148
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
149 149
 		$search = $manager->createSearch();
150
-		$search->setConditions( $search->compare( '==', 'catalog.code', $code ) );
151
-		$items = $manager->searchItems( $search );
150
+		$search->setConditions($search->compare('==', 'catalog.code', $code));
151
+		$items = $manager->searchItems($search);
152 152
 
153
-		if( ( $item = reset( $items ) ) === false ) {
154
-			throw new \RuntimeException( sprintf( 'No catalog item with code "%1$s" found', $code ) );
153
+		if (($item = reset($items)) === false) {
154
+			throw new \RuntimeException(sprintf('No catalog item with code "%1$s" found', $code));
155 155
 		}
156 156
 
157 157
 		return $item;
158 158
 	}
159 159
 
160 160
 
161
-	protected function getCatalogMock( array $methods )
161
+	protected function getCatalogMock(array $methods)
162 162
 	{
163 163
 		$name = 'ClientJsonAdmStandard';
164
-		$this->context->getConfig()->set( 'mshop/catalog/manager/name', $name );
164
+		$this->context->getConfig()->set('mshop/catalog/manager/name', $name);
165 165
 
166
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Catalog\\Manager\\Standard' )
167
-			->setConstructorArgs( array( $this->context ) )
168
-			->setMethods( $methods )
166
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Catalog\\Manager\\Standard')
167
+			->setConstructorArgs(array($this->context))
168
+			->setMethods($methods)
169 169
 			->getMock();
170 170
 
171
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub );
171
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub);
172 172
 
173 173
 		return $stub;
174 174
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Supplier/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard( $this->context, $this->view, $templatePaths, 'supplier' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard($this->context, $this->view, $templatePaths, 'supplier');
26 26
 	}
27 27
 
28 28
 
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'supplier.code' => 'unitCode001' )
33
+				'==' => array('supplier.code' => 'unitCode001')
34 34
 			),
35 35
 			'include' => 'text,supplier/address'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'supplier', $result['data'][0]['type'] );
50
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) );
52
-		$this->assertEquals( 4, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('supplier', $result['data'][0]['type']);
50
+		$this->assertEquals(3, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address']));
52
+		$this->assertEquals(4, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
 			'sort' => 'supplier.id',
65 65
 			'include' => 'supplier/address'
66 66
 		);
67
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
68
-		$this->view->addHelper( 'param', $helper );
67
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
68
+		$this->view->addHelper('param', $helper);
69 69
 
70
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
71
-		$result = json_decode( (string) $response->getBody(), true );
70
+		$response = $this->object->get($this->view->request(), $this->view->response());
71
+		$result = json_decode((string) $response->getBody(), true);
72 72
 
73 73
 
74
-		$this->assertEquals( 200, $response->getStatusCode() );
75
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
74
+		$this->assertEquals(200, $response->getStatusCode());
75
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
76 76
 
77
-		$this->assertEquals( 3, $result['meta']['total'] );
78
-		$this->assertEquals( 3, count( $result['data'] ) );
79
-		$this->assertEquals( 'supplier', $result['data'][0]['type'] );
80
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
81
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) );
82
-		$this->assertEquals( 3, count( $result['included'] ) );
77
+		$this->assertEquals(3, $result['meta']['total']);
78
+		$this->assertEquals(3, count($result['data']));
79
+		$this->assertEquals('supplier', $result['data'][0]['type']);
80
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
81
+		$this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address']));
82
+		$this->assertEquals(3, count($result['included']));
83 83
 
84
-		$this->assertArrayNotHasKey( 'errors', $result );
84
+		$this->assertArrayNotHasKey('errors', $result);
85 85
 	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Order/StandardTest.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Order\Standard( $this->context, $this->view, $templatePaths, 'order' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Order\Standard($this->context, $this->view, $templatePaths, 'order');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'order.editor' => 'core:unittest' )
33
+				'==' => array('order.editor' => 'core:unittest')
34 34
 			),
35 35
 			'aggregate' => 'order.cdate',
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'aggregate', $result['data'][0]['type'] );
50
-		$this->assertGreaterThan( 0, count( $result['data'][0]['attributes'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('aggregate', $result['data'][0]['type']);
50
+		$this->assertGreaterThan(0, count($result['data'][0]['attributes']));
51 51
 
52
-		$this->assertArrayNotHasKey( 'errors', $result );
52
+		$this->assertArrayNotHasKey('errors', $result);
53 53
 	}
54 54
 
55 55
 
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		$params = array(
59 59
 			'filter' => array(
60
-				'==' => array( 'order.datepayment' => '2008-02-15 12:34:56' )
60
+				'==' => array('order.datepayment' => '2008-02-15 12:34:56')
61 61
 			),
62 62
 			'include' => 'order/base,order/status'
63 63
 		);
64
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
65
-		$this->view->addHelper( 'param', $helper );
64
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
65
+		$this->view->addHelper('param', $helper);
66 66
 
67
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
68
-		$result = json_decode( (string) $response->getBody(), true );
67
+		$response = $this->object->get($this->view->request(), $this->view->response());
68
+		$result = json_decode((string) $response->getBody(), true);
69 69
 
70 70
 
71
-		$this->assertEquals( 200, $response->getStatusCode() );
72
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
71
+		$this->assertEquals(200, $response->getStatusCode());
72
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
73 73
 
74
-		$this->assertEquals( 1, $result['meta']['total'] );
75
-		$this->assertEquals( 1, count( $result['data'] ) );
76
-		$this->assertEquals( 'order', $result['data'][0]['type'] );
77
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['order/status'] ) );
78
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['order/base'] ) );
79
-		$this->assertEquals( 4, count( $result['included'] ) );
74
+		$this->assertEquals(1, $result['meta']['total']);
75
+		$this->assertEquals(1, count($result['data']));
76
+		$this->assertEquals('order', $result['data'][0]['type']);
77
+		$this->assertEquals(3, count($result['data'][0]['relationships']['order/status']));
78
+		$this->assertEquals(1, count($result['data'][0]['relationships']['order/base']));
79
+		$this->assertEquals(4, count($result['included']));
80 80
 
81
-		$this->assertArrayNotHasKey( 'errors', $result );
81
+		$this->assertArrayNotHasKey('errors', $result);
82 82
 	}
83 83
 
84 84
 
@@ -91,23 +91,23 @@  discard block
 block discarded – undo
91 91
 			'sort' => 'order.id',
92 92
 			'include' => 'order/status'
93 93
 		);
94
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
95
-		$this->view->addHelper( 'param', $helper );
94
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
95
+		$this->view->addHelper('param', $helper);
96 96
 
97
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
98
-		$result = json_decode( (string) $response->getBody(), true );
97
+		$response = $this->object->get($this->view->request(), $this->view->response());
98
+		$result = json_decode((string) $response->getBody(), true);
99 99
 
100 100
 
101
-		$this->assertEquals( 200, $response->getStatusCode() );
102
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
101
+		$this->assertEquals(200, $response->getStatusCode());
102
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
103 103
 
104
-		$this->assertGreaterThanOrEqual( 4, $result['meta']['total'] );
105
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'] ) );
106
-		$this->assertEquals( 'order', $result['data'][0]['type'] );
107
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
108
-		$this->assertGreaterThanOrEqual( 3, count( $result['data'][0]['relationships']['order/status'] ) );
109
-		$this->assertGreaterThanOrEqual( 11, count( $result['included'] ) );
104
+		$this->assertGreaterThanOrEqual(4, $result['meta']['total']);
105
+		$this->assertGreaterThanOrEqual(4, count($result['data']));
106
+		$this->assertEquals('order', $result['data'][0]['type']);
107
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
108
+		$this->assertGreaterThanOrEqual(3, count($result['data'][0]['relationships']['order/status']));
109
+		$this->assertGreaterThanOrEqual(11, count($result['included']));
110 110
 
111
-		$this->assertArrayNotHasKey( 'errors', $result );
111
+		$this->assertArrayNotHasKey('errors', $result);
112 112
 	}
113 113
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Order/Base/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Order\Base\Standard( $this->context, $this->view, $templatePaths, 'order/base' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Order\Base\Standard($this->context, $this->view, $templatePaths, 'order/base');
26 26
 	}
27 27
 
28 28
 
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'order.base.price' => '4800.00' )
33
+				'==' => array('order.base.price' => '4800.00')
34 34
 			),
35 35
 			'include' => 'order/base/address,order/base/product'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'order/base', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['order/base/address'] ) );
51
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['order/base/product'] ) );
52
-		$this->assertEquals( 7, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('order/base', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['order/base/address']));
51
+		$this->assertEquals(6, count($result['data'][0]['relationships']['order/base/product']));
52
+		$this->assertEquals(7, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
 			'sort' => 'order.base.id',
65 65
 			'include' => 'order/base/product'
66 66
 		);
67
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
68
-		$this->view->addHelper( 'param', $helper );
67
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
68
+		$this->view->addHelper('param', $helper);
69 69
 
70
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
71
-		$result = json_decode( (string) $response->getBody(), true );
70
+		$response = $this->object->get($this->view->request(), $this->view->response());
71
+		$result = json_decode((string) $response->getBody(), true);
72 72
 
73 73
 
74
-		$this->assertEquals( 200, $response->getStatusCode() );
75
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
74
+		$this->assertEquals(200, $response->getStatusCode());
75
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
76 76
 
77
-		$this->assertGreaterThanOrEqual( 4, $result['meta']['total'] );
78
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'] ) );
79
-		$this->assertEquals( 'order/base', $result['data'][0]['type'] );
80
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
81
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'][0]['relationships']['order/base/product'] ) );
82
-		$this->assertGreaterThanOrEqual( 14, count( $result['included'] ) );
77
+		$this->assertGreaterThanOrEqual(4, $result['meta']['total']);
78
+		$this->assertGreaterThanOrEqual(4, count($result['data']));
79
+		$this->assertEquals('order/base', $result['data'][0]['type']);
80
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
81
+		$this->assertGreaterThanOrEqual(4, count($result['data'][0]['relationships']['order/base/product']));
82
+		$this->assertGreaterThanOrEqual(14, count($result['included']));
83 83
 
84
-		$this->assertArrayNotHasKey( 'errors', $result );
84
+		$this->assertArrayNotHasKey('errors', $result);
85 85
 	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard( $this->context, $this->view, $templatePaths, 'service' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard($this->context, $this->view, $templatePaths, 'service');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'service.code' => 'unitpaymentcode' )
33
+				'==' => array('service.code' => 'unitpaymentcode')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'service', $result['data'][0]['type'] );
50
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 3, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('service', $result['data'][0]['type']);
50
+		$this->assertEquals(3, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(3, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Locale/Site/StandardTest.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJadm::getContext();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard( $this->context, $this->view, $templatePaths, 'locale/site' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard($this->context, $this->view, $templatePaths, 'locale/site');
26 26
 	}
27 27
 
28 28
 
@@ -30,152 +30,152 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'locale.site.code' => 'unittest' )
33
+				'==' => array('locale.site.code' => 'unittest')
34 34
 			),
35 35
 		);
36
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
37
-		$this->view->addHelper( 'param', $helper );
36
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
37
+		$this->view->addHelper('param', $helper);
38 38
 
39
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
40
-		$result = json_decode( (string) $response->getBody(), true );
39
+		$response = $this->object->get($this->view->request(), $this->view->response());
40
+		$result = json_decode((string) $response->getBody(), true);
41 41
 
42 42
 
43
-		$this->assertEquals( 200, $response->getStatusCode() );
44
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
43
+		$this->assertEquals(200, $response->getStatusCode());
44
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
45 45
 
46
-		$this->assertEquals( 1, $result['meta']['total'] );
47
-		$this->assertEquals( 1, count( $result['data'] ) );
48
-		$this->assertEquals( 'locale/site', $result['data'][0]['type'] );
49
-		$this->assertEquals( 0, count( $result['included'] ) );
46
+		$this->assertEquals(1, $result['meta']['total']);
47
+		$this->assertEquals(1, count($result['data']));
48
+		$this->assertEquals('locale/site', $result['data'][0]['type']);
49
+		$this->assertEquals(0, count($result['included']));
50 50
 
51
-		$this->assertArrayNotHasKey( 'errors', $result );
51
+		$this->assertArrayNotHasKey('errors', $result);
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testGetTree()
56 56
 	{
57 57
 		$params = array(
58
-			'id' => $this->getSiteItem( 'unittest' )->getId(),
58
+			'id' => $this->getSiteItem('unittest')->getId(),
59 59
 			'filter' => array(
60
-				'==' => array( 'locale.status' => 0 )
60
+				'==' => array('locale.status' => 0)
61 61
 			),
62 62
 			'include' => 'locale/site'
63 63
 		);
64
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
65
-		$this->view->addHelper( 'param', $helper );
64
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
65
+		$this->view->addHelper('param', $helper);
66 66
 
67
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
68
-		$result = json_decode( (string) $response->getBody(), true );
67
+		$response = $this->object->get($this->view->request(), $this->view->response());
68
+		$result = json_decode((string) $response->getBody(), true);
69 69
 
70 70
 
71
-		$this->assertEquals( 200, $response->getStatusCode() );
72
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
71
+		$this->assertEquals(200, $response->getStatusCode());
72
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
73 73
 
74
-		$this->assertEquals( 1, $result['meta']['total'] );
75
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
76
-		$this->assertEquals( 0, count( $result['included'] ) );
74
+		$this->assertEquals(1, $result['meta']['total']);
75
+		$this->assertEquals('locale/site', $result['data']['type']);
76
+		$this->assertEquals(0, count($result['included']));
77 77
 
78
-		$this->assertArrayNotHasKey( 'errors', $result );
78
+		$this->assertArrayNotHasKey('errors', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testPatch()
83 83
 	{
84
-		$stub = $this->getSiteMock( array( 'getItem', 'moveItem', 'saveItem' ) );
84
+		$stub = $this->getSiteMock(array('getItem', 'moveItem', 'saveItem'));
85 85
 		$item = $stub->createItem();
86 86
 
87
-		$stub->expects( $this->once() )->method( 'moveItem' );
88
-		$stub->expects( $this->once() )->method( 'saveItem' );
89
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
90
-			->will( $this->returnValue( $item ) );
87
+		$stub->expects($this->once())->method('moveItem');
88
+		$stub->expects($this->once())->method('saveItem');
89
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
90
+			->will($this->returnValue($item));
91 91
 
92 92
 
93
-		$params = array( 'id' => '-1' );
94
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
95
-		$this->view->addHelper( 'param', $helper );
93
+		$params = array('id' => '-1');
94
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
95
+		$this->view->addHelper('param', $helper);
96 96
 
97 97
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "locale/site", "attributes": {"locale.site.label": "test"}}}';
98
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
98
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
99 99
 
100
-		$response = $this->object->patch( $request, $this->view->response() );
101
-		$result = json_decode( (string) $response->getBody(), true );
100
+		$response = $this->object->patch($request, $this->view->response());
101
+		$result = json_decode((string) $response->getBody(), true);
102 102
 
103 103
 
104
-		$this->assertEquals( 200, $response->getStatusCode() );
105
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
104
+		$this->assertEquals(200, $response->getStatusCode());
105
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
106 106
 
107
-		$this->assertEquals( 1, $result['meta']['total'] );
108
-		$this->assertArrayHasKey( 'data', $result );
109
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
107
+		$this->assertEquals(1, $result['meta']['total']);
108
+		$this->assertArrayHasKey('data', $result);
109
+		$this->assertEquals('locale/site', $result['data']['type']);
110 110
 
111
-		$this->assertArrayNotHasKey( 'included', $result );
112
-		$this->assertArrayNotHasKey( 'errors', $result );
111
+		$this->assertArrayNotHasKey('included', $result);
112
+		$this->assertArrayNotHasKey('errors', $result);
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testPost()
117 117
 	{
118
-		$stub = $this->getSiteMock( array( 'getItem', 'insertItem' ) );
118
+		$stub = $this->getSiteMock(array('getItem', 'insertItem'));
119 119
 		$item = $stub->createItem();
120 120
 
121
-		$stub->expects( $this->any() )->method( 'getItem' )
122
-			->will( $this->returnValue( $item ) );
123
-		$stub->expects( $this->once() )->method( 'insertItem' );
121
+		$stub->expects($this->any())->method('getItem')
122
+			->will($this->returnValue($item));
123
+		$stub->expects($this->once())->method('insertItem');
124 124
 
125 125
 
126 126
 		$body = '{"data": {"type": "locale/site", "attributes": {"locale.site.code": "unittest", "locale.site.label": "Unit test"}}}';
127
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
127
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
128 128
 
129
-		$response = $this->object->post( $request, $this->view->response() );
130
-		$result = json_decode( (string) $response->getBody(), true );
129
+		$response = $this->object->post($request, $this->view->response());
130
+		$result = json_decode((string) $response->getBody(), true);
131 131
 
132 132
 
133
-		$this->assertEquals( 201, $response->getStatusCode() );
134
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
133
+		$this->assertEquals(201, $response->getStatusCode());
134
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
135 135
 
136
-		$this->assertEquals( 1, $result['meta']['total'] );
137
-		$this->assertArrayHasKey( 'data', $result );
138
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
136
+		$this->assertEquals(1, $result['meta']['total']);
137
+		$this->assertArrayHasKey('data', $result);
138
+		$this->assertEquals('locale/site', $result['data']['type']);
139 139
 
140
-		$this->assertArrayNotHasKey( 'included', $result );
141
-		$this->assertArrayNotHasKey( 'errors', $result );
140
+		$this->assertArrayNotHasKey('included', $result);
141
+		$this->assertArrayNotHasKey('errors', $result);
142 142
 	}
143 143
 
144 144
 
145
-	protected function getSiteItem( $code )
145
+	protected function getSiteItem($code)
146 146
 	{
147
-		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $this->context )->getSubManager( 'site' );
147
+		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->context)->getSubManager('site');
148 148
 		$search = $manager->createSearch();
149
-		$search->setConditions( $search->compare( '==', 'locale.site.code', $code ) );
150
-		$items = $manager->searchItems( $search );
149
+		$search->setConditions($search->compare('==', 'locale.site.code', $code));
150
+		$items = $manager->searchItems($search);
151 151
 
152
-		if( ( $item = reset( $items ) ) === false ) {
153
-			throw new \RuntimeException( sprintf( 'No locale site item with code "%1$s" found', $code ) );
152
+		if (($item = reset($items)) === false) {
153
+			throw new \RuntimeException(sprintf('No locale site item with code "%1$s" found', $code));
154 154
 		}
155 155
 
156 156
 		return $item;
157 157
 	}
158 158
 
159 159
 
160
-	protected function getSiteMock( array $methods )
160
+	protected function getSiteMock(array $methods)
161 161
 	{
162 162
 		$name = 'ClientJsonAdmStandard';
163
-		$this->context->getConfig()->set( 'mshop/locale/manager/name', $name );
163
+		$this->context->getConfig()->set('mshop/locale/manager/name', $name);
164 164
 
165
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Standard' )
166
-			->setConstructorArgs( array( $this->context ) )
167
-			->setMethods( array( 'getSubManager' ) )
165
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Standard')
166
+			->setConstructorArgs(array($this->context))
167
+			->setMethods(array('getSubManager'))
168 168
 			->getMock();
169 169
 
170
-		$siteStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard' )
171
-			->setConstructorArgs( array( $this->context ) )
172
-			->setMethods( $methods )
170
+		$siteStub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard')
171
+			->setConstructorArgs(array($this->context))
172
+			->setMethods($methods)
173 173
 			->getMock();
174 174
 
175
-		$stub->expects( $this->once() )->method( 'getSubManager' )
176
-			->will( $this->returnValue( $siteStub ) );
175
+		$stub->expects($this->once())->method('getSubManager')
176
+			->will($this->returnValue($siteStub));
177 177
 
178
-		\Aimeos\MShop\Locale\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub );
178
+		\Aimeos\MShop\Locale\Manager\Factory::injectManager('\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub);
179 179
 
180 180
 		return $siteStub;
181 181
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Media/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard( $this->context, $this->view, $templatePaths, 'media' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard($this->context, $this->view, $templatePaths, 'media');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'media.label' => 'cn_colombie_179x178' )
33
+				'==' => array('media.label' => 'cn_colombie_179x178')
34 34
 			),
35 35
 			'include' => 'attribute'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'media', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['attribute'] ) );
51
-		$this->assertEquals( 1, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('media', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['attribute']));
51
+		$this->assertEquals(1, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Attribute/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard( $this->context, $this->view, $templatePaths, 'attribute' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard($this->context, $this->view, $templatePaths, 'attribute');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'attribute.code' => 's' )
33
+				'==' => array('attribute.code' => 's')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'attribute', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 1, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('attribute', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(1, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.