@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | { |
43 | 43 | $view = $this->getView(); |
44 | 44 | |
45 | - $view->attributeData = $this->toArray( $view->item, true ); |
|
45 | + $view->attributeData = $this->toArray($view->item, true); |
|
46 | 46 | $view->attributeBody = ''; |
47 | 47 | |
48 | - foreach( $this->getSubClients() as $client ) { |
|
48 | + foreach ($this->getSubClients() as $client) { |
|
49 | 49 | $view->attributeBody .= $client->copy(); |
50 | 50 | } |
51 | 51 | |
52 | - return $this->render( $view ); |
|
52 | + return $this->render($view); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | { |
63 | 63 | $view = $this->getView(); |
64 | 64 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
65 | - $data = $view->param( 'characteristic/attribute', [] ); |
|
65 | + $data = $view->param('characteristic/attribute', []); |
|
66 | 66 | |
67 | - foreach( $view->value( $data, 'product.lists.id', [] ) as $idx => $value ) { |
|
67 | + foreach ($view->value($data, 'product.lists.id', []) as $idx => $value) { |
|
68 | 68 | $data['product.lists.siteid'][$idx] = $siteid; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $view->attributeData = $data; |
72 | 72 | $view->attributeBody = ''; |
73 | 73 | |
74 | - foreach( $this->getSubClients() as $client ) { |
|
74 | + foreach ($this->getSubClients() as $client) { |
|
75 | 75 | $view->attributeBody .= $client->create(); |
76 | 76 | } |
77 | 77 | |
78 | - return $this->render( $view ); |
|
78 | + return $this->render($view); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | { |
89 | 89 | $view = $this->getView(); |
90 | 90 | |
91 | - $view->attributeData = $this->toArray( $view->item ); |
|
91 | + $view->attributeData = $this->toArray($view->item); |
|
92 | 92 | $view->attributeBody = ''; |
93 | 93 | |
94 | - foreach( $this->getSubClients() as $client ) { |
|
94 | + foreach ($this->getSubClients() as $client) { |
|
95 | 95 | $view->attributeBody .= $client->get(); |
96 | 96 | } |
97 | 97 | |
98 | - return $this->render( $view ); |
|
98 | + return $this->render($view); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | { |
107 | 107 | $view = $this->getView(); |
108 | 108 | |
109 | - $this->fromArray( $view->item, $view->param( 'characteristic/attribute', [] ) ); |
|
109 | + $this->fromArray($view->item, $view->param('characteristic/attribute', [])); |
|
110 | 110 | $view->attributeBody = ''; |
111 | 111 | |
112 | - foreach( $this->getSubClients() as $client ) { |
|
112 | + foreach ($this->getSubClients() as $client) { |
|
113 | 113 | $view->attributeBody .= $client->save(); |
114 | 114 | } |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string|null $name Name of the sub-client (Default if null) |
123 | 123 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
124 | 124 | */ |
125 | - public function getSubClient( $type, $name = null ) |
|
125 | + public function getSubClient($type, $name = null) |
|
126 | 126 | { |
127 | 127 | /** admin/jqadm/product/characteristic/attribute/decorators/excludes |
128 | 128 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @see admin/jqadm/product/characteristic/attribute/decorators/excludes |
198 | 198 | * @see admin/jqadm/product/characteristic/attribute/decorators/global |
199 | 199 | */ |
200 | - return $this->createSubClient( 'product/characteristic/attribute/' . $type, $name ); |
|
200 | + return $this->createSubClient('product/characteristic/attribute/' . $type, $name); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @since 2016.01 |
242 | 242 | * @category Developer |
243 | 243 | */ |
244 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/characteristic/attribute/standard/subparts', [] ); |
|
244 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/characteristic/attribute/standard/subparts', []); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
252 | 252 | * @param string[] $data Data array |
253 | 253 | */ |
254 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
254 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
255 | 255 | { |
256 | - $listManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
256 | + $listManager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
257 | 257 | |
258 | - $listItem = $listManager->createItem()->setType( 'default' ); |
|
259 | - $listItems = $item->getListItems( 'attribute', 'default', null, false ); |
|
258 | + $listItem = $listManager->createItem()->setType('default'); |
|
259 | + $listItems = $item->getListItems('attribute', 'default', null, false); |
|
260 | 260 | |
261 | - foreach( $this->getValue( $data, 'product.lists.id', [] ) as $idx => $id ) |
|
261 | + foreach ($this->getValue($data, 'product.lists.id', []) as $idx => $id) |
|
262 | 262 | { |
263 | - if( isset( $listItems[$id] ) ) { |
|
264 | - $litem = $listItems[$id]; unset( $listItems[$id] ); |
|
263 | + if (isset($listItems[$id])) { |
|
264 | + $litem = $listItems[$id]; unset($listItems[$id]); |
|
265 | 265 | } else { |
266 | 266 | $litem = clone $listItem; |
267 | 267 | } |
268 | 268 | |
269 | - $litem->setId( $id ); |
|
270 | - $litem->setPosition( $idx ); |
|
271 | - $litem->setRefId( $this->getValue( $data, 'product.lists.refid/' . $idx ) ); |
|
269 | + $litem->setId($id); |
|
270 | + $litem->setPosition($idx); |
|
271 | + $litem->setRefId($this->getValue($data, 'product.lists.refid/' . $idx)); |
|
272 | 272 | |
273 | - $item->addListItem( 'attribute', $litem, $litem->getRefItem() ); |
|
273 | + $item->addListItem('attribute', $litem, $litem->getRefItem()); |
|
274 | 274 | } |
275 | 275 | |
276 | - return $item->deleteListItems( $listItems ); |
|
276 | + return $item->deleteListItems($listItems); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -284,26 +284,26 @@ discard block |
||
284 | 284 | * @param boolean $copy True if items should be copied, false if not |
285 | 285 | * @return string[] Multi-dimensional associative list of item data |
286 | 286 | */ |
287 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
287 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
288 | 288 | { |
289 | 289 | $data = []; |
290 | 290 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
291 | 291 | |
292 | - foreach( $item->getListItems( 'attribute', 'default', null, false ) as $listItem ) |
|
292 | + foreach ($item->getListItems('attribute', 'default', null, false) as $listItem) |
|
293 | 293 | { |
294 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
294 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | |
298 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
298 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
299 | 299 | |
300 | - if( $copy === true ) |
|
300 | + if ($copy === true) |
|
301 | 301 | { |
302 | 302 | $list['product.lists.siteid'] = $siteId; |
303 | 303 | $list['product.lists.id'] = ''; |
304 | 304 | } |
305 | 305 | |
306 | - foreach( $list as $key => $value ) { |
|
306 | + foreach ($list as $key => $value) { |
|
307 | 307 | $data[$key][] = $value; |
308 | 308 | } |
309 | 309 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
319 | 319 | * @return string HTML output |
320 | 320 | */ |
321 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
321 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
322 | 322 | { |
323 | 323 | /** admin/jqadm/product/characteristic/attribute/template-item |
324 | 324 | * Relative path to the HTML body template of the attribute characteristic subpart for products. |
@@ -342,6 +342,6 @@ discard block |
||
342 | 342 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
343 | 343 | $default = 'product/item-characteristic-attribute-standard'; |
344 | 344 | |
345 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
345 | + return $view->render($view->config($tplconf, $default)); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | { |
43 | 43 | $view = $this->getView(); |
44 | 44 | |
45 | - $view->variantData = $this->toArray( $view->item, true ); |
|
45 | + $view->variantData = $this->toArray($view->item, true); |
|
46 | 46 | $view->variantBody = ''; |
47 | 47 | |
48 | - foreach( $this->getSubClients() as $client ) { |
|
48 | + foreach ($this->getSubClients() as $client) { |
|
49 | 49 | $view->variantBody .= $client->copy(); |
50 | 50 | } |
51 | 51 | |
52 | - return $this->render( $view ); |
|
52 | + return $this->render($view); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | { |
63 | 63 | $view = $this->getView(); |
64 | 64 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
65 | - $data = $view->param( 'characteristic/variant', [] ); |
|
65 | + $data = $view->param('characteristic/variant', []); |
|
66 | 66 | |
67 | - foreach( $view->value( $data, 'product.lists.id', [] ) as $idx => $value ) { |
|
67 | + foreach ($view->value($data, 'product.lists.id', []) as $idx => $value) { |
|
68 | 68 | $data['product.lists.siteid'][$idx] = $siteid; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $view->variantData = $data; |
72 | 72 | $view->variantBody = ''; |
73 | 73 | |
74 | - foreach( $this->getSubClients() as $client ) { |
|
74 | + foreach ($this->getSubClients() as $client) { |
|
75 | 75 | $view->variantBody .= $client->create(); |
76 | 76 | } |
77 | 77 | |
78 | - return $this->render( $view ); |
|
78 | + return $this->render($view); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | { |
89 | 89 | $view = $this->getView(); |
90 | 90 | |
91 | - $view->variantData = $this->toArray( $view->item ); |
|
91 | + $view->variantData = $this->toArray($view->item); |
|
92 | 92 | $view->variantBody = ''; |
93 | 93 | |
94 | - foreach( $this->getSubClients() as $client ) { |
|
94 | + foreach ($this->getSubClients() as $client) { |
|
95 | 95 | $view->variantBody .= $client->get(); |
96 | 96 | } |
97 | 97 | |
98 | - return $this->render( $view ); |
|
98 | + return $this->render($view); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | { |
107 | 107 | $view = $this->getView(); |
108 | 108 | |
109 | - $this->fromArray( $view->item, $view->param( 'characteristic/variant', [] ) ); |
|
109 | + $this->fromArray($view->item, $view->param('characteristic/variant', [])); |
|
110 | 110 | $view->variantBody = ''; |
111 | 111 | |
112 | - foreach( $this->getSubClients() as $client ) { |
|
112 | + foreach ($this->getSubClients() as $client) { |
|
113 | 113 | $view->variantBody .= $client->save(); |
114 | 114 | } |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string|null $name Name of the sub-client (Default if null) |
123 | 123 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
124 | 124 | */ |
125 | - public function getSubClient( $type, $name = null ) |
|
125 | + public function getSubClient($type, $name = null) |
|
126 | 126 | { |
127 | 127 | /** admin/jqadm/product/characteristic/variant/decorators/excludes |
128 | 128 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @see admin/jqadm/product/characteristic/variant/decorators/excludes |
198 | 198 | * @see admin/jqadm/product/characteristic/variant/decorators/global |
199 | 199 | */ |
200 | - return $this->createSubClient( 'product/characteristic/variant/' . $type, $name ); |
|
200 | + return $this->createSubClient('product/characteristic/variant/' . $type, $name); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @since 2016.01 |
242 | 242 | * @category Developer |
243 | 243 | */ |
244 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/characteristic/variant/standard/subparts', [] ); |
|
244 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/characteristic/variant/standard/subparts', []); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
252 | 252 | * @param string[] $data Data array |
253 | 253 | */ |
254 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
254 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
255 | 255 | { |
256 | - $listManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
256 | + $listManager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
257 | 257 | |
258 | - $listItem = $listManager->createItem()->setType( 'variant' ); |
|
259 | - $listItems = $item->getListItems( 'attribute', 'variant', null, false ); |
|
258 | + $listItem = $listManager->createItem()->setType('variant'); |
|
259 | + $listItems = $item->getListItems('attribute', 'variant', null, false); |
|
260 | 260 | |
261 | - foreach( $this->getValue( $data, 'product.lists.id', [] ) as $idx => $id ) |
|
261 | + foreach ($this->getValue($data, 'product.lists.id', []) as $idx => $id) |
|
262 | 262 | { |
263 | - if( isset( $listItems[$id] ) ) { |
|
264 | - $litem = $listItems[$id]; unset( $listItems[$id] ); |
|
263 | + if (isset($listItems[$id])) { |
|
264 | + $litem = $listItems[$id]; unset($listItems[$id]); |
|
265 | 265 | } else { |
266 | 266 | $litem = clone $listItem; |
267 | 267 | } |
268 | 268 | |
269 | - $litem->setId( $id ); |
|
270 | - $litem->setPosition( $idx ); |
|
271 | - $litem->setRefId( $this->getValue( $data, 'product.lists.refid/' . $idx ) ); |
|
269 | + $litem->setId($id); |
|
270 | + $litem->setPosition($idx); |
|
271 | + $litem->setRefId($this->getValue($data, 'product.lists.refid/' . $idx)); |
|
272 | 272 | |
273 | - $item->addListItem( 'attribute', $litem, $litem->getRefItem() ); |
|
273 | + $item->addListItem('attribute', $litem, $litem->getRefItem()); |
|
274 | 274 | } |
275 | 275 | |
276 | - return $item->deleteListItems( $listItems ); |
|
276 | + return $item->deleteListItems($listItems); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -284,26 +284,26 @@ discard block |
||
284 | 284 | * @param boolean $copy True if items should be copied, false if not |
285 | 285 | * @return string[] Multi-dimensional associative list of item data |
286 | 286 | */ |
287 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
287 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
288 | 288 | { |
289 | 289 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
290 | 290 | $data = []; |
291 | 291 | |
292 | - foreach( $item->getListItems( 'attribute', 'variant', null, false ) as $listItem ) |
|
292 | + foreach ($item->getListItems('attribute', 'variant', null, false) as $listItem) |
|
293 | 293 | { |
294 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
294 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | |
298 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
298 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
299 | 299 | |
300 | - if( $copy === true ) |
|
300 | + if ($copy === true) |
|
301 | 301 | { |
302 | 302 | $list['product.lists.siteid'] = $siteId; |
303 | 303 | $list['product.lists.id'] = ''; |
304 | 304 | } |
305 | 305 | |
306 | - foreach( $list as $key => $value ) { |
|
306 | + foreach ($list as $key => $value) { |
|
307 | 307 | $data[$key][] = $value; |
308 | 308 | } |
309 | 309 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
319 | 319 | * @return string HTML output |
320 | 320 | */ |
321 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
321 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
322 | 322 | { |
323 | 323 | /** admin/jqadm/product/characteristic/variant/template-item |
324 | 324 | * Relative path to the HTML body template of the variant characteristic subpart for products. |
@@ -342,6 +342,6 @@ discard block |
||
342 | 342 | $tplconf = 'admin/jqadm/product/characteristic/variant/template-item'; |
343 | 343 | $default = 'product/item-characteristic-variant-standard'; |
344 | 344 | |
345 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
345 | + return $view->render($view->config($tplconf, $default)); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | { |
29 | 29 | $result = $this->getClient()->delete(); |
30 | 30 | |
31 | - $ids = (array) $this->getView()->param( 'id' ); |
|
32 | - \Aimeos\MShop::create( $this->getContext(), 'index' )->deleteItems( $ids ); |
|
31 | + $ids = (array) $this->getView()->param('id'); |
|
32 | + \Aimeos\MShop::create($this->getContext(), 'index')->deleteItems($ids); |
|
33 | 33 | |
34 | 34 | return $result; |
35 | 35 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $result = $this->getClient()->save(); |
46 | 46 | $item = $this->getView()->item; |
47 | 47 | |
48 | - if( $item->getId() !== null ) { |
|
49 | - \Aimeos\MShop::create( $this->getContext(), 'index' )->saveItem( $item ); |
|
48 | + if ($item->getId() !== null) { |
|
49 | + \Aimeos\MShop::create($this->getContext(), 'index')->saveItem($item); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $result; |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | $view = $this->getView(); |
44 | 44 | $view->orderBody = ''; |
45 | 45 | |
46 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/currency' ); |
|
47 | - $view->orderCurrencyItems = $manager->searchItems( $manager->createSearch( true ) ); |
|
46 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/currency'); |
|
47 | + $view->orderCurrencyItems = $manager->searchItems($manager->createSearch(true)); |
|
48 | 48 | |
49 | - foreach( $this->getSubClients() as $client ) { |
|
49 | + foreach ($this->getSubClients() as $client) { |
|
50 | 50 | $view->orderBody .= $client->search(); |
51 | 51 | } |
52 | 52 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $tplconf = 'admin/jqadm/dashboard/order/template-list'; |
73 | 73 | $default = 'dashboard/list-order-standard'; |
74 | 74 | |
75 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
75 | + return $view->render($view->config($tplconf, $default)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string|null $name Name of the sub-client (Default if null) |
84 | 84 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
85 | 85 | */ |
86 | - public function getSubClient( $type, $name = null ) |
|
86 | + public function getSubClient($type, $name = null) |
|
87 | 87 | { |
88 | 88 | /** admin/jqadm/dashboard/order/decorators/excludes |
89 | 89 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see admin/jqadm/dashboard/order/decorators/excludes |
159 | 159 | * @see admin/jqadm/dashboard/order/decorators/global |
160 | 160 | */ |
161 | - return $this->createSubClient( 'dashboard/order/' . $type, $name ); |
|
161 | + return $this->createSubClient('dashboard/order/' . $type, $name); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -202,6 +202,6 @@ discard block |
||
202 | 202 | * @since 2018.01 |
203 | 203 | * @category Developer |
204 | 204 | */ |
205 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/order/standard/subparts', [] ); |
|
205 | + return $this->getContext()->getConfig()->get('admin/jqadm/dashboard/order/standard/subparts', []); |
|
206 | 206 | } |
207 | 207 | } |
@@ -126,12 +126,19 @@ |
||
126 | 126 | return self::addDecorators( $context, $client, $decorators, $classprefix ); |
127 | 127 | } |
128 | 128 | |
129 | + /** |
|
130 | + * @param string $path |
|
131 | + */ |
|
129 | 132 | public static function addClientDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
130 | 133 | \Aimeos\Admin\JQAdm\Iface $client, $path ) |
131 | 134 | { |
132 | 135 | return self::addClientDecorators( $context, $client, $path ); |
133 | 136 | } |
134 | 137 | |
138 | + /** |
|
139 | + * @param string $classname |
|
140 | + * @param string $interface |
|
141 | + */ |
|
135 | 142 | public static function createAdminPublic( \Aimeos\MShop\Context\Item\Iface $context, |
136 | 143 | $classname, $interface ) |
137 | 144 | { |
@@ -17,102 +17,102 @@ discard block |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | |
22 | 22 | $config = $this->context->getConfig(); |
23 | - $config->set( 'admin/jqadm/common/decorators/default', [] ); |
|
24 | - $config->set( 'admin/jqadm/product/decorators/global', [] ); |
|
25 | - $config->set( 'admin/jqadm/product/decorators/local', [] ); |
|
23 | + $config->set('admin/jqadm/common/decorators/default', []); |
|
24 | + $config->set('admin/jqadm/product/decorators/global', []); |
|
25 | + $config->set('admin/jqadm/product/decorators/local', []); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testInjectClient() |
31 | 31 | { |
32 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
33 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client ); |
|
32 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
33 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client); |
|
34 | 34 | |
35 | - $iClient = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
35 | + $iClient = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
36 | 36 | |
37 | - $this->assertSame( $client, $iClient ); |
|
37 | + $this->assertSame($client, $iClient); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | public function testInjectClientReset() |
42 | 42 | { |
43 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
44 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client ); |
|
45 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', null ); |
|
43 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
44 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client); |
|
45 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', null); |
|
46 | 46 | |
47 | - $new = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
47 | + $new = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
48 | 48 | |
49 | - $this->assertNotSame( $client, $new ); |
|
49 | + $this->assertNotSame($client, $new); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testAddDecorators() |
54 | 54 | { |
55 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
55 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
56 | 56 | |
57 | - $result = \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, |
|
58 | - [], array( 'Cache' ), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\' ); |
|
57 | + $result = \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, |
|
58 | + [], array('Cache'), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'); |
|
59 | 59 | |
60 | - $this->assertInstanceOf( \Aimeos\Admin\JQAdm\Iface::class, $result ); |
|
60 | + $this->assertInstanceOf(\Aimeos\Admin\JQAdm\Iface::class, $result); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testAddDecoratorsInvalidName() |
65 | 65 | { |
66 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
66 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
67 | 67 | |
68 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
69 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, ['$'], 'Test' ); |
|
68 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
69 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, ['$'], 'Test'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testAddDecoratorsInvalidClass() |
74 | 74 | { |
75 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
75 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
76 | 76 | |
77 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
78 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, |
|
79 | - array( 'Test' ), 'TestDecorator' ); |
|
77 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
78 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, |
|
79 | + array('Test'), 'TestDecorator'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testAddDecoratorsInvalidInterface() |
84 | 84 | { |
85 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
85 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
86 | 86 | |
87 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
88 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, |
|
89 | - array( 'Test' ), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\' ); |
|
87 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
88 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, |
|
89 | + array('Test'), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | 93 | public function testAddClientDecoratorsExcludes() |
94 | 94 | { |
95 | - $this->context->getConfig()->set( 'admin/jqadm/decorators/excludes', array( 'TestDecorator' ) ); |
|
96 | - $this->context->getConfig()->set( 'admin/jqadm/common/decorators/default', array( 'TestDecorator' ) ); |
|
95 | + $this->context->getConfig()->set('admin/jqadm/decorators/excludes', array('TestDecorator')); |
|
96 | + $this->context->getConfig()->set('admin/jqadm/common/decorators/default', array('TestDecorator')); |
|
97 | 97 | |
98 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
99 | - \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
98 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
99 | + \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | 103 | public function testAddClientDecoratorsEmptyPath() |
104 | 104 | { |
105 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::create( $this->context, 'Standard' ); |
|
105 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::create($this->context, 'Standard'); |
|
106 | 106 | |
107 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
108 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addClientDecoratorsPublic( $this->context, $client, '' ); |
|
107 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
108 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addClientDecoratorsPublic($this->context, $client, ''); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | 112 | public function testCreateClientBase() |
113 | 113 | { |
114 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
115 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::createAdminPublic( $this->context, 'Test', 'Test' ); |
|
114 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
115 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::createAdminPublic($this->context, 'Test', 'Test'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | class TestAbstract |
121 | 121 | extends \Aimeos\Admin\JQAdm\Common\Factory\Base |
122 | 122 | { |
123 | - public static function addDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
124 | - \Aimeos\Admin\JQAdm\Iface $client, array $decorators, $classprefix ) |
|
123 | + public static function addDecoratorsPublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
124 | + \Aimeos\Admin\JQAdm\Iface $client, array $decorators, $classprefix) |
|
125 | 125 | { |
126 | - return self::addDecorators( $context, $client, $decorators, $classprefix ); |
|
126 | + return self::addDecorators($context, $client, $decorators, $classprefix); |
|
127 | 127 | } |
128 | 128 | |
129 | - public static function addClientDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
130 | - \Aimeos\Admin\JQAdm\Iface $client, $path ) |
|
129 | + public static function addClientDecoratorsPublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
130 | + \Aimeos\Admin\JQAdm\Iface $client, $path) |
|
131 | 131 | { |
132 | - return self::addClientDecorators( $context, $client, $path ); |
|
132 | + return self::addClientDecorators($context, $client, $path); |
|
133 | 133 | } |
134 | 134 | |
135 | - public static function createAdminPublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
136 | - $classname, $interface ) |
|
135 | + public static function createAdminPublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
136 | + $classname, $interface) |
|
137 | 137 | { |
138 | - return self::createAdmin( $context, $classname, $interface ); |
|
138 | + return self::createAdmin($context, $classname, $interface); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -36,48 +36,48 @@ discard block |
||
36 | 36 | |
37 | 37 | <td class="property-type"> |
38 | 38 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
39 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'media', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
40 | - <select class="form-control custom-select item-type" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
41 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'media', 'idx', 'property', 'propidx', 'media.property.type' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
39 | + v-bind:name="'<?= $enc->attr($this->formparam(array('media', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
40 | + <select class="form-control custom-select item-type" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
41 | + v-bind:name="'<?= $enc->attr($this->formparam(array('media', 'idx', 'property', 'propidx', 'media.property.type'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
42 | 42 | v-bind:readonly="checkSite('media.siteid', idx)" |
43 | 43 | v-model="items[idx]['property'][propidx]['media.property.type']" > |
44 | 44 | |
45 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
46 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.type'] == '<?= $enc->attr( $id ) ?>'" > |
|
47 | - <?= $enc->html( $item->getLabel() ); ?> |
|
45 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
46 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.type'] == '<?= $enc->attr($id) ?>'" > |
|
47 | + <?= $enc->html($item->getLabel()); ?> |
|
48 | 48 | </option> |
49 | 49 | <?php endforeach; ?> |
50 | 50 | |
51 | 51 | </select> |
52 | 52 | </td> |
53 | 53 | <td class="property-language"> |
54 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
55 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'media', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
54 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
55 | + v-bind:name="'<?= $enc->attr($this->formparam(array('media', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
56 | 56 | v-bind:readonly="checkSite('media.siteid', idx)" |
57 | 57 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
58 | 58 | |
59 | 59 | <option v-bind:value="null"> |
60 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
60 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
61 | 61 | </option> |
62 | 62 | |
63 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
64 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
65 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
63 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
64 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
65 | + <?= $enc->html($langItem->getLabel()); ?> |
|
66 | 66 | </option> |
67 | 67 | <?php endforeach; ?> |
68 | 68 | </select> |
69 | 69 | </td> |
70 | 70 | <td class="property-value"> |
71 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
72 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'media', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
73 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
71 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
72 | + v-bind:name="'<?= $enc->attr($this->formparam(array('media', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
73 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
74 | 74 | v-bind:readonly="checkSite('media.siteid', idx)" |
75 | 75 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
76 | 76 | </td> |
77 | 77 | |
78 | 78 | <td class="actions"> |
79 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
80 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
79 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
80 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
81 | 81 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
82 | 82 | </div> |
83 | 83 | </td> |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | </tbody> |
87 | 87 | </table> |
88 | 88 | |
89 | - <?= $this->get( 'propertyBody' ); ?> |
|
89 | + <?= $this->get('propertyBody'); ?> |
|
90 | 90 | |
91 | 91 | </div> |
@@ -19,52 +19,52 @@ |
||
19 | 19 | { |
20 | 20 | $this->aimeos = \TestHelperJqadm::getAimeos(); |
21 | 21 | $this->context = \TestHelperJqadm::getContext(); |
22 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
22 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testCreateClient() |
27 | 27 | { |
28 | - $this->context->getConfig()->set( 'admin/jqadm/resources', ['product'] ); |
|
29 | - $client = \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, 'product' ); |
|
30 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
28 | + $this->context->getConfig()->set('admin/jqadm/resources', ['product']); |
|
29 | + $client = \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, 'product'); |
|
30 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | public function testCreateClientName() |
35 | 35 | { |
36 | - $this->context->getConfig()->set( 'admin/jqadm/resources', ['product'] ); |
|
37 | - $client = \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, 'product', 'Standard' ); |
|
38 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
36 | + $this->context->getConfig()->set('admin/jqadm/resources', ['product']); |
|
37 | + $client = \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, 'product', 'Standard'); |
|
38 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testCreateSubClient() |
43 | 43 | { |
44 | - $this->context->getConfig()->set( 'admin/jqadm/resources', ['locale/site'] ); |
|
45 | - $client = \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, 'locale/site' ); |
|
46 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
44 | + $this->context->getConfig()->set('admin/jqadm/resources', ['locale/site']); |
|
45 | + $client = \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, 'locale/site'); |
|
46 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testCreateClientNameEmpty() |
51 | 51 | { |
52 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
53 | - \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, '' ); |
|
52 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
53 | + \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, ''); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testCreateClientNameInvalid() |
58 | 58 | { |
59 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
60 | - \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, '%product' ); |
|
59 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
60 | + \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, '%product'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testCreateClientNameNotFound() |
65 | 65 | { |
66 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
67 | - \Aimeos\Admin\JQAdm\Factory::create( $this->context, $this->aimeos, 'unknown' ); |
|
66 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
67 | + \Aimeos\Admin\JQAdm\Factory::create($this->context, $this->aimeos, 'unknown'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | } |
@@ -16,42 +16,42 @@ |
||
16 | 16 | protected function setUp() |
17 | 17 | { |
18 | 18 | $this->context = \TestHelperJqadm::getContext(); |
19 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
19 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | public function testCreateClient() |
24 | 24 | { |
25 | - $client = \Aimeos\Admin\JQAdm\Catalog\Factory::create( $this->context ); |
|
26 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
25 | + $client = \Aimeos\Admin\JQAdm\Catalog\Factory::create($this->context); |
|
26 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testCreateClientName() |
31 | 31 | { |
32 | - $client = \Aimeos\Admin\JQAdm\Catalog\Factory::create( $this->context, 'Standard' ); |
|
33 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
32 | + $client = \Aimeos\Admin\JQAdm\Catalog\Factory::create($this->context, 'Standard'); |
|
33 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreateClientNameEmpty() |
38 | 38 | { |
39 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
40 | - \Aimeos\Admin\JQAdm\Catalog\Factory::create( $this->context, '' ); |
|
39 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
40 | + \Aimeos\Admin\JQAdm\Catalog\Factory::create($this->context, ''); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCreateClientNameInvalid() |
45 | 45 | { |
46 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
47 | - \Aimeos\Admin\JQAdm\Catalog\Factory::create( $this->context, '%catalog' ); |
|
46 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
47 | + \Aimeos\Admin\JQAdm\Catalog\Factory::create($this->context, '%catalog'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testCreateClientNameNotFound() |
52 | 52 | { |
53 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
54 | - \Aimeos\Admin\JQAdm\Catalog\Factory::create( $this->context, 'test' ); |
|
53 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
54 | + \Aimeos\Admin\JQAdm\Catalog\Factory::create($this->context, 'test'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | } |
@@ -21,70 +21,70 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'item-media', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('item-media', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( '"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testDelete() |
62 | 62 | { |
63 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
63 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
64 | 64 | |
65 | 65 | $this->view->item = $manager->createItem(); |
66 | 66 | $result = $this->object->delete(); |
67 | 67 | |
68 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
69 | - $this->assertNull( $result ); |
|
68 | + $this->assertNull($this->view->get('errors')); |
|
69 | + $this->assertNull($result); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testGet() |
74 | 74 | { |
75 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
75 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
76 | 76 | |
77 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
77 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
78 | 78 | $result = $this->object->get(); |
79 | 79 | |
80 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
81 | - $this->assertContains( '"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result ); |
|
80 | + $this->assertNull($this->view->get('errors')); |
|
81 | + $this->assertContains('"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSave() |
86 | 86 | { |
87 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
87 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
88 | 88 | $this->view->item = $manager->createItem(); |
89 | 89 | |
90 | 90 | $param = array( |
@@ -98,108 +98,108 @@ discard block |
||
98 | 98 | ]], |
99 | 99 | ); |
100 | 100 | |
101 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
102 | - $this->view->addHelper( 'param', $helper ); |
|
101 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
102 | + $this->view->addHelper('param', $helper); |
|
103 | 103 | |
104 | - $file = $this->getMockBuilder( \Psr\Http\Message\UploadedFileInterface::class )->getMock(); |
|
105 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
106 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
107 | - ->will( $this->returnValue( ['media' => [0 => ['file' => $file] ] ] ) ); |
|
104 | + $file = $this->getMockBuilder(\Psr\Http\Message\UploadedFileInterface::class)->getMock(); |
|
105 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
106 | + $request->expects($this->any())->method('getUploadedFiles') |
|
107 | + ->will($this->returnValue(['media' => [0 => ['file' => $file]]])); |
|
108 | 108 | |
109 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
110 | - $this->view ->addHelper( 'request', $helper ); |
|
109 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
110 | + $this->view ->addHelper('request', $helper); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | $name = 'AdminJQAdmCatalogMediaSave'; |
114 | - $this->context->getConfig()->set( 'controller/common/media/name', $name ); |
|
114 | + $this->context->getConfig()->set('controller/common/media/name', $name); |
|
115 | 115 | |
116 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
117 | - ->setConstructorArgs( array( $this->context ) ) |
|
118 | - ->setMethods( array( 'add' ) ) |
|
116 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
117 | + ->setConstructorArgs(array($this->context)) |
|
118 | + ->setMethods(array('add')) |
|
119 | 119 | ->getMock(); |
120 | 120 | |
121 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
121 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
122 | 122 | |
123 | - $cntlStub->expects( $this->once() )->method( 'add' ); |
|
123 | + $cntlStub->expects($this->once())->method('add'); |
|
124 | 124 | |
125 | 125 | |
126 | 126 | $result = $this->object->save(); |
127 | 127 | |
128 | 128 | |
129 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
130 | - $this->assertNull( $result ); |
|
131 | - $this->assertEquals( 1, count( $this->view->item->getListItems() ) ); |
|
129 | + $this->assertNull($this->view->get('errors')); |
|
130 | + $this->assertNull($result); |
|
131 | + $this->assertEquals(1, count($this->view->item->getListItems())); |
|
132 | 132 | |
133 | - foreach( $this->view->item->getListItems( 'media' ) as $listItem ) |
|
133 | + foreach ($this->view->item->getListItems('media') as $listItem) |
|
134 | 134 | { |
135 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
135 | + $this->assertEquals('media', $listItem->getDomain()); |
|
136 | 136 | |
137 | 137 | $refItem = $listItem->getRefItem(); |
138 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
139 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
138 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
139 | + $this->assertEquals('test', $refItem->getLabel()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, ['site' => 'unittest', 'media' => []] ); |
|
144 | - $this->view->addHelper( 'param', $helper ); |
|
143 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, ['site' => 'unittest', 'media' => []]); |
|
144 | + $this->view->addHelper('param', $helper); |
|
145 | 145 | |
146 | 146 | $result = $this->object->save(); |
147 | 147 | |
148 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
149 | - $this->assertNull( $result ); |
|
150 | - $this->assertEquals( 0, count( $this->view->item->getListItems() ) ); |
|
148 | + $this->assertNull($this->view->get('errors')); |
|
149 | + $this->assertNull($result); |
|
150 | + $this->assertEquals(0, count($this->view->item->getListItems())); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testSaveException() |
155 | 155 | { |
156 | - $object = $this->getClientMock( 'fromArray' ); |
|
156 | + $object = $this->getClientMock('fromArray'); |
|
157 | 157 | |
158 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
159 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
158 | + $object->expects($this->once())->method('fromArray') |
|
159 | + ->will($this->throwException(new \RuntimeException())); |
|
160 | 160 | |
161 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
161 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
162 | 162 | $object->save(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | public function testSaveMShopException() |
167 | 167 | { |
168 | - $object = $this->getClientMock( 'fromArray' ); |
|
168 | + $object = $this->getClientMock('fromArray'); |
|
169 | 169 | |
170 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
171 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
170 | + $object->expects($this->once())->method('fromArray') |
|
171 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
172 | 172 | |
173 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
173 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
174 | 174 | $object->save(); |
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testSearch() |
179 | 179 | { |
180 | - $this->assertNull( $this->object->search() ); |
|
180 | + $this->assertNull($this->object->search()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testGetSubClient() |
185 | 185 | { |
186 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
187 | - $this->object->getSubClient( 'unknown' ); |
|
186 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
187 | + $this->object->getSubClient('unknown'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | - public function getClientMock( $method ) |
|
191 | + public function getClientMock($method) |
|
192 | 192 | { |
193 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Catalog\Media\Standard::class ) |
|
194 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
195 | - ->setMethods( [$method] ) |
|
193 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Catalog\Media\Standard::class) |
|
194 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
195 | + ->setMethods([$method]) |
|
196 | 196 | ->getMock(); |
197 | 197 | |
198 | 198 | $view = \TestHelperJqadm::getView(); |
199 | - $view->item = \Aimeos\MShop::create( $this->context, 'catalog' )->createItem(); |
|
199 | + $view->item = \Aimeos\MShop::create($this->context, 'catalog')->createItem(); |
|
200 | 200 | |
201 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
202 | - $object->setView( $view ); |
|
201 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
202 | + $object->setView($view); |
|
203 | 203 | |
204 | 204 | return $object; |
205 | 205 | } |