@@ -110,30 +110,30 @@ discard block |
||
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 | $view = $this->getView(); |
116 | 116 | |
117 | 117 | try |
118 | 118 | { |
119 | - $response = $this->getItems( $view, $request, $response ); |
|
119 | + $response = $this->getItems($view, $request, $response); |
|
120 | 120 | $status = 200; |
121 | 121 | } |
122 | - catch( \Aimeos\MShop\Exception $e ) |
|
122 | + catch (\Aimeos\MShop\Exception $e) |
|
123 | 123 | { |
124 | 124 | $status = 404; |
125 | - $view->errors = array( array( |
|
126 | - 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
125 | + $view->errors = array(array( |
|
126 | + 'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()), |
|
127 | 127 | 'detail' => $e->getTraceAsString(), |
128 | - ) ); |
|
128 | + )); |
|
129 | 129 | } |
130 | - catch( \Exception $e ) |
|
130 | + catch (\Exception $e) |
|
131 | 131 | { |
132 | 132 | $status = 500; |
133 | - $view->errors = array( array( |
|
133 | + $view->errors = array(array( |
|
134 | 134 | 'title' => $e->getMessage(), |
135 | 135 | 'detail' => $e->getTraceAsString(), |
136 | - ) ); |
|
136 | + )); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** admin/jsonadm/plugin/config/template-get |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | $tplconf = 'admin/jsonadm/plugin/config/template-get'; |
159 | 159 | $default = 'config-default.php'; |
160 | 160 | |
161 | - $body = $view->render( $view->config( $tplconf, $default ) ); |
|
161 | + $body = $view->render($view->config($tplconf, $default)); |
|
162 | 162 | |
163 | - return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' ) |
|
164 | - ->withBody( $view->response()->createStreamFromString( $body ) ) |
|
165 | - ->withStatus( $status ); |
|
163 | + return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"') |
|
164 | + ->withBody($view->response()->createStreamFromString($body)) |
|
165 | + ->withStatus($status); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -174,22 +174,22 @@ discard block |
||
174 | 174 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
175 | 175 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
176 | 176 | */ |
177 | - protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) |
|
177 | + protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response) |
|
178 | 178 | { |
179 | - if( ( $id = $view->param( 'id' ) ) == null ) { |
|
180 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
|
179 | + if (($id = $view->param('id')) == null) { |
|
180 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400); |
|
181 | 181 | } |
182 | 182 | |
183 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'plugin' ); |
|
183 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin'); |
|
184 | 184 | |
185 | 185 | // @todo Pass type as second parameter to getProvider() |
186 | 186 | $values = [ |
187 | - 'plugin.type' => $view->param( 'type', 'order' ), |
|
187 | + 'plugin.type' => $view->param('type', 'order'), |
|
188 | 188 | 'plugin.provider' => $id, |
189 | 189 | ]; |
190 | - $item = new \Aimeos\MShop\Plugin\Item\Standard( $values ); |
|
190 | + $item = new \Aimeos\MShop\Plugin\Item\Standard($values); |
|
191 | 191 | |
192 | - $view->configItems = $manager->getProvider( $item )->getConfigBE(); |
|
192 | + $view->configItems = $manager->getProvider($item)->getConfigBE(); |
|
193 | 193 | |
194 | 194 | return $response; |
195 | 195 | } |
@@ -118,16 +118,14 @@ |
||
118 | 118 | { |
119 | 119 | $response = $this->getItems( $view, $request, $response ); |
120 | 120 | $status = 200; |
121 | - } |
|
122 | - catch( \Aimeos\MShop\Exception $e ) |
|
121 | + } catch( \Aimeos\MShop\Exception $e ) |
|
123 | 122 | { |
124 | 123 | $status = 404; |
125 | 124 | $view->errors = array( array( |
126 | 125 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
127 | 126 | 'detail' => $e->getTraceAsString(), |
128 | 127 | ) ); |
129 | - } |
|
130 | - catch( \Exception $e ) |
|
128 | + } catch( \Exception $e ) |
|
131 | 129 | { |
132 | 130 | $status = 500; |
133 | 131 | $view->errors = array( array( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $templatePaths List of file system paths where the templates are stored |
34 | 34 | * @param string $path Name of the client separated by slashes, e.g "product/property" |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) |
|
36 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path) |
|
37 | 37 | { |
38 | 38 | $this->view = $view; |
39 | 39 | $this->context = $context; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param array $param List of method parameter |
50 | 50 | * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed |
51 | 51 | */ |
52 | - public function __call( $name, array $param ) |
|
52 | + public function __call($name, array $param) |
|
53 | 53 | { |
54 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
54 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Unable to call method "%1$s"', $name)); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param array $include List of resource types that should be fetched |
63 | 63 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
64 | 64 | */ |
65 | - protected function getChildItems( array $items, array $include ) |
|
65 | + protected function getChildItems(array $items, array $include) |
|
66 | 66 | { |
67 | 67 | return []; |
68 | 68 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter |
86 | 86 | * @return array List of domain names |
87 | 87 | */ |
88 | - protected function getDomains( \Aimeos\MW\View\Iface $view ) |
|
88 | + protected function getDomains(\Aimeos\MW\View\Iface $view) |
|
89 | 89 | { |
90 | - if( ( $domains = $view->param( 'resource' ) ) == '' ) |
|
90 | + if (($domains = $view->param('resource')) == '') |
|
91 | 91 | { |
92 | 92 | /** admin/jsonadm/domains |
93 | 93 | * A list of domain names whose clients are available for the JSON API |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order', |
111 | 111 | 'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text' |
112 | 112 | ); |
113 | - $domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default ); |
|
113 | + $domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return (array) $domains; |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | * @param \stdClass $request Decoded request body |
124 | 124 | * @return array List of item IDs |
125 | 125 | */ |
126 | - protected function getIds( $request ) |
|
126 | + protected function getIds($request) |
|
127 | 127 | { |
128 | 128 | $ids = []; |
129 | 129 | |
130 | - if( isset( $request->data ) ) |
|
130 | + if (isset($request->data)) |
|
131 | 131 | { |
132 | - foreach( (array) $request->data as $entry ) |
|
132 | + foreach ((array) $request->data as $entry) |
|
133 | 133 | { |
134 | - if( isset( $entry->id ) ) { |
|
134 | + if (isset($entry->id)) { |
|
135 | 135 | $ids[] = $entry->id; |
136 | 136 | } |
137 | 137 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param array $include List of resource types that should be fetched |
149 | 149 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
150 | 150 | */ |
151 | - protected function getListItems( array $items, array $include ) |
|
151 | + protected function getListItems(array $items, array $include) |
|
152 | 152 | { |
153 | 153 | return []; |
154 | 154 | } |
@@ -171,23 +171,23 @@ discard block |
||
171 | 171 | * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
172 | 172 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
173 | 173 | */ |
174 | - protected function getRefItems( array $listItems ) |
|
174 | + protected function getRefItems(array $listItems) |
|
175 | 175 | { |
176 | 176 | $list = $map = []; |
177 | 177 | $context = $this->getContext(); |
178 | 178 | |
179 | - foreach( $listItems as $listItem ) { |
|
179 | + foreach ($listItems as $listItem) { |
|
180 | 180 | $map[$listItem->getDomain()][] = $listItem->getRefId(); |
181 | 181 | } |
182 | 182 | |
183 | - foreach( $map as $domain => $ids ) |
|
183 | + foreach ($map as $domain => $ids) |
|
184 | 184 | { |
185 | - $manager = \Aimeos\MShop\Factory::createManager( $context, $domain ); |
|
185 | + $manager = \Aimeos\MShop\Factory::createManager($context, $domain); |
|
186 | 186 | |
187 | 187 | $search = $manager->createSearch(); |
188 | - $search->setConditions( $search->compare( '==', $domain . '.id', $ids ) ); |
|
188 | + $search->setConditions($search->compare('==', $domain . '.id', $ids)); |
|
189 | 189 | |
190 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
190 | + $list = array_merge($list, $manager->searchItems($search)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return $list; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter |
201 | 201 | * @return array List of domain names |
202 | 202 | */ |
203 | - protected function getResources( \Aimeos\MW\View\Iface $view ) |
|
203 | + protected function getResources(\Aimeos\MW\View\Iface $view) |
|
204 | 204 | { |
205 | 205 | /** admin/jsonadm/resources |
206 | 206 | * A list of additional resources name whose clients are available for the JSON API |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @category Developer |
219 | 219 | * @see admin/jsonadm/domains |
220 | 220 | */ |
221 | - return (array) $view->config( 'admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config'] ); |
|
221 | + return (array) $view->config('admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config']); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @param array $params List of criteria data with condition, sorting and paging |
252 | 252 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
253 | 253 | */ |
254 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
254 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
255 | 255 | { |
256 | - $this->initCriteriaConditions( $criteria, $params ); |
|
257 | - $this->initCriteriaSortations( $criteria, $params ); |
|
258 | - $this->initCriteriaSlice( $criteria, $params ); |
|
256 | + $this->initCriteriaConditions($criteria, $params); |
|
257 | + $this->initCriteriaSortations($criteria, $params); |
|
258 | + $this->initCriteriaSlice($criteria, $params); |
|
259 | 259 | |
260 | 260 | return $criteria; |
261 | 261 | } |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
268 | 268 | * @param array $params List of criteria data with condition, sorting and paging |
269 | 269 | */ |
270 | - protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
270 | + protected function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
271 | 271 | { |
272 | - if( !isset( $params['filter'] ) ) { |
|
272 | + if (!isset($params['filter'])) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | $existing = $criteria->getConditions(); |
277 | - $criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) ); |
|
277 | + $criteria->setConditions($criteria->toConditions((array) $params['filter'])); |
|
278 | 278 | |
279 | - $expr = array( $criteria->getConditions(), $existing ); |
|
280 | - $criteria->setConditions( $criteria->combine( '&&', $expr ) ); |
|
279 | + $expr = array($criteria->getConditions(), $existing); |
|
280 | + $criteria->setConditions($criteria->combine('&&', $expr)); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
288 | 288 | * @param array $params List of criteria data with condition, sorting and paging |
289 | 289 | */ |
290 | - protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
290 | + protected function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
291 | 291 | { |
292 | - $start = ( isset( $params['page']['offset'] ) ? (int) $params['page']['offset'] : 0 ); |
|
293 | - $size = ( isset( $params['page']['limit'] ) ? (int) $params['page']['limit'] : 25 ); |
|
292 | + $start = (isset($params['page']['offset']) ? (int) $params['page']['offset'] : 0); |
|
293 | + $size = (isset($params['page']['limit']) ? (int) $params['page']['limit'] : 25); |
|
294 | 294 | |
295 | - $criteria->setSlice( $start, $size ); |
|
295 | + $criteria->setSlice($start, $size); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -302,24 +302,24 @@ discard block |
||
302 | 302 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
303 | 303 | * @param array $params List of criteria data with condition, sorting and paging |
304 | 304 | */ |
305 | - protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
305 | + protected function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
306 | 306 | { |
307 | - if( !isset( $params['sort'] ) ) { |
|
307 | + if (!isset($params['sort'])) { |
|
308 | 308 | return; |
309 | 309 | } |
310 | 310 | |
311 | 311 | $sortation = []; |
312 | 312 | |
313 | - foreach( explode( ',', $params['sort'] ) as $sort ) |
|
313 | + foreach (explode(',', $params['sort']) as $sort) |
|
314 | 314 | { |
315 | - if( $sort[0] === '-' ) { |
|
316 | - $sortation[] = $criteria->sort( '-', substr( $sort, 1 ) ); |
|
315 | + if ($sort[0] === '-') { |
|
316 | + $sortation[] = $criteria->sort('-', substr($sort, 1)); |
|
317 | 317 | } else { |
318 | - $sortation[] = $criteria->sort( '+', $sort ); |
|
318 | + $sortation[] = $criteria->sort('+', $sort); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | - $criteria->setSortations( $sortation ); |
|
322 | + $criteria->setSortations($sortation); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -330,14 +330,14 @@ discard block |
||
330 | 330 | * @param \stdClass $request Object with request body data |
331 | 331 | * @return array List of items |
332 | 332 | */ |
333 | - protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) |
|
333 | + protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request) |
|
334 | 334 | { |
335 | 335 | $data = []; |
336 | 336 | |
337 | - if( isset( $request->data ) ) |
|
337 | + if (isset($request->data)) |
|
338 | 338 | { |
339 | - foreach( (array) $request->data as $entry ) { |
|
340 | - $data[] = $this->saveEntry( $manager, $entry ); |
|
339 | + foreach ((array) $request->data as $entry) { |
|
340 | + $data[] = $this->saveEntry($manager, $entry); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -352,22 +352,22 @@ discard block |
||
352 | 352 | * @param \stdClass $entry Object including "id" and "attributes" elements |
353 | 353 | * @return \Aimeos\MShop\Common\Item\Iface New or updated item |
354 | 354 | */ |
355 | - protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry ) |
|
355 | + protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry) |
|
356 | 356 | { |
357 | - if( isset( $entry->id ) ) { |
|
358 | - $item = $manager->getItem( $entry->id ); |
|
357 | + if (isset($entry->id)) { |
|
358 | + $item = $manager->getItem($entry->id); |
|
359 | 359 | } else { |
360 | 360 | $item = $manager->createItem(); |
361 | 361 | } |
362 | 362 | |
363 | - $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |
|
364 | - $item = $manager->saveItem( $item ); |
|
363 | + $item = $this->addItemData($manager, $item, $entry, $item->getResourceType()); |
|
364 | + $item = $manager->saveItem($item); |
|
365 | 365 | |
366 | - if( isset( $entry->relationships ) ) { |
|
367 | - $this->saveRelationships( $manager, $item, $entry->relationships ); |
|
366 | + if (isset($entry->relationships)) { |
|
367 | + $this->saveRelationships($manager, $item, $entry->relationships); |
|
368 | 368 | } |
369 | 369 | |
370 | - return $manager->getItem( $item->getId() ); |
|
370 | + return $manager->getItem($item->getId()); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -378,28 +378,28 @@ discard block |
||
378 | 378 | * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set |
379 | 379 | * @param \stdClass $relationships Object including the <domain>/data/attributes structure |
380 | 380 | */ |
381 | - protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager, |
|
382 | - \Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships ) |
|
381 | + protected function saveRelationships(\Aimeos\MShop\Common\Manager\Iface $manager, |
|
382 | + \Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships) |
|
383 | 383 | { |
384 | 384 | $id = $item->getId(); |
385 | - $listManager = $manager->getSubManager( 'lists' ); |
|
385 | + $listManager = $manager->getSubManager('lists'); |
|
386 | 386 | |
387 | - foreach( (array) $relationships as $domain => $list ) |
|
387 | + foreach ((array) $relationships as $domain => $list) |
|
388 | 388 | { |
389 | - if( isset( $list->data ) ) |
|
389 | + if (isset($list->data)) |
|
390 | 390 | { |
391 | - foreach( (array) $list->data as $data ) |
|
391 | + foreach ((array) $list->data as $data) |
|
392 | 392 | { |
393 | - $listItem = $this->addItemData( $listManager, $listManager->createItem(), $data, $domain ); |
|
393 | + $listItem = $this->addItemData($listManager, $listManager->createItem(), $data, $domain); |
|
394 | 394 | |
395 | - if( isset( $data->id ) ) { |
|
396 | - $listItem->setRefId( $data->id ); |
|
395 | + if (isset($data->id)) { |
|
396 | + $listItem->setRefId($data->id); |
|
397 | 397 | } |
398 | 398 | |
399 | - $listItem->setParentId( $id ); |
|
400 | - $listItem->setDomain( $domain ); |
|
399 | + $listItem->setParentId($id); |
|
400 | + $listItem->setDomain($domain); |
|
401 | 401 | |
402 | - $listManager->saveItem( $listItem, false ); |
|
402 | + $listManager->saveItem($listItem, false); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | } |
@@ -416,20 +416,20 @@ discard block |
||
416 | 416 | * @return \Aimeos\MShop\Common\Item\Iface Item including the data |
417 | 417 | */ |
418 | 418 | protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager, |
419 | - \Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain ) |
|
419 | + \Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain) |
|
420 | 420 | { |
421 | - if( isset( $data->attributes ) ) |
|
421 | + if (isset($data->attributes)) |
|
422 | 422 | { |
423 | 423 | $attr = (array) $data->attributes; |
424 | - $key = str_replace( '/', '.', $item->getResourceType() ); |
|
424 | + $key = str_replace('/', '.', $item->getResourceType()); |
|
425 | 425 | |
426 | - if( isset( $attr[$key.'.type'] ) ) |
|
426 | + if (isset($attr[$key . '.type'])) |
|
427 | 427 | { |
428 | - $typeItem = $manager->getSubManager( 'type' )->findItem( $attr[$key.'.type'], [], $domain ); |
|
429 | - $attr[$key.'.typeid'] = $typeItem->getId(); |
|
428 | + $typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], [], $domain); |
|
429 | + $attr[$key . '.typeid'] = $typeItem->getId(); |
|
430 | 430 | } |
431 | 431 | |
432 | - $item->fromArray( $attr ); |
|
432 | + $item->fromArray($attr); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | return $item; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJadm::getContext(); |
23 | 23 | $this->view = $this->context->getView(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard( $this->context, $this->view, $templatePaths, 'plugin/config' ); |
|
25 | + $this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard($this->context, $this->view, $templatePaths, 'plugin/config'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -31,26 +31,26 @@ discard block |
||
31 | 31 | $params = array( |
32 | 32 | 'id' => 'Autofill,Log', |
33 | 33 | ); |
34 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
35 | - $this->view->addHelper( 'param', $helper ); |
|
36 | - |
|
37 | - $response = $this->object->get( $this->view->request(), $this->view->response() ); |
|
38 | - $result = json_decode( (string) $response->getBody(), true ); |
|
39 | - |
|
40 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
41 | - $this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) ); |
|
42 | - |
|
43 | - $this->assertEquals( 8, $result['meta']['total'] ); |
|
44 | - $this->assertInternalType( 'array', $result['data'] ); |
|
45 | - $this->assertEquals( 'autofill.address', $result['data'][0]['id'] ); |
|
46 | - $this->assertEquals( 'autofill.delivery', $result['data'][1]['id'] ); |
|
47 | - $this->assertEquals( 'autofill.deliverycode', $result['data'][2]['id'] ); |
|
48 | - $this->assertEquals( 'autofill.payment', $result['data'][3]['id'] ); |
|
49 | - $this->assertEquals( 'autofill.paymentcode', $result['data'][4]['id'] ); |
|
50 | - $this->assertEquals( 'autofill.useorder', $result['data'][5]['id'] ); |
|
51 | - $this->assertEquals( 'autofill.orderaddress', $result['data'][6]['id'] ); |
|
52 | - $this->assertEquals( 'autofill.orderservice', $result['data'][7]['id'] ); |
|
53 | - |
|
54 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
34 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
35 | + $this->view->addHelper('param', $helper); |
|
36 | + |
|
37 | + $response = $this->object->get($this->view->request(), $this->view->response()); |
|
38 | + $result = json_decode((string) $response->getBody(), true); |
|
39 | + |
|
40 | + $this->assertEquals(200, $response->getStatusCode()); |
|
41 | + $this->assertEquals(1, count($response->getHeader('Content-Type'))); |
|
42 | + |
|
43 | + $this->assertEquals(8, $result['meta']['total']); |
|
44 | + $this->assertInternalType('array', $result['data']); |
|
45 | + $this->assertEquals('autofill.address', $result['data'][0]['id']); |
|
46 | + $this->assertEquals('autofill.delivery', $result['data'][1]['id']); |
|
47 | + $this->assertEquals('autofill.deliverycode', $result['data'][2]['id']); |
|
48 | + $this->assertEquals('autofill.payment', $result['data'][3]['id']); |
|
49 | + $this->assertEquals('autofill.paymentcode', $result['data'][4]['id']); |
|
50 | + $this->assertEquals('autofill.useorder', $result['data'][5]['id']); |
|
51 | + $this->assertEquals('autofill.orderaddress', $result['data'][6]['id']); |
|
52 | + $this->assertEquals('autofill.orderservice', $result['data'][7]['id']); |
|
53 | + |
|
54 | + $this->assertArrayNotHasKey('errors', $result); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | \ No newline at end of file |