Completed
Push — master ( e0d958...949fd6 )
by Aimeos
02:40
created
admin/jsonadm/templates/partials/catalog/data-standard.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $options = 0;
4
-if( defined( 'JSON_PRETTY_PRINT' ) ) {
4
+if (defined('JSON_PRETTY_PRINT')) {
5 5
 	$options = JSON_PRETTY_PRINT;
6 6
 }
7 7
 
8 8
 
9
-$build = function( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Catalog\Item\Iface $item, array $fields, array $listItems )
9
+$build = function(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Catalog\Item\Iface $item, array $fields, array $listItems)
10 10
 {
11 11
 	$id = $item->getId();
12 12
 	$attributes = $item->toArray();
13 13
 	$type = $item->getResourceType();
14
-	$params = array( 'resource' => $item->getResourceType(), 'id' => $id );
14
+	$params = array('resource' => $item->getResourceType(), 'id' => $id);
15 15
 
16
-	$target = $view->config( 'admin/jsonadm/url/target' );
17
-	$cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' );
18
-	$action = $view->config( 'admin/jsonadm/url/action', 'get' );
19
-	$config = $view->config( 'admin/jsonadm/url/config', array() );
16
+	$target = $view->config('admin/jsonadm/url/target');
17
+	$cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm');
18
+	$action = $view->config('admin/jsonadm/url/action', 'get');
19
+	$config = $view->config('admin/jsonadm/url/config', array());
20 20
 
21
-	if( isset( $fields[$type] ) ) {
22
-		$attributes = array_intersect_key( $attributes, $fields[$type] );
21
+	if (isset($fields[$type])) {
22
+		$attributes = array_intersect_key($attributes, $fields[$type]);
23 23
 	}
24 24
 
25 25
 	$result = array(
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
 		'type' => $type,
28 28
 		'attributes' => $attributes,
29 29
 		'links' => array(
30
-			'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
30
+			'self' => $view->url($target, $cntl, $action, $params, array(), $config)
31 31
 		),
32 32
 		'relationships' => array()
33 33
 	);
34 34
 
35
-	foreach( $item->getChildren() as $childItem )
35
+	foreach ($item->getChildren() as $childItem)
36 36
 	{
37 37
 		$type = $childItem->getResourceType();
38
-		$result['relationships'][$type][] = array( 'data' => array( 'id' => $childItem->getId(), 'type' => $type ) );
38
+		$result['relationships'][$type][] = array('data' => array('id' => $childItem->getId(), 'type' => $type));
39 39
 	}
40 40
 
41
-	foreach( $listItems as $listId => $listItem )
41
+	foreach ($listItems as $listId => $listItem)
42 42
 	{
43
-		if( $listItem->getParentId() == $id )
43
+		if ($listItem->getParentId() == $id)
44 44
 		{
45 45
 			$type = $listItem->getDomain();
46
-			$params = array( 'resource' => $listItem->getResourceType(), 'id' => $listId );
46
+			$params = array('resource' => $listItem->getResourceType(), 'id' => $listId);
47 47
 
48
-			$result['relationships'][$type][] = array( 'data' => array(
48
+			$result['relationships'][$type][] = array('data' => array(
49 49
 				'id' => $listItem->getRefId(), 'type' => $type,
50 50
 				'attributes' => $listItem->toArray(), 'links' => array(
51
-					'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
51
+					'self' => $view->url($target, $cntl, $action, $params, array(), $config)
52 52
 				)
53
-			) );
53
+			));
54 54
 		}
55 55
 	}
56 56
 
@@ -58,27 +58,27 @@  discard block
 block discarded – undo
58 58
 };
59 59
 
60 60
 
61
-$fields = $this->param( 'fields', array() );
61
+$fields = $this->param('fields', array());
62 62
 
63
-foreach( (array) $fields as $resource => $list ) {
64
-	$fields[$resource] = array_flip( explode( ',', $list ) );
63
+foreach ((array) $fields as $resource => $list) {
64
+	$fields[$resource] = array_flip(explode(',', $list));
65 65
 }
66 66
 
67 67
 
68
-$data = $this->get( 'data', array() );
69
-$listItems = $this->get( 'listItems', array() );
68
+$data = $this->get('data', array());
69
+$listItems = $this->get('listItems', array());
70 70
 
71
-if( is_array( $data ) )
71
+if (is_array($data))
72 72
 {
73 73
 	$response = array();
74 74
 
75
-	foreach( $data as $item ) {
76
-		$response[] = $build( $this, $item, $fields, $listItems );
75
+	foreach ($data as $item) {
76
+		$response[] = $build($this, $item, $fields, $listItems);
77 77
 	}
78 78
 }
79
-elseif( $data !== null )
79
+elseif ($data !== null)
80 80
 {
81
-	$response = $build( $this, $data, $fields, $listItems );
81
+	$response = $build($this, $data, $fields, $listItems);
82 82
 }
83 83
 else
84 84
 {
@@ -86,4 +86,4 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 
89
-echo json_encode( $response, $options );
90 89
\ No newline at end of file
90
+echo json_encode($response, $options);
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,12 +75,10 @@
 block discarded – undo
75 75
 	foreach( $data as $item ) {
76 76
 		$response[] = $build( $this, $item, $fields, $listItems );
77 77
 	}
78
-}
79
-elseif( $data !== null )
78
+} elseif( $data !== null )
80 79
 {
81 80
 	$response = $build( $this, $data, $fields, $listItems );
82
-}
83
-else
81
+} else
84 82
 {
85 83
 	$response = null;
86 84
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -171,8 +171,7 @@  discard block
 block discarded – undo
171 171
 			$view->data = $manager->searchItems( $search, array(), $total );
172 172
 			$view->listItems = $this->getListItems( $view->data, $include );
173 173
 			$view->childItems = $this->getChildItems( $view->data, $include );
174
-		}
175
-		else
174
+		} else
176 175
 		{
177 176
 			$view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
178 177
 			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
@@ -229,8 +228,7 @@  discard block
 block discarded – undo
229 228
 			if( isset( $entry->parentid ) && $targetId !== null ) {
230 229
 				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
231 230
 			}
232
-		}
233
-		else
231
+		} else
234 232
 		{
235 233
 			$item = $manager->createItem();
236 234
 			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		/** admin/jsonadm/partials/catalog/template-data
116 116
 		 * Relative path to the data partial template file for the catalog client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.07
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/catalog/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/catalog/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	 * @param array $include List of resource types that should be fetched
141 141
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
142 142
 	 */
143
-	protected function getChildItems( array $items, array $include )
143
+	protected function getChildItems(array $items, array $include)
144 144
 	{
145 145
 		$list = array();
146 146
 
147
-		if( in_array( 'catalog', $include ) )
147
+		if (in_array('catalog', $include))
148 148
 		{
149
-			foreach( $items as $item ) {
150
-				$list = array_merge( $list, $item->getChildren() );
149
+			foreach ($items as $item) {
150
+				$list = array_merge($list, $item->getChildren());
151 151
 			}
152 152
 		}
153 153
 
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
163 163
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
164 164
 	 */
165
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
165
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
166 166
 	{
167
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' );
167
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
168 168
 
169
-		if( ( $key = $view->param( 'aggregate' ) ) !== null )
169
+		if (($key = $view->param('aggregate')) !== null)
170 170
 		{
171
-			$search = $this->initCriteria( $manager->createSearch(), $view->param() );
172
-			$view->data = $manager->aggregate( $search, $key );
171
+			$search = $this->initCriteria($manager->createSearch(), $view->param());
172
+			$view->data = $manager->aggregate($search, $key);
173 173
 			return $response;
174 174
 		}
175 175
 
176
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
177
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
176
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
177
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
178 178
 		$total = 1;
179 179
 
180
-		if( ( $id = $view->param( 'id' ) ) == null )
180
+		if (($id = $view->param('id')) == null)
181 181
 		{
182
-			$view->data = $manager->searchItems( $search, array(), $total );
183
-			$view->listItems = $this->getListItems( $view->data, $include );
184
-			$view->childItems = $this->getChildItems( $view->data, $include );
182
+			$view->data = $manager->searchItems($search, array(), $total);
183
+			$view->listItems = $this->getListItems($view->data, $include);
184
+			$view->childItems = $this->getChildItems($view->data, $include);
185 185
 		}
186 186
 		else
187 187
 		{
188
-			$view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
189
-			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
190
-			$view->childItems = $this->getChildItems( array( $view->data ), $include );
188
+			$view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
189
+			$view->listItems = $this->getListItems(array($id => $view->data), $include);
190
+			$view->childItems = $this->getChildItems(array($view->data), $include);
191 191
 		}
192 192
 
193
-		$view->refItems = $this->getRefItems( $view->listItems );
193
+		$view->refItems = $this->getRefItems($view->listItems);
194 194
 		$view->total = $total;
195 195
 
196 196
 		return $response;
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 	 * @param array $include List of resource types that should be fetched
205 205
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
206 206
 	 */
207
-	protected function getListItems( array $items, array $include )
207
+	protected function getListItems(array $items, array $include)
208 208
 	{
209
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
209
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
210 210
 
211 211
 		$search = $manager->createSearch();
212 212
 		$expr = array(
213
-			$search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ),
214
-			$search->compare( '==', 'catalog.lists.domain', $include ),
213
+			$search->compare('==', 'catalog.lists.parentid', array_keys($items)),
214
+			$search->compare('==', 'catalog.lists.domain', $include),
215 215
 		);
216
-		$search->setConditions( $search->combine( '&&', $expr ) );
216
+		$search->setConditions($search->combine('&&', $expr));
217 217
 
218
-		return $manager->searchItems( $search );
218
+		return $manager->searchItems($search);
219 219
 	}
220 220
 
221 221
 
@@ -226,32 +226,32 @@  discard block
 block discarded – undo
226 226
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
227 227
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
228 228
 	 */
229
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
229
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
230 230
 	{
231
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
232
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
231
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
232
+		$refId = (isset($entry->refid) ? $entry->refid : null);
233 233
 
234
-		if( isset( $entry->id ) )
234
+		if (isset($entry->id))
235 235
 		{
236
-			$item = $manager->getItem( $entry->id );
237
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
238
-			$manager->saveItem( $item );
236
+			$item = $manager->getItem($entry->id);
237
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
238
+			$manager->saveItem($item);
239 239
 
240
-			if( isset( $entry->parentid ) && $targetId !== null ) {
241
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
240
+			if (isset($entry->parentid) && $targetId !== null) {
241
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
242 242
 			}
243 243
 		}
244 244
 		else
245 245
 		{
246 246
 			$item = $manager->createItem();
247
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
248
-			$manager->insertItem( $item, $targetId, $refId );
247
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
248
+			$manager->insertItem($item, $targetId, $refId);
249 249
 		}
250 250
 
251
-		if( isset( $entry->relationships ) ) {
252
-			$this->saveRelationships( $manager, $item, $entry->relationships );
251
+		if (isset($entry->relationships)) {
252
+			$this->saveRelationships($manager, $item, $entry->relationships);
253 253
 		}
254 254
 
255
-		return $manager->getItem( $item->getId() );
255
+		return $manager->getItem($item->getId());
256 256
 	}
257 257
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/partials/locale/site/data-standard.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $options = 0;
4
-if( defined( 'JSON_PRETTY_PRINT' ) ) {
4
+if (defined('JSON_PRETTY_PRINT')) {
5 5
 	$options = JSON_PRETTY_PRINT;
6 6
 }
7 7
 
8 8
 
9
-$build = function( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Locale\Item\Site\Iface $item, array $fields )
9
+$build = function(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Locale\Item\Site\Iface $item, array $fields)
10 10
 {
11 11
 	$id = $item->getId();
12 12
 	$attributes = $item->toArray();
13 13
 	$type = $item->getResourceType();
14
-	$params = array( 'resource' => $item->getResourceType(), 'id' => $id );
14
+	$params = array('resource' => $item->getResourceType(), 'id' => $id);
15 15
 
16
-	$target = $view->config( 'admin/jsonadm/url/target' );
17
-	$cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' );
18
-	$action = $view->config( 'admin/jsonadm/url/action', 'get' );
19
-	$config = $view->config( 'admin/jsonadm/url/config', array() );
16
+	$target = $view->config('admin/jsonadm/url/target');
17
+	$cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm');
18
+	$action = $view->config('admin/jsonadm/url/action', 'get');
19
+	$config = $view->config('admin/jsonadm/url/config', array());
20 20
 
21
-	if( isset( $fields[$type] ) ) {
22
-		$attributes = array_intersect_key( $attributes, $fields[$type] );
21
+	if (isset($fields[$type])) {
22
+		$attributes = array_intersect_key($attributes, $fields[$type]);
23 23
 	}
24 24
 
25 25
 	$result = array(
@@ -27,41 +27,41 @@  discard block
 block discarded – undo
27 27
 		'type' => $type,
28 28
 		'attributes' => $attributes,
29 29
 		'links' => array(
30
-			'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
30
+			'self' => $view->url($target, $cntl, $action, $params, array(), $config)
31 31
 		),
32 32
 		'relationships' => array()
33 33
 	);
34 34
 
35
-	foreach( $item->getChildren() as $childItem )
35
+	foreach ($item->getChildren() as $childItem)
36 36
 	{
37 37
 		$type = $childItem->getResourceType();
38
-		$result['relationships'][$type][] = array( 'data' => array( 'id' => $childItem->getId(), 'type' => $type ) );
38
+		$result['relationships'][$type][] = array('data' => array('id' => $childItem->getId(), 'type' => $type));
39 39
 	}
40 40
 
41 41
 	return $result;
42 42
 };
43 43
 
44 44
 
45
-$fields = $this->param( 'fields', array() );
45
+$fields = $this->param('fields', array());
46 46
 
47
-foreach( (array) $fields as $resource => $list ) {
48
-	$fields[$resource] = array_flip( explode( ',', $list ) );
47
+foreach ((array) $fields as $resource => $list) {
48
+	$fields[$resource] = array_flip(explode(',', $list));
49 49
 }
50 50
 
51 51
 
52
-$data = $this->get( 'data', array() );
52
+$data = $this->get('data', array());
53 53
 
54
-if( is_array( $data ) )
54
+if (is_array($data))
55 55
 {
56 56
 	$response = array();
57 57
 
58
-	foreach( $data as $item ) {
59
-		$response[] = $build( $this, $item, $fields );
58
+	foreach ($data as $item) {
59
+		$response[] = $build($this, $item, $fields);
60 60
 	}
61 61
 }
62
-elseif( $data !== null )
62
+elseif ($data !== null)
63 63
 {
64
-	$response = $build( $this, $data, $fields );
64
+	$response = $build($this, $data, $fields);
65 65
 }
66 66
 else
67 67
 {
@@ -69,4 +69,4 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 
72
-echo json_encode( $response, $options );
73 72
\ No newline at end of file
73
+echo json_encode($response, $options);
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,12 +58,10 @@
 block discarded – undo
58 58
 	foreach( $data as $item ) {
59 59
 		$response[] = $build( $this, $item, $fields );
60 60
 	}
61
-}
62
-elseif( $data !== null )
61
+} elseif( $data !== null )
63 62
 {
64 63
 	$response = $build( $this, $data, $fields );
65
-}
66
-else
64
+} else
67 65
 {
68 66
 	$response = null;
69 67
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/aggregate-default.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$data = $this->get( 'data', array() );
3
+$data = $this->get('data', array());
4 4
 $entries = array();
5 5
 
6
-foreach( $data as $key => $value ) {
7
-	$entries[] = array( 'id' => $key, 'type' => 'aggregate', 'attributes' => $value );
6
+foreach ($data as $key => $value) {
7
+	$entries[] = array('id' => $key, 'type' => 'aggregate', 'attributes' => $value);
8 8
 }
9 9
 
10 10
 ?>
11 11
 {
12 12
 	"meta": {
13
-		"total": <?php echo count( $data ); ?>
13
+		"total": <?php echo count($data); ?>
14 14
 
15 15
 	},
16
-<?php	if( isset( $this->errors ) ) : ?>
17
-	"errors": <?php echo $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
18
-<?php	elseif( isset( $this->data ) ) : ?>
19
-	"data": <?php echo json_encode( $entries ); ?>
16
+<?php	if (isset($this->errors)) : ?>
17
+	"errors": <?php echo $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
18
+<?php	elseif (isset($this->data)) : ?>
19
+	"data": <?php echo json_encode($entries); ?>
20 20
 <?php	endif; ?>
21 21
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Product/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 	 * @param array $include List of resource types that should be fetched
108 108
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = array();
113
-		$prodIds = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'product/property' ) );
113
+		$prodIds = array_keys($items);
114
+		$include = array_intersect($include, array('product/property'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $prodIds ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $prodIds));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @param array $include List of resource types that should be fetched
135 135
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
136 136
 	 */
137
-	protected function getListItems( array $items, array $include )
137
+	protected function getListItems(array $items, array $include)
138 138
 	{
139
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
139
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
140 140
 
141 141
 		$search = $manager->createSearch();
142 142
 		$expr = array(
143
-			$search->compare( '==', 'product.lists.parentid', array_keys( $items ) ),
144
-			$search->compare( '==', 'product.lists.domain', $include ),
143
+			$search->compare('==', 'product.lists.parentid', array_keys($items)),
144
+			$search->compare('==', 'product.lists.domain', $include),
145 145
 		);
146
-		$search->setConditions( $search->combine( '&&', $expr ) );
146
+		$search->setConditions($search->combine('&&', $expr));
147 147
 
148
-		return $manager->searchItems( $search );
148
+		return $manager->searchItems($search);
149 149
 	}
150 150
 }
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.