@@ -476,7 +476,7 @@ |
||
| 476 | 476 | /** |
| 477 | 477 | * Constructs the data array for the view from the given item |
| 478 | 478 | * |
| 479 | - * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
|
| 479 | + * @param \Aimeos\MShop\Locale\Item\Language\Iface $item Locale item object |
|
| 480 | 480 | * @return string[] Multi-dimensional associative list of item data |
| 481 | 481 | */ |
| 482 | 482 | protected function toArray( \Aimeos\MShop\Locale\Item\Language\Iface $item, $copy = false ) |
@@ -88,14 +88,12 @@ discard block |
||
| 88 | 88 | $view->tabindex = ++$idx + 1; |
| 89 | 89 | $view->itemBody .= $client->copy(); |
| 90 | 90 | } |
| 91 | - } |
|
| 92 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 91 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 93 | 92 | { |
| 94 | 93 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 95 | 94 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 96 | 95 | $this->logException( $e ); |
| 97 | - } |
|
| 98 | - catch( \Exception $e ) |
|
| 96 | + } catch( \Exception $e ) |
|
| 99 | 97 | { |
| 100 | 98 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 101 | 99 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -135,14 +133,12 @@ discard block |
||
| 135 | 133 | $view->tabindex = ++$idx + 1; |
| 136 | 134 | $view->itemBody .= $client->create(); |
| 137 | 135 | } |
| 138 | - } |
|
| 139 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 136 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 140 | 137 | { |
| 141 | 138 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 142 | 139 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 143 | 140 | $this->logException( $e ); |
| 144 | - } |
|
| 145 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 146 | 142 | { |
| 147 | 143 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 148 | 144 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -183,14 +179,12 @@ discard block |
||
| 183 | 179 | |
| 184 | 180 | $this->nextAction( $view, 'search', 'locale/language', null, 'delete' ); |
| 185 | 181 | return; |
| 186 | - } |
|
| 187 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 182 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 188 | 183 | { |
| 189 | 184 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 190 | 185 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 191 | 186 | $this->logException( $e ); |
| 192 | - } |
|
| 193 | - catch( \Exception $e ) |
|
| 187 | + } catch( \Exception $e ) |
|
| 194 | 188 | { |
| 195 | 189 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 196 | 190 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -231,14 +225,12 @@ discard block |
||
| 231 | 225 | $view->tabindex = ++$idx + 1; |
| 232 | 226 | $view->itemBody .= $client->get(); |
| 233 | 227 | } |
| 234 | - } |
|
| 235 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 228 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 236 | 229 | { |
| 237 | 230 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 238 | 231 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 239 | 232 | $this->logException( $e ); |
| 240 | - } |
|
| 241 | - catch( \Exception $e ) |
|
| 233 | + } catch( \Exception $e ) |
|
| 242 | 234 | { |
| 243 | 235 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 244 | 236 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -275,18 +267,15 @@ discard block |
||
| 275 | 267 | |
| 276 | 268 | $this->nextAction( $view, $view->param( 'next' ), 'locale/language', strtoupper( $view->item->getId() ), 'save' ); |
| 277 | 269 | return; |
| 278 | - } |
|
| 279 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 270 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 280 | 271 | { |
| 281 | 272 | // fall through to create |
| 282 | - } |
|
| 283 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 273 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 284 | 274 | { |
| 285 | 275 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 286 | 276 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 287 | 277 | $this->logException( $e ); |
| 288 | - } |
|
| 289 | - catch( \Exception $e ) |
|
| 278 | + } catch( \Exception $e ) |
|
| 290 | 279 | { |
| 291 | 280 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 292 | 281 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -328,14 +317,12 @@ discard block |
||
| 328 | 317 | foreach( $this->getSubClients() as $client ) { |
| 329 | 318 | $view->itemBody .= $client->search(); |
| 330 | 319 | } |
| 331 | - } |
|
| 332 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 320 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 333 | 321 | { |
| 334 | 322 | $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 335 | 323 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 336 | 324 | $this->logException( $e ); |
| 337 | - } |
|
| 338 | - catch( \Exception $e ) |
|
| 325 | + } catch( \Exception $e ) |
|
| 339 | 326 | { |
| 340 | 327 | $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 341 | 328 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Aimeos\Admin\JQAdm\Locale\Language; |
| 12 | 12 | |
| 13 | -sprintf( 'locale/language' ); // for translation |
|
| 13 | +sprintf('locale/language'); // for translation |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | try |
| 37 | 37 | { |
| 38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 38 | + if (($id = $view->param('id')) === null) { |
|
| 39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 43 | - $view->item = $manager->getItem( $id ); |
|
| 42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 43 | + $view->item = $manager->getItem($id); |
|
| 44 | 44 | |
| 45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
| 45 | + $view->itemData = $this->toArray($view->item, true); |
|
| 46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
| 47 | 47 | $view->itemBody = ''; |
| 48 | 48 | |
| 49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 49 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 50 | 50 | { |
| 51 | 51 | $view->tabindex = ++$idx + 1; |
| 52 | 52 | $view->itemBody .= $client->copy(); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 55 | + catch (\Aimeos\MShop\Exception $e) |
|
| 56 | 56 | { |
| 57 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 59 | - $this->logException( $e ); |
|
| 57 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 58 | + $view->errors = $view->get('errors', []) + $error; |
|
| 59 | + $this->logException($e); |
|
| 60 | 60 | } |
| 61 | - catch( \Exception $e ) |
|
| 61 | + catch (\Exception $e) |
|
| 62 | 62 | { |
| 63 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 65 | - $this->logException( $e ); |
|
| 63 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 64 | + $view->errors = $view->get('errors', []) + $error; |
|
| 65 | + $this->logException($e); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return $this->render( $view ); |
|
| 68 | + return $this->render($view); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -81,36 +81,36 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | try |
| 83 | 83 | { |
| 84 | - $data = $view->param( 'item', [] ); |
|
| 84 | + $data = $view->param('item', []); |
|
| 85 | 85 | |
| 86 | - if( !isset( $view->item ) ) { |
|
| 87 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' )->createItem(); |
|
| 86 | + if (!isset($view->item)) { |
|
| 87 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'locale/language')->createItem(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $view->itemSubparts = $this->getSubClientNames(); |
| 91 | 91 | $view->itemData = $data; |
| 92 | 92 | $view->itemBody = ''; |
| 93 | 93 | |
| 94 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 94 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 95 | 95 | { |
| 96 | 96 | $view->tabindex = ++$idx + 1; |
| 97 | 97 | $view->itemBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 100 | + catch (\Aimeos\MShop\Exception $e) |
|
| 101 | 101 | { |
| 102 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 103 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 104 | - $this->logException( $e ); |
|
| 102 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 103 | + $view->errors = $view->get('errors', []) + $error; |
|
| 104 | + $this->logException($e); |
|
| 105 | 105 | } |
| 106 | - catch( \Exception $e ) |
|
| 106 | + catch (\Exception $e) |
|
| 107 | 107 | { |
| 108 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 109 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 110 | - $this->logException( $e ); |
|
| 108 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 109 | + $view->errors = $view->get('errors', []) + $error; |
|
| 110 | + $this->logException($e); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - return $this->render( $view ); |
|
| 113 | + return $this->render($view); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -124,38 +124,38 @@ discard block |
||
| 124 | 124 | $view = $this->getView(); |
| 125 | 125 | $context = $this->getContext(); |
| 126 | 126 | |
| 127 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 127 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 128 | 128 | $manager->begin(); |
| 129 | 129 | |
| 130 | 130 | try |
| 131 | 131 | { |
| 132 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 133 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 132 | + if (($id = $view->param('id')) === null) { |
|
| 133 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $view->item = $manager->getItem( $id ); |
|
| 136 | + $view->item = $manager->getItem($id); |
|
| 137 | 137 | |
| 138 | - foreach( $this->getSubClients() as $client ) { |
|
| 138 | + foreach ($this->getSubClients() as $client) { |
|
| 139 | 139 | $client->delete(); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $manager->deleteItem( $id ); |
|
| 142 | + $manager->deleteItem($id); |
|
| 143 | 143 | $manager->commit(); |
| 144 | 144 | |
| 145 | - $this->nextAction( $view, 'search', 'locale/language', null, 'delete' ); |
|
| 145 | + $this->nextAction($view, 'search', 'locale/language', null, 'delete'); |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 148 | + catch (\Aimeos\MShop\Exception $e) |
|
| 149 | 149 | { |
| 150 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 151 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 152 | - $this->logException( $e ); |
|
| 150 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 151 | + $view->errors = $view->get('errors', []) + $error; |
|
| 152 | + $this->logException($e); |
|
| 153 | 153 | } |
| 154 | - catch( \Exception $e ) |
|
| 154 | + catch (\Exception $e) |
|
| 155 | 155 | { |
| 156 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 157 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 158 | - $this->logException( $e ); |
|
| 156 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 157 | + $view->errors = $view->get('errors', []) + $error; |
|
| 158 | + $this->logException($e); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $manager->rollback(); |
@@ -176,37 +176,37 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 180 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 179 | + if (($id = $view->param('id')) === null) { |
|
| 180 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 183 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 184 | 184 | |
| 185 | - $view->item = $manager->getItem( $id ); |
|
| 185 | + $view->item = $manager->getItem($id); |
|
| 186 | 186 | $view->itemSubparts = $this->getSubClientNames(); |
| 187 | - $view->itemData = $this->toArray( $view->item ); |
|
| 187 | + $view->itemData = $this->toArray($view->item); |
|
| 188 | 188 | $view->itemBody = ''; |
| 189 | 189 | |
| 190 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 190 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 191 | 191 | { |
| 192 | 192 | $view->tabindex = ++$idx + 1; |
| 193 | 193 | $view->itemBody .= $client->get(); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 196 | + catch (\Aimeos\MShop\Exception $e) |
|
| 197 | 197 | { |
| 198 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 199 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 200 | - $this->logException( $e ); |
|
| 198 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 199 | + $view->errors = $view->get('errors', []) + $error; |
|
| 200 | + $this->logException($e); |
|
| 201 | 201 | } |
| 202 | - catch( \Exception $e ) |
|
| 202 | + catch (\Exception $e) |
|
| 203 | 203 | { |
| 204 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 206 | - $this->logException( $e ); |
|
| 204 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 205 | + $view->errors = $view->get('errors', []) + $error; |
|
| 206 | + $this->logException($e); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return $this->render( $view ); |
|
| 209 | + return $this->render($view); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -220,40 +220,40 @@ discard block |
||
| 220 | 220 | $view = $this->getView(); |
| 221 | 221 | $context = $this->getContext(); |
| 222 | 222 | |
| 223 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 223 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 224 | 224 | $manager->begin(); |
| 225 | 225 | |
| 226 | 226 | try |
| 227 | 227 | { |
| 228 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
| 229 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
| 228 | + $item = $this->fromArray($view->param('item', [])); |
|
| 229 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
| 230 | 230 | $view->itemBody = ''; |
| 231 | 231 | |
| 232 | - foreach( $this->getSubClients() as $client ) { |
|
| 232 | + foreach ($this->getSubClients() as $client) { |
|
| 233 | 233 | $view->itemBody .= $client->save(); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $manager->saveItem( clone $view->item ); |
|
| 236 | + $manager->saveItem(clone $view->item); |
|
| 237 | 237 | $manager->commit(); |
| 238 | 238 | |
| 239 | - $this->nextAction( $view, $view->param( 'next' ), 'locale/language', strtoupper( $view->item->getId() ), 'save' ); |
|
| 239 | + $this->nextAction($view, $view->param('next'), 'locale/language', strtoupper($view->item->getId()), 'save'); |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 242 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
| 243 | 243 | { |
| 244 | 244 | // fall through to create |
| 245 | 245 | } |
| 246 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 246 | + catch (\Aimeos\MShop\Exception $e) |
|
| 247 | 247 | { |
| 248 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 249 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 250 | - $this->logException( $e ); |
|
| 248 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 249 | + $view->errors = $view->get('errors', []) + $error; |
|
| 250 | + $this->logException($e); |
|
| 251 | 251 | } |
| 252 | - catch( \Exception $e ) |
|
| 252 | + catch (\Exception $e) |
|
| 253 | 253 | { |
| 254 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 256 | - $this->logException( $e ); |
|
| 254 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 255 | + $view->errors = $view->get('errors', []) + $error; |
|
| 256 | + $this->logException($e); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | $manager->rollback(); |
@@ -275,34 +275,34 @@ discard block |
||
| 275 | 275 | try |
| 276 | 276 | { |
| 277 | 277 | $total = 0; |
| 278 | - $params = $this->storeSearchParams( $view->param(), 'locale/language' ); |
|
| 279 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 278 | + $params = $this->storeSearchParams($view->param(), 'locale/language'); |
|
| 279 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 280 | 280 | |
| 281 | 281 | $search = $manager->createSearch(); |
| 282 | - $search->setSortations( [$search->sort( '-', 'locale.language.status'), $search->sort( '+', 'locale.language.id')] ); |
|
| 283 | - $search = $this->initCriteria( $search, $params ); |
|
| 282 | + $search->setSortations([$search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.id')]); |
|
| 283 | + $search = $this->initCriteria($search, $params); |
|
| 284 | 284 | |
| 285 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
| 286 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
| 285 | + $view->items = $manager->searchItems($search, [], $total); |
|
| 286 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
| 287 | 287 | $view->filterOperators = $search->getOperators(); |
| 288 | 288 | $view->total = $total; |
| 289 | 289 | $view->itemBody = ''; |
| 290 | 290 | |
| 291 | - foreach( $this->getSubClients() as $client ) { |
|
| 291 | + foreach ($this->getSubClients() as $client) { |
|
| 292 | 292 | $view->itemBody .= $client->search(); |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 295 | + catch (\Aimeos\MShop\Exception $e) |
|
| 296 | 296 | { |
| 297 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 298 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 299 | - $this->logException( $e ); |
|
| 297 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 298 | + $view->errors = $view->get('errors', []) + $error; |
|
| 299 | + $this->logException($e); |
|
| 300 | 300 | } |
| 301 | - catch( \Exception $e ) |
|
| 301 | + catch (\Exception $e) |
|
| 302 | 302 | { |
| 303 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 304 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 305 | - $this->logException( $e ); |
|
| 303 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 304 | + $view->errors = $view->get('errors', []) + $error; |
|
| 305 | + $this->logException($e); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** admin/jqadm/locale/language/template-list |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $tplconf = 'admin/jqadm/locale/language/template-list'; |
| 328 | 328 | $default = 'locale/language/list-standard.php'; |
| 329 | 329 | |
| 330 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 330 | + return $view->render($view->config($tplconf, $default)); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @param string|null $name Name of the sub-client (Default if null) |
| 339 | 339 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 340 | 340 | */ |
| 341 | - public function getSubClient( $type, $name = null ) |
|
| 341 | + public function getSubClient($type, $name = null) |
|
| 342 | 342 | { |
| 343 | 343 | /** admin/jqadm/locale/language/decorators/excludes |
| 344 | 344 | * Excludes decorators added by the "common" option from the locale JQAdm client |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | * @see admin/jqadm/locale/language/decorators/excludes |
| 414 | 414 | * @see admin/jqadm/locale/language/decorators/global |
| 415 | 415 | */ |
| 416 | - return $this->createSubClient( 'locale/language' . $type, $name ); |
|
| 416 | + return $this->createSubClient('locale/language' . $type, $name); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * @since 2017.10 |
| 458 | 458 | * @category Developer |
| 459 | 459 | */ |
| 460 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/locale/language/standard/subparts', [] ); |
|
| 460 | + return $this->getContext()->getConfig()->get('admin/jqadm/locale/language/standard/subparts', []); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
@@ -468,17 +468,17 @@ discard block |
||
| 468 | 468 | * @param string[] Data array |
| 469 | 469 | * @return \Aimeos\MShop\Locale\Item\Iface New locale item object |
| 470 | 470 | */ |
| 471 | - protected function fromArray( array $data ) |
|
| 471 | + protected function fromArray(array $data) |
|
| 472 | 472 | { |
| 473 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/language' ); |
|
| 473 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/language'); |
|
| 474 | 474 | |
| 475 | - if( isset( $data['locale.language.id'] ) && $data['locale.language.id'] != '' ) { |
|
| 476 | - $item = $manager->getItem( $data['locale.language.id'] ); |
|
| 475 | + if (isset($data['locale.language.id']) && $data['locale.language.id'] != '') { |
|
| 476 | + $item = $manager->getItem($data['locale.language.id']); |
|
| 477 | 477 | } else { |
| 478 | 478 | $item = $manager->createItem(); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - $item->fromArray( $data ); |
|
| 481 | + $item->fromArray($data); |
|
| 482 | 482 | |
| 483 | 483 | return $item; |
| 484 | 484 | } |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
| 491 | 491 | * @return string[] Multi-dimensional associative list of item data |
| 492 | 492 | */ |
| 493 | - protected function toArray( \Aimeos\MShop\Locale\Item\Language\Iface $item, $copy = false ) |
|
| 493 | + protected function toArray(\Aimeos\MShop\Locale\Item\Language\Iface $item, $copy = false) |
|
| 494 | 494 | { |
| 495 | - $data = $item->toArray( true ); |
|
| 495 | + $data = $item->toArray(true); |
|
| 496 | 496 | |
| 497 | - if( $copy === true ) |
|
| 497 | + if ($copy === true) |
|
| 498 | 498 | { |
| 499 | 499 | $data['locale.language.id'] = ''; |
| 500 | 500 | $data['locale.language.code'] = ''; |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
| 511 | 511 | * @return string HTML output |
| 512 | 512 | */ |
| 513 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
| 513 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
| 514 | 514 | { |
| 515 | 515 | /** admin/jqadm/locale/language/template-item |
| 516 | 516 | * Relative path to the HTML body template for the locale item. |
@@ -534,6 +534,6 @@ discard block |
||
| 534 | 534 | $tplconf = 'admin/jqadm/locale/language/template-item'; |
| 535 | 535 | $default = 'locale/language/item-standard.php'; |
| 536 | 536 | |
| 537 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 537 | + return $view->render($view->config($tplconf, $default)); |
|
| 538 | 538 | } |
| 539 | 539 | } |
@@ -479,7 +479,7 @@ |
||
| 479 | 479 | /** |
| 480 | 480 | * Constructs the data array for the view from the given item |
| 481 | 481 | * |
| 482 | - * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
|
| 482 | + * @param \Aimeos\MShop\Locale\Item\Currency\Iface $item Locale item object |
|
| 483 | 483 | * @return string[] Multi-dimensional associative list of item data |
| 484 | 484 | */ |
| 485 | 485 | protected function toArray( \Aimeos\MShop\Locale\Item\Currency\Iface $item, $copy = false ) |
@@ -88,14 +88,12 @@ discard block |
||
| 88 | 88 | $view->tabindex = ++$idx + 1; |
| 89 | 89 | $view->itemBody .= $client->copy(); |
| 90 | 90 | } |
| 91 | - } |
|
| 92 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 91 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 93 | 92 | { |
| 94 | 93 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 95 | 94 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 96 | 95 | $this->logException( $e ); |
| 97 | - } |
|
| 98 | - catch( \Exception $e ) |
|
| 96 | + } catch( \Exception $e ) |
|
| 99 | 97 | { |
| 100 | 98 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 101 | 99 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -135,14 +133,12 @@ discard block |
||
| 135 | 133 | $view->tabindex = ++$idx + 1; |
| 136 | 134 | $view->itemBody .= $client->create(); |
| 137 | 135 | } |
| 138 | - } |
|
| 139 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 136 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 140 | 137 | { |
| 141 | 138 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 142 | 139 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 143 | 140 | $this->logException( $e ); |
| 144 | - } |
|
| 145 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 146 | 142 | { |
| 147 | 143 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 148 | 144 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -183,14 +179,12 @@ discard block |
||
| 183 | 179 | |
| 184 | 180 | $this->nextAction( $view, 'search', 'locale/currency', null, 'delete' ); |
| 185 | 181 | return; |
| 186 | - } |
|
| 187 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 182 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 188 | 183 | { |
| 189 | 184 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 190 | 185 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 191 | 186 | $this->logException( $e ); |
| 192 | - } |
|
| 193 | - catch( \Exception $e ) |
|
| 187 | + } catch( \Exception $e ) |
|
| 194 | 188 | { |
| 195 | 189 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 196 | 190 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -231,14 +225,12 @@ discard block |
||
| 231 | 225 | $view->tabindex = ++$idx + 1; |
| 232 | 226 | $view->itemBody .= $client->get(); |
| 233 | 227 | } |
| 234 | - } |
|
| 235 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 228 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 236 | 229 | { |
| 237 | 230 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 238 | 231 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 239 | 232 | $this->logException( $e ); |
| 240 | - } |
|
| 241 | - catch( \Exception $e ) |
|
| 233 | + } catch( \Exception $e ) |
|
| 242 | 234 | { |
| 243 | 235 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 244 | 236 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -275,18 +267,15 @@ discard block |
||
| 275 | 267 | |
| 276 | 268 | $this->nextAction( $view, $view->param( 'next' ), 'locale/currency', $view->item->getId(), 'save' ); |
| 277 | 269 | return; |
| 278 | - } |
|
| 279 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 270 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 280 | 271 | { |
| 281 | 272 | // fall through to create |
| 282 | - } |
|
| 283 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 273 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 284 | 274 | { |
| 285 | 275 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 286 | 276 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 287 | 277 | $this->logException( $e ); |
| 288 | - } |
|
| 289 | - catch( \Exception $e ) |
|
| 278 | + } catch( \Exception $e ) |
|
| 290 | 279 | { |
| 291 | 280 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 292 | 281 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -328,14 +317,12 @@ discard block |
||
| 328 | 317 | foreach( $this->getSubClients() as $client ) { |
| 329 | 318 | $view->itemBody .= $client->search(); |
| 330 | 319 | } |
| 331 | - } |
|
| 332 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 320 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 333 | 321 | { |
| 334 | 322 | $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 335 | 323 | $view->errors = $view->get( 'errors', [] ) + $error; |
| 336 | 324 | $this->logException( $e ); |
| 337 | - } |
|
| 338 | - catch( \Exception $e ) |
|
| 325 | + } catch( \Exception $e ) |
|
| 339 | 326 | { |
| 340 | 327 | $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
| 341 | 328 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Aimeos\Admin\JQAdm\Locale\Currency; |
| 12 | 12 | |
| 13 | -sprintf( 'locale/currency' ); // for translation |
|
| 13 | +sprintf('locale/currency'); // for translation |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | try |
| 37 | 37 | { |
| 38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 38 | + if (($id = $view->param('id')) === null) { |
|
| 39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
| 43 | - $view->item = $manager->getItem( $id ); |
|
| 42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
| 43 | + $view->item = $manager->getItem($id); |
|
| 44 | 44 | |
| 45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
| 45 | + $view->itemData = $this->toArray($view->item, true); |
|
| 46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
| 47 | 47 | $view->itemBody = ''; |
| 48 | 48 | |
| 49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 49 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 50 | 50 | { |
| 51 | 51 | $view->tabindex = ++$idx + 1; |
| 52 | 52 | $view->itemBody .= $client->copy(); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 55 | + catch (\Aimeos\MShop\Exception $e) |
|
| 56 | 56 | { |
| 57 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 59 | - $this->logException( $e ); |
|
| 57 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 58 | + $view->errors = $view->get('errors', []) + $error; |
|
| 59 | + $this->logException($e); |
|
| 60 | 60 | } |
| 61 | - catch( \Exception $e ) |
|
| 61 | + catch (\Exception $e) |
|
| 62 | 62 | { |
| 63 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 65 | - $this->logException( $e ); |
|
| 63 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 64 | + $view->errors = $view->get('errors', []) + $error; |
|
| 65 | + $this->logException($e); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return $this->render( $view ); |
|
| 68 | + return $this->render($view); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -81,36 +81,36 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | try |
| 83 | 83 | { |
| 84 | - $data = $view->param( 'item', [] ); |
|
| 84 | + $data = $view->param('item', []); |
|
| 85 | 85 | |
| 86 | - if( !isset( $view->item ) ) { |
|
| 87 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' )->createItem(); |
|
| 86 | + if (!isset($view->item)) { |
|
| 87 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'locale/currency')->createItem(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $view->itemSubparts = $this->getSubClientNames(); |
| 91 | 91 | $view->itemData = $data; |
| 92 | 92 | $view->itemBody = ''; |
| 93 | 93 | |
| 94 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 94 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 95 | 95 | { |
| 96 | 96 | $view->tabindex = ++$idx + 1; |
| 97 | 97 | $view->itemBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 100 | + catch (\Aimeos\MShop\Exception $e) |
|
| 101 | 101 | { |
| 102 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 103 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 104 | - $this->logException( $e ); |
|
| 102 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 103 | + $view->errors = $view->get('errors', []) + $error; |
|
| 104 | + $this->logException($e); |
|
| 105 | 105 | } |
| 106 | - catch( \Exception $e ) |
|
| 106 | + catch (\Exception $e) |
|
| 107 | 107 | { |
| 108 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 109 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 110 | - $this->logException( $e ); |
|
| 108 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 109 | + $view->errors = $view->get('errors', []) + $error; |
|
| 110 | + $this->logException($e); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - return $this->render( $view ); |
|
| 113 | + return $this->render($view); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -124,38 +124,38 @@ discard block |
||
| 124 | 124 | $view = $this->getView(); |
| 125 | 125 | $context = $this->getContext(); |
| 126 | 126 | |
| 127 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
| 127 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
| 128 | 128 | $manager->begin(); |
| 129 | 129 | |
| 130 | 130 | try |
| 131 | 131 | { |
| 132 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 133 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 132 | + if (($id = $view->param('id')) === null) { |
|
| 133 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $view->item = $manager->getItem( $id ); |
|
| 136 | + $view->item = $manager->getItem($id); |
|
| 137 | 137 | |
| 138 | - foreach( $this->getSubClients() as $client ) { |
|
| 138 | + foreach ($this->getSubClients() as $client) { |
|
| 139 | 139 | $client->delete(); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $manager->deleteItem( $id ); |
|
| 142 | + $manager->deleteItem($id); |
|
| 143 | 143 | $manager->commit(); |
| 144 | 144 | |
| 145 | - $this->nextAction( $view, 'search', 'locale/currency', null, 'delete' ); |
|
| 145 | + $this->nextAction($view, 'search', 'locale/currency', null, 'delete'); |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 148 | + catch (\Aimeos\MShop\Exception $e) |
|
| 149 | 149 | { |
| 150 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 151 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 152 | - $this->logException( $e ); |
|
| 150 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 151 | + $view->errors = $view->get('errors', []) + $error; |
|
| 152 | + $this->logException($e); |
|
| 153 | 153 | } |
| 154 | - catch( \Exception $e ) |
|
| 154 | + catch (\Exception $e) |
|
| 155 | 155 | { |
| 156 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 157 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 158 | - $this->logException( $e ); |
|
| 156 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 157 | + $view->errors = $view->get('errors', []) + $error; |
|
| 158 | + $this->logException($e); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $manager->rollback(); |
@@ -176,37 +176,37 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
| 180 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
| 179 | + if (($id = $view->param('id')) === null) { |
|
| 180 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
| 183 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
| 184 | 184 | |
| 185 | - $view->item = $manager->getItem( $id ); |
|
| 185 | + $view->item = $manager->getItem($id); |
|
| 186 | 186 | $view->itemSubparts = $this->getSubClientNames(); |
| 187 | - $view->itemData = $this->toArray( $view->item ); |
|
| 187 | + $view->itemData = $this->toArray($view->item); |
|
| 188 | 188 | $view->itemBody = ''; |
| 189 | 189 | |
| 190 | - foreach( $this->getSubClients() as $idx => $client ) |
|
| 190 | + foreach ($this->getSubClients() as $idx => $client) |
|
| 191 | 191 | { |
| 192 | 192 | $view->tabindex = ++$idx + 1; |
| 193 | 193 | $view->itemBody .= $client->get(); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 196 | + catch (\Aimeos\MShop\Exception $e) |
|
| 197 | 197 | { |
| 198 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 199 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 200 | - $this->logException( $e ); |
|
| 198 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 199 | + $view->errors = $view->get('errors', []) + $error; |
|
| 200 | + $this->logException($e); |
|
| 201 | 201 | } |
| 202 | - catch( \Exception $e ) |
|
| 202 | + catch (\Exception $e) |
|
| 203 | 203 | { |
| 204 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 206 | - $this->logException( $e ); |
|
| 204 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 205 | + $view->errors = $view->get('errors', []) + $error; |
|
| 206 | + $this->logException($e); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return $this->render( $view ); |
|
| 209 | + return $this->render($view); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -220,40 +220,40 @@ discard block |
||
| 220 | 220 | $view = $this->getView(); |
| 221 | 221 | $context = $this->getContext(); |
| 222 | 222 | |
| 223 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
| 223 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
| 224 | 224 | $manager->begin(); |
| 225 | 225 | |
| 226 | 226 | try |
| 227 | 227 | { |
| 228 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
| 229 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
| 228 | + $item = $this->fromArray($view->param('item', [])); |
|
| 229 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
| 230 | 230 | $view->itemBody = ''; |
| 231 | 231 | |
| 232 | - foreach( $this->getSubClients() as $client ) { |
|
| 232 | + foreach ($this->getSubClients() as $client) { |
|
| 233 | 233 | $view->itemBody .= $client->save(); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $manager->saveItem( clone $view->item ); |
|
| 236 | + $manager->saveItem(clone $view->item); |
|
| 237 | 237 | $manager->commit(); |
| 238 | 238 | |
| 239 | - $this->nextAction( $view, $view->param( 'next' ), 'locale/currency', $view->item->getId(), 'save' ); |
|
| 239 | + $this->nextAction($view, $view->param('next'), 'locale/currency', $view->item->getId(), 'save'); |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 242 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
| 243 | 243 | { |
| 244 | 244 | // fall through to create |
| 245 | 245 | } |
| 246 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 246 | + catch (\Aimeos\MShop\Exception $e) |
|
| 247 | 247 | { |
| 248 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 249 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 250 | - $this->logException( $e ); |
|
| 248 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 249 | + $view->errors = $view->get('errors', []) + $error; |
|
| 250 | + $this->logException($e); |
|
| 251 | 251 | } |
| 252 | - catch( \Exception $e ) |
|
| 252 | + catch (\Exception $e) |
|
| 253 | 253 | { |
| 254 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 256 | - $this->logException( $e ); |
|
| 254 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 255 | + $view->errors = $view->get('errors', []) + $error; |
|
| 256 | + $this->logException($e); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | $manager->rollback(); |
@@ -275,34 +275,34 @@ discard block |
||
| 275 | 275 | try |
| 276 | 276 | { |
| 277 | 277 | $total = 0; |
| 278 | - $params = $this->storeSearchParams( $view->param(), 'locale/currency' ); |
|
| 279 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
| 278 | + $params = $this->storeSearchParams($view->param(), 'locale/currency'); |
|
| 279 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
| 280 | 280 | |
| 281 | 281 | $search = $manager->createSearch(); |
| 282 | - $search->setSortations( [$search->sort( '-', 'locale.currency.status'), $search->sort( '+', 'locale.currency.id')] ); |
|
| 283 | - $search = $this->initCriteria( $search, $params ); |
|
| 282 | + $search->setSortations([$search->sort('-', 'locale.currency.status'), $search->sort('+', 'locale.currency.id')]); |
|
| 283 | + $search = $this->initCriteria($search, $params); |
|
| 284 | 284 | |
| 285 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
| 286 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
| 285 | + $view->items = $manager->searchItems($search, [], $total); |
|
| 286 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
| 287 | 287 | $view->filterOperators = $search->getOperators(); |
| 288 | 288 | $view->total = $total; |
| 289 | 289 | $view->itemBody = ''; |
| 290 | 290 | |
| 291 | - foreach( $this->getSubClients() as $client ) { |
|
| 291 | + foreach ($this->getSubClients() as $client) { |
|
| 292 | 292 | $view->itemBody .= $client->search(); |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 295 | + catch (\Aimeos\MShop\Exception $e) |
|
| 296 | 296 | { |
| 297 | - $error = array( 'locale-currency-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 298 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 299 | - $this->logException( $e ); |
|
| 297 | + $error = array('locale-currency-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 298 | + $view->errors = $view->get('errors', []) + $error; |
|
| 299 | + $this->logException($e); |
|
| 300 | 300 | } |
| 301 | - catch( \Exception $e ) |
|
| 301 | + catch (\Exception $e) |
|
| 302 | 302 | { |
| 303 | - $error = array( 'locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
| 304 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
| 305 | - $this->logException( $e ); |
|
| 303 | + $error = array('locale-currency-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
| 304 | + $view->errors = $view->get('errors', []) + $error; |
|
| 305 | + $this->logException($e); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** admin/jqadm/locale/currency/template-list |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $tplconf = 'admin/jqadm/locale/currency/template-list'; |
| 328 | 328 | $default = 'locale/currency/list-standard.php'; |
| 329 | 329 | |
| 330 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 330 | + return $view->render($view->config($tplconf, $default)); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @param string|null $name Name of the sub-client (Default if null) |
| 339 | 339 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 340 | 340 | */ |
| 341 | - public function getSubClient( $type, $name = null ) |
|
| 341 | + public function getSubClient($type, $name = null) |
|
| 342 | 342 | { |
| 343 | 343 | /** admin/jqadm/locale/currency/decorators/excludes |
| 344 | 344 | * Excludes decorators added by the "common" option from the locale JQAdm client |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | * @see admin/jqadm/locale/currency/decorators/excludes |
| 414 | 414 | * @see admin/jqadm/locale/currency/decorators/global |
| 415 | 415 | */ |
| 416 | - return $this->createSubClient( 'locale/currency' . $type, $name ); |
|
| 416 | + return $this->createSubClient('locale/currency' . $type, $name); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * @since 2017.10 |
| 458 | 458 | * @category Developer |
| 459 | 459 | */ |
| 460 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/locale/currency/standard/subparts', [] ); |
|
| 460 | + return $this->getContext()->getConfig()->get('admin/jqadm/locale/currency/standard/subparts', []); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
@@ -468,17 +468,17 @@ discard block |
||
| 468 | 468 | * @param string[] Data array |
| 469 | 469 | * @return \Aimeos\MShop\Locale\Item\Iface New locale item object |
| 470 | 470 | */ |
| 471 | - protected function fromArray( array $data ) |
|
| 471 | + protected function fromArray(array $data) |
|
| 472 | 472 | { |
| 473 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/currency' ); |
|
| 473 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/currency'); |
|
| 474 | 474 | |
| 475 | - if( isset( $data['locale.currency.id'] ) && $data['locale.currency.id'] != '' ) { |
|
| 476 | - $item = $manager->getItem( $data['locale.currency.id'] ); |
|
| 475 | + if (isset($data['locale.currency.id']) && $data['locale.currency.id'] != '') { |
|
| 476 | + $item = $manager->getItem($data['locale.currency.id']); |
|
| 477 | 477 | } else { |
| 478 | 478 | $item = $manager->createItem(); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - $item->fromArray( $data ); |
|
| 481 | + $item->fromArray($data); |
|
| 482 | 482 | |
| 483 | 483 | return $item; |
| 484 | 484 | } |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
| 491 | 491 | * @return string[] Multi-dimensional associative list of item data |
| 492 | 492 | */ |
| 493 | - protected function toArray( \Aimeos\MShop\Locale\Item\Currency\Iface $item, $copy = false ) |
|
| 493 | + protected function toArray(\Aimeos\MShop\Locale\Item\Currency\Iface $item, $copy = false) |
|
| 494 | 494 | { |
| 495 | - $data = $item->toArray( true ); |
|
| 495 | + $data = $item->toArray(true); |
|
| 496 | 496 | |
| 497 | - if( $copy === true ) |
|
| 497 | + if ($copy === true) |
|
| 498 | 498 | { |
| 499 | 499 | $data['locale.currency.id'] = ''; |
| 500 | 500 | $data['locale.currency.code'] = ''; |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
| 511 | 511 | * @return string HTML output |
| 512 | 512 | */ |
| 513 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
| 513 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
| 514 | 514 | { |
| 515 | 515 | /** admin/jqadm/locale/currency/template-item |
| 516 | 516 | * Relative path to the HTML body template for the locale item. |
@@ -534,6 +534,6 @@ discard block |
||
| 534 | 534 | $tplconf = 'admin/jqadm/locale/currency/template-item'; |
| 535 | 535 | $default = 'locale/currency/item-standard.php'; |
| 536 | 536 | |
| 537 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 537 | + return $view->render($view->config($tplconf, $default)); |
|
| 538 | 538 | } |
| 539 | 539 | } |
@@ -306,6 +306,9 @@ |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
| 309 | + /** |
|
| 310 | + * @param string $method |
|
| 311 | + */ |
|
| 309 | 312 | public function getClientMock( $method ) |
| 310 | 313 | { |
| 311 | 314 | $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Order\Standard' ) |
@@ -19,22 +19,22 @@ discard block |
||
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | 21 | $this->view = \TestHelperJqadm::getView(); |
| 22 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 23 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
| 24 | - $this->view ->addHelper( 'request', $helper ); |
|
| 22 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 23 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
| 24 | + $this->view ->addHelper('request', $helper); |
|
| 25 | 25 | |
| 26 | 26 | $this->context = \TestHelperJqadm::getContext(); |
| 27 | 27 | |
| 28 | - $this->object = new \Aimeos\Admin\JQAdm\Order\Standard( $this->context ); |
|
| 29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
| 30 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 31 | - $this->object->setView( $this->view ); |
|
| 28 | + $this->object = new \Aimeos\Admin\JQAdm\Order\Standard($this->context); |
|
| 29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
| 30 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 31 | + $this->object->setView($this->view); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->view, $this->context ); |
|
| 37 | + unset($this->object, $this->view, $this->context); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function testCreateException() |
| 48 | 48 | { |
| 49 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 49 | + $object = $this->getClientMock('getSubClients'); |
|
| 50 | 50 | |
| 51 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 52 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 51 | + $object->expects($this->once())->method('getSubClients') |
|
| 52 | + ->will($this->throwException(new \RuntimeException())); |
|
| 53 | 53 | |
| 54 | 54 | $object->create(); |
| 55 | 55 | } |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function testCreateMShopException() |
| 59 | 59 | { |
| 60 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 60 | + $object = $this->getClientMock('getSubClients'); |
|
| 61 | 61 | |
| 62 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 63 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 62 | + $object->expects($this->once())->method('getSubClients') |
|
| 63 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 64 | 64 | |
| 65 | 65 | $object->create(); |
| 66 | 66 | } |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | public function testCopy() |
| 70 | 70 | { |
| 71 | 71 | $param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()]; |
| 72 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 73 | - $this->view->addHelper( 'param', $helper ); |
|
| 72 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 73 | + $this->view->addHelper('param', $helper); |
|
| 74 | 74 | |
| 75 | 75 | $result = $this->object->copy(); |
| 76 | 76 | |
| 77 | - $this->assertContains( 'This is another comment.', $result ); |
|
| 77 | + $this->assertContains('This is another comment.', $result); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | public function testCopyException() |
| 82 | 82 | { |
| 83 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 83 | + $object = $this->getClientMock('getSubClients'); |
|
| 84 | 84 | |
| 85 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 86 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 85 | + $object->expects($this->once())->method('getSubClients') |
|
| 86 | + ->will($this->throwException(new \RuntimeException())); |
|
| 87 | 87 | |
| 88 | 88 | $object->copy(); |
| 89 | 89 | } |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function testCopyMShopException() |
| 93 | 93 | { |
| 94 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 94 | + $object = $this->getClientMock('getSubClients'); |
|
| 95 | 95 | |
| 96 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 97 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 96 | + $object->expects($this->once())->method('getSubClients') |
|
| 97 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 98 | 98 | |
| 99 | 99 | $object->copy(); |
| 100 | 100 | } |
@@ -102,28 +102,28 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | public function testDelete() |
| 104 | 104 | { |
| 105 | - $this->assertNull( $this->object->delete() ); |
|
| 105 | + $this->assertNull($this->object->delete()); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGet() |
| 110 | 110 | { |
| 111 | 111 | $param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()]; |
| 112 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 113 | - $this->view->addHelper( 'param', $helper ); |
|
| 112 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 113 | + $this->view->addHelper('param', $helper); |
|
| 114 | 114 | |
| 115 | 115 | $result = $this->object->get(); |
| 116 | 116 | |
| 117 | - $this->assertContains( 'This is another comment.', $result ); |
|
| 117 | + $this->assertContains('This is another comment.', $result); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | public function testGetException() |
| 122 | 122 | { |
| 123 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 123 | + $object = $this->getClientMock('getSubClients'); |
|
| 124 | 124 | |
| 125 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 126 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 125 | + $object->expects($this->once())->method('getSubClients') |
|
| 126 | + ->will($this->throwException(new \RuntimeException())); |
|
| 127 | 127 | |
| 128 | 128 | $object->get(); |
| 129 | 129 | } |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | public function testGetMShopException() |
| 133 | 133 | { |
| 134 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 134 | + $object = $this->getClientMock('getSubClients'); |
|
| 135 | 135 | |
| 136 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 137 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 136 | + $object->expects($this->once())->method('getSubClients') |
|
| 137 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 138 | 138 | |
| 139 | 139 | $object->get(); |
| 140 | 140 | } |
@@ -150,28 +150,28 @@ discard block |
||
| 150 | 150 | ], |
| 151 | 151 | 'sort' => ['-order.ctime', 'order.id'], |
| 152 | 152 | ]; |
| 153 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 154 | - $this->view->addHelper( 'param', $helper ); |
|
| 153 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 154 | + $this->view->addHelper('param', $helper); |
|
| 155 | 155 | |
| 156 | 156 | $result = $this->object->export(); |
| 157 | 157 | |
| 158 | - $mq = $this->context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' ); |
|
| 158 | + $mq = $this->context->getMessageQueueManager()->get('mq-admin')->getQueue('order-export'); |
|
| 159 | 159 | |
| 160 | 160 | $msg = $mq->get(); |
| 161 | - $this->assertNotNull( $msg ); |
|
| 162 | - $mq->del( $msg ); |
|
| 161 | + $this->assertNotNull($msg); |
|
| 162 | + $mq->del($msg); |
|
| 163 | 163 | |
| 164 | 164 | $expected = '{"sitecode":"unittest","filter":{"&&":[{"==":{"order.id":"1"}}]},"sort":{"order.ctime":"-","order.id":"+"}}'; |
| 165 | - $this->assertEquals( $expected, $msg->getBody() ); |
|
| 165 | + $this->assertEquals($expected, $msg->getBody()); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | public function testExportException() |
| 170 | 170 | { |
| 171 | - $object = $this->getClientMock( 'storeSearchParams' ); |
|
| 171 | + $object = $this->getClientMock('storeSearchParams'); |
|
| 172 | 172 | |
| 173 | - $object->expects( $this->atLeastOnce() )->method( 'storeSearchParams' ) |
|
| 174 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 173 | + $object->expects($this->atLeastOnce())->method('storeSearchParams') |
|
| 174 | + ->will($this->throwException(new \RuntimeException())); |
|
| 175 | 175 | |
| 176 | 176 | $object->export(); |
| 177 | 177 | } |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | public function testExportMShopException() |
| 181 | 181 | { |
| 182 | - $object = $this->getClientMock( 'storeSearchParams' ); |
|
| 182 | + $object = $this->getClientMock('storeSearchParams'); |
|
| 183 | 183 | |
| 184 | - $object->expects( $this->atLeastOnce() )->method( 'storeSearchParams' ) |
|
| 185 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 184 | + $object->expects($this->atLeastOnce())->method('storeSearchParams') |
|
| 185 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 186 | 186 | |
| 187 | 187 | $object->export(); |
| 188 | 188 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | public function testSave() |
| 192 | 192 | { |
| 193 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' ); |
|
| 193 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base'); |
|
| 194 | 194 | $this->view->item = $manager->createItem(); |
| 195 | 195 | |
| 196 | 196 | $param = array( |
@@ -200,21 +200,21 @@ discard block |
||
| 200 | 200 | ), |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 204 | - $this->view->addHelper( 'param', $helper ); |
|
| 203 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 204 | + $this->view->addHelper('param', $helper); |
|
| 205 | 205 | |
| 206 | 206 | $this->object->save(); |
| 207 | 207 | |
| 208 | - $manager->deleteItem( $this->getOrderBaseItem( 'jqadm test comment' )->getId() ); |
|
| 208 | + $manager->deleteItem($this->getOrderBaseItem('jqadm test comment')->getId()); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | public function testSaveException() |
| 213 | 213 | { |
| 214 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 214 | + $object = $this->getClientMock('fromArray'); |
|
| 215 | 215 | |
| 216 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 217 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 216 | + $object->expects($this->once())->method('fromArray') |
|
| 217 | + ->will($this->throwException(new \RuntimeException())); |
|
| 218 | 218 | |
| 219 | 219 | $object->save(); |
| 220 | 220 | } |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | public function testSaveMShopException() |
| 224 | 224 | { |
| 225 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 225 | + $object = $this->getClientMock('fromArray'); |
|
| 226 | 226 | |
| 227 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 228 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 227 | + $object->expects($this->once())->method('fromArray') |
|
| 228 | + ->will($this->throwException(new \RuntimeException())); |
|
| 229 | 229 | |
| 230 | 230 | $object->save(); |
| 231 | 231 | } |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | public function testSaveJQAdmException() |
| 235 | 235 | { |
| 236 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 236 | + $object = $this->getClientMock('fromArray'); |
|
| 237 | 237 | |
| 238 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 239 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 238 | + $object->expects($this->once())->method('fromArray') |
|
| 239 | + ->will($this->throwException(new \RuntimeException())); |
|
| 240 | 240 | |
| 241 | 241 | $object->save(); |
| 242 | 242 | } |
@@ -247,14 +247,14 @@ discard block |
||
| 247 | 247 | $param = array( |
| 248 | 248 | 'site' => 'unittest', 'lang' => 'de', |
| 249 | 249 | 'filter' => array( |
| 250 | - 'key' => array( 0 => 'order.base.type' ), |
|
| 251 | - 'op' => array( 0 => '==' ), |
|
| 252 | - 'val' => array( 0 => 'web' ), |
|
| 250 | + 'key' => array(0 => 'order.base.type'), |
|
| 251 | + 'op' => array(0 => '=='), |
|
| 252 | + 'val' => array(0 => 'web'), |
|
| 253 | 253 | ), |
| 254 | - 'sort' => array( '-order.base.id' ), |
|
| 254 | + 'sort' => array('-order.base.id'), |
|
| 255 | 255 | ); |
| 256 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 257 | - $this->view->addHelper( 'param', $helper ); |
|
| 256 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 257 | + $this->view->addHelper('param', $helper); |
|
| 258 | 258 | |
| 259 | 259 | $result = $this->object->search(); |
| 260 | 260 | |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | public function testSearchException() |
| 266 | 266 | { |
| 267 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 267 | + $object = $this->getClientMock('initCriteria'); |
|
| 268 | 268 | |
| 269 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 270 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 269 | + $object->expects($this->once())->method('initCriteria') |
|
| 270 | + ->will($this->throwException(new \RuntimeException())); |
|
| 271 | 271 | |
| 272 | 272 | $object->search(); |
| 273 | 273 | } |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | public function testSearchMShopException() |
| 277 | 277 | { |
| 278 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 278 | + $object = $this->getClientMock('initCriteria'); |
|
| 279 | 279 | |
| 280 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 281 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 280 | + $object->expects($this->once())->method('initCriteria') |
|
| 281 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 282 | 282 | |
| 283 | 283 | $object->search(); |
| 284 | 284 | } |
@@ -286,34 +286,34 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | public function testGetSubClient() |
| 288 | 288 | { |
| 289 | - $result = $this->object->getSubClient( 'invoice' ); |
|
| 290 | - $this->assertInstanceOf( '\Aimeos\Admin\JQAdm\Iface', $result ); |
|
| 289 | + $result = $this->object->getSubClient('invoice'); |
|
| 290 | + $this->assertInstanceOf('\Aimeos\Admin\JQAdm\Iface', $result); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | public function testGetSubClientInvalid() |
| 295 | 295 | { |
| 296 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 297 | - $this->object->getSubClient( '$unknown$' ); |
|
| 296 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 297 | + $this->object->getSubClient('$unknown$'); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
| 301 | 301 | public function testGetSubClientUnknown() |
| 302 | 302 | { |
| 303 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 304 | - $this->object->getSubClient( 'unknown' ); |
|
| 303 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 304 | + $this->object->getSubClient('unknown'); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
| 308 | - public function getClientMock( $method ) |
|
| 308 | + public function getClientMock($method) |
|
| 309 | 309 | { |
| 310 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Order\Standard' ) |
|
| 311 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
| 312 | - ->setMethods( [$method] ) |
|
| 310 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Order\Standard') |
|
| 311 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
| 312 | + ->setMethods([$method]) |
|
| 313 | 313 | ->getMock(); |
| 314 | 314 | |
| 315 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 316 | - $object->setView( $this->getViewNoRender() ); |
|
| 315 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 316 | + $object->setView($this->getViewNoRender()); |
|
| 317 | 317 | |
| 318 | 318 | return $object; |
| 319 | 319 | } |
@@ -321,33 +321,33 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | protected function getViewNoRender() |
| 323 | 323 | { |
| 324 | - $view = $this->getMockBuilder( '\Aimeos\MW\View\Standard' ) |
|
| 325 | - ->setConstructorArgs( array( [] ) ) |
|
| 326 | - ->setMethods( array( 'render', 'config' ) ) |
|
| 324 | + $view = $this->getMockBuilder('\Aimeos\MW\View\Standard') |
|
| 325 | + ->setConstructorArgs(array([])) |
|
| 326 | + ->setMethods(array('render', 'config')) |
|
| 327 | 327 | ->getMock(); |
| 328 | 328 | |
| 329 | 329 | $param = ['site' => 'unittest', 'id' => $this->getOrderBaseItem()->getId()]; |
| 330 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
| 331 | - $view->addHelper( 'param', $helper ); |
|
| 330 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
| 331 | + $view->addHelper('param', $helper); |
|
| 332 | 332 | |
| 333 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
| 334 | - $view->addHelper( 'access', $helper ); |
|
| 333 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
| 334 | + $view->addHelper('access', $helper); |
|
| 335 | 335 | |
| 336 | 336 | return $view; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | |
| 340 | - protected function getOrderBaseItem( $comment = 'This is another comment.' ) |
|
| 340 | + protected function getOrderBaseItem($comment = 'This is another comment.') |
|
| 341 | 341 | { |
| 342 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' ); |
|
| 342 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base'); |
|
| 343 | 343 | |
| 344 | 344 | $search = $manager->createSearch(); |
| 345 | - $search->setConditions( $search->compare( '==', 'order.base.comment', $comment ) ); |
|
| 345 | + $search->setConditions($search->compare('==', 'order.base.comment', $comment)); |
|
| 346 | 346 | |
| 347 | - $items = $manager->searchItems( $search ); |
|
| 347 | + $items = $manager->searchItems($search); |
|
| 348 | 348 | |
| 349 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 350 | - throw new \RuntimeException( 'No order base item found' ); |
|
| 349 | + if (($item = reset($items)) === false) { |
|
| 350 | + throw new \RuntimeException('No order base item found'); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $item; |
@@ -13,63 +13,63 @@ discard block |
||
| 13 | 13 | public static function bootstrap() |
| 14 | 14 | { |
| 15 | 15 | self::getAimeos(); |
| 16 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 16 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | - public static function getContext( $site = 'unittest' ) |
|
| 20 | + public static function getContext($site = 'unittest') |
|
| 21 | 21 | { |
| 22 | - if( !isset( self::$context[$site] ) ) { |
|
| 23 | - self::$context[$site] = self::createContext( $site ); |
|
| 22 | + if (!isset(self::$context[$site])) { |
|
| 23 | + self::$context[$site] = self::createContext($site); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | return clone self::$context[$site]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - public static function getView( $site = 'unittest', \Aimeos\MW\Config\Iface $config = null ) |
|
| 30 | + public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null) |
|
| 31 | 31 | { |
| 32 | - if( $config === null ) { |
|
| 33 | - $config = self::getContext( $site )->getConfig(); |
|
| 32 | + if ($config === null) { |
|
| 33 | + $config = self::getContext($site)->getConfig(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $view = new \Aimeos\MW\View\Standard( self::getTemplatePaths() ); |
|
| 36 | + $view = new \Aimeos\MW\View\Standard(self::getTemplatePaths()); |
|
| 37 | 37 | |
| 38 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, ['site' => 'unittest'] ); |
|
| 39 | - $view->addHelper( 'param', $helper ); |
|
| 38 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, ['site' => 'unittest']); |
|
| 39 | + $view->addHelper('param', $helper); |
|
| 40 | 40 | |
| 41 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
| 42 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
| 43 | - $view->addHelper( 'translate', $helper ); |
|
| 41 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
| 42 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
| 43 | + $view->addHelper('translate', $helper); |
|
| 44 | 44 | |
| 45 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
| 46 | - $view->addHelper( 'url', $helper ); |
|
| 45 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
| 46 | + $view->addHelper('url', $helper); |
|
| 47 | 47 | |
| 48 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
| 49 | - $view->addHelper( 'number', $helper ); |
|
| 48 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
| 49 | + $view->addHelper('number', $helper); |
|
| 50 | 50 | |
| 51 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
| 52 | - $view->addHelper( 'date', $helper ); |
|
| 51 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
| 52 | + $view->addHelper('date', $helper); |
|
| 53 | 53 | |
| 54 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin', 'client/html', 'controller/jsonadm' ) ); |
|
| 55 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 56 | - $view->addHelper( 'config', $helper ); |
|
| 54 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm')); |
|
| 55 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 56 | + $view->addHelper('config', $helper); |
|
| 57 | 57 | |
| 58 | - $helper = new \Aimeos\MW\View\Helper\Session\Standard( $view, new \Aimeos\MW\Session\None() ); |
|
| 59 | - $view->addHelper( 'session', $helper ); |
|
| 58 | + $helper = new \Aimeos\MW\View\Helper\Session\Standard($view, new \Aimeos\MW\Session\None()); |
|
| 59 | + $view->addHelper('session', $helper); |
|
| 60 | 60 | |
| 61 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $view, new \Zend\Diactoros\ServerRequest() ); |
|
| 62 | - $view->addHelper( 'request', $helper ); |
|
| 61 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, new \Zend\Diactoros\ServerRequest()); |
|
| 62 | + $view->addHelper('request', $helper); |
|
| 63 | 63 | |
| 64 | - $helper = new \Aimeos\MW\View\Helper\Response\Standard( $view, new \Zend\Diactoros\Response() ); |
|
| 65 | - $view->addHelper( 'response', $helper ); |
|
| 64 | + $helper = new \Aimeos\MW\View\Helper\Response\Standard($view, new \Zend\Diactoros\Response()); |
|
| 65 | + $view->addHelper('response', $helper); |
|
| 66 | 66 | |
| 67 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_csrf_token', '_csrf_value' ); |
|
| 68 | - $view->addHelper( 'csrf', $helper ); |
|
| 67 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value'); |
|
| 68 | + $view->addHelper('csrf', $helper); |
|
| 69 | 69 | |
| 70 | - $fcn = function() { return array( 'admin' ); }; |
|
| 71 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn ); |
|
| 72 | - $view->addHelper( 'access', $helper ); |
|
| 70 | + $fcn = function() { return array('admin'); }; |
|
| 71 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn); |
|
| 72 | + $view->addHelper('access', $helper); |
|
| 73 | 73 | |
| 74 | 74 | $view->pageSitePath = []; |
| 75 | 75 | |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public static function getTemplatePaths() |
| 81 | 81 | { |
| 82 | - return self::getAimeos()->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 82 | + return self::getAimeos()->getCustomPaths('admin/jqadm/templates'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | public static function getAimeos() |
| 87 | 87 | { |
| 88 | - if( !isset( self::$aimeos ) ) |
|
| 88 | + if (!isset(self::$aimeos)) |
|
| 89 | 89 | { |
| 90 | 90 | require_once 'Bootstrap.php'; |
| 91 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 91 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 92 | 92 | |
| 93 | - $extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 94 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
| 93 | + $extdir = dirname(dirname(dirname(dirname(__FILE__)))); |
|
| 94 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return self::$aimeos; |
@@ -101,57 +101,57 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * @param string $site |
| 103 | 103 | */ |
| 104 | - private static function createContext( $site ) |
|
| 104 | + private static function createContext($site) |
|
| 105 | 105 | { |
| 106 | 106 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 107 | 107 | $aimeos = self::getAimeos(); |
| 108 | 108 | |
| 109 | 109 | |
| 110 | - $paths = $aimeos->getConfigPaths( 'mysql' ); |
|
| 110 | + $paths = $aimeos->getConfigPaths('mysql'); |
|
| 111 | 111 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 112 | 112 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 113 | - $local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) ); |
|
| 113 | + $local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp'))); |
|
| 114 | 114 | |
| 115 | - $conf = new \Aimeos\MW\Config\PHPArray( $local, $paths ); |
|
| 116 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 117 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 118 | - $ctx->setConfig( $conf ); |
|
| 115 | + $conf = new \Aimeos\MW\Config\PHPArray($local, $paths); |
|
| 116 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 117 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 118 | + $ctx->setConfig($conf); |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 122 | - $ctx->setDatabaseManager( $dbm ); |
|
| 121 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 122 | + $ctx->setDatabaseManager($dbm); |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
| 126 | - $ctx->setFilesystemManager( $fs ); |
|
| 125 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
| 126 | + $ctx->setFilesystemManager($fs); |
|
| 127 | 127 | |
| 128 | 128 | |
| 129 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
| 130 | - $ctx->setMessageQueueManager( $mq ); |
|
| 129 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
| 130 | + $ctx->setMessageQueueManager($mq); |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 134 | - $ctx->setLogger( $logger ); |
|
| 133 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 134 | + $ctx->setLogger($logger); |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | $cache = new \Aimeos\MW\Cache\None(); |
| 138 | - $ctx->setCache( $cache ); |
|
| 138 | + $ctx->setCache($cache); |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
| 142 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
| 141 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
| 142 | + $ctx->setI18n(array('de' => $i18n)); |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | $session = new \Aimeos\MW\Session\None(); |
| 146 | - $ctx->setSession( $session ); |
|
| 146 | + $ctx->setSession($session); |
|
| 147 | 147 | |
| 148 | 148 | |
| 149 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 150 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 151 | - $ctx->setLocale( $locale ); |
|
| 149 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 150 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 151 | + $ctx->setLocale($locale); |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - $ctx->setEditor( 'ai-admin-jqadm:admin/jqadm' ); |
|
| 154 | + $ctx->setEditor('ai-admin-jqadm:admin/jqadm'); |
|
| 155 | 155 | |
| 156 | 156 | return $ctx; |
| 157 | 157 | } |
@@ -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::createClient( $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::createClient($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::createClient( $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::createClient($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::createClient( $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::createClient($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::createClient( $this->context, $this->aimeos, '' ); |
|
| 52 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
| 53 | + \Aimeos\Admin\JQAdm\Factory::createClient($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::createClient( $this->context, $this->aimeos, '%product' ); |
|
| 59 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
| 60 | + \Aimeos\Admin\JQAdm\Factory::createClient($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::createClient( $this->context, $this->aimeos, 'unknown' ); |
|
| 66 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
| 67 | + \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->aimeos, 'unknown'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } |
@@ -301,6 +301,9 @@ |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
| 304 | + /** |
|
| 305 | + * @param string $method |
|
| 306 | + */ |
|
| 304 | 307 | public function getClientMock( $method ) |
| 305 | 308 | { |
| 306 | 309 | $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Attribute\Standard' ) |
@@ -19,22 +19,22 @@ discard block |
||
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | 21 | $this->view = \TestHelperJqadm::getView(); |
| 22 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 23 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
| 24 | - $this->view ->addHelper( 'request', $helper ); |
|
| 22 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 23 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
| 24 | + $this->view ->addHelper('request', $helper); |
|
| 25 | 25 | |
| 26 | 26 | $this->context = \TestHelperJqadm::getContext(); |
| 27 | 27 | |
| 28 | - $this->object = new \Aimeos\Admin\JQAdm\Attribute\Standard( $this->context ); |
|
| 29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
| 30 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 31 | - $this->object->setView( $this->view ); |
|
| 28 | + $this->object = new \Aimeos\Admin\JQAdm\Attribute\Standard($this->context); |
|
| 29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
| 30 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 31 | + $this->object->setView($this->view); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->view, $this->context ); |
|
| 37 | + unset($this->object, $this->view, $this->context); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function testCreateException() |
| 48 | 48 | { |
| 49 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 49 | + $object = $this->getClientMock('getSubClients'); |
|
| 50 | 50 | |
| 51 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 52 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 51 | + $object->expects($this->once())->method('getSubClients') |
|
| 52 | + ->will($this->throwException(new \RuntimeException())); |
|
| 53 | 53 | |
| 54 | 54 | $object->create(); |
| 55 | 55 | } |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function testCreateMShopException() |
| 59 | 59 | { |
| 60 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 60 | + $object = $this->getClientMock('getSubClients'); |
|
| 61 | 61 | |
| 62 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 63 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 62 | + $object->expects($this->once())->method('getSubClients') |
|
| 63 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 64 | 64 | |
| 65 | 65 | $object->create(); |
| 66 | 66 | } |
@@ -68,24 +68,24 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function testCopy() |
| 70 | 70 | { |
| 71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
| 71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
| 72 | 72 | |
| 73 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( '30', [], 'product', 'length' )->getId()]; |
|
| 74 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 75 | - $this->view->addHelper( 'param', $helper ); |
|
| 73 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('30', [], 'product', 'length')->getId()]; |
|
| 74 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 75 | + $this->view->addHelper('param', $helper); |
|
| 76 | 76 | |
| 77 | 77 | $result = $this->object->copy(); |
| 78 | 78 | |
| 79 | - $this->assertContains( '30_copy', $result ); |
|
| 79 | + $this->assertContains('30_copy', $result); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | public function testCopyException() |
| 84 | 84 | { |
| 85 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 85 | + $object = $this->getClientMock('getSubClients'); |
|
| 86 | 86 | |
| 87 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 88 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 87 | + $object->expects($this->once())->method('getSubClients') |
|
| 88 | + ->will($this->throwException(new \RuntimeException())); |
|
| 89 | 89 | |
| 90 | 90 | $object->copy(); |
| 91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function testCopyMShopException() |
| 95 | 95 | { |
| 96 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 96 | + $object = $this->getClientMock('getSubClients'); |
|
| 97 | 97 | |
| 98 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 99 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 98 | + $object->expects($this->once())->method('getSubClients') |
|
| 99 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 100 | 100 | |
| 101 | 101 | $object->copy(); |
| 102 | 102 | } |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function testDelete() |
| 106 | 106 | { |
| 107 | - $this->assertNotNull( $this->object->delete() ); |
|
| 107 | + $this->assertNotNull($this->object->delete()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | public function testDeleteException() |
| 112 | 112 | { |
| 113 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 113 | + $object = $this->getClientMock('getSubClients'); |
|
| 114 | 114 | |
| 115 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
| 116 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 115 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
| 116 | + ->will($this->throwException(new \RuntimeException())); |
|
| 117 | 117 | |
| 118 | 118 | $object->delete(); |
| 119 | 119 | } |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | public function testDeleteMShopException() |
| 123 | 123 | { |
| 124 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 124 | + $object = $this->getClientMock('getSubClients'); |
|
| 125 | 125 | |
| 126 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
| 127 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 126 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
| 127 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 128 | 128 | |
| 129 | 129 | $object->delete(); |
| 130 | 130 | } |
@@ -132,24 +132,24 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function testGet() |
| 134 | 134 | { |
| 135 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
| 135 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
| 136 | 136 | |
| 137 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( '30', [], 'product', 'length' )->getId()]; |
|
| 138 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 139 | - $this->view->addHelper( 'param', $helper ); |
|
| 137 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('30', [], 'product', 'length')->getId()]; |
|
| 138 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 139 | + $this->view->addHelper('param', $helper); |
|
| 140 | 140 | |
| 141 | 141 | $result = $this->object->get(); |
| 142 | 142 | |
| 143 | - $this->assertContains( '"30"', $result ); |
|
| 143 | + $this->assertContains('"30"', $result); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | public function testGetException() |
| 148 | 148 | { |
| 149 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 149 | + $object = $this->getClientMock('getSubClients'); |
|
| 150 | 150 | |
| 151 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 152 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 151 | + $object->expects($this->once())->method('getSubClients') |
|
| 152 | + ->will($this->throwException(new \RuntimeException())); |
|
| 153 | 153 | |
| 154 | 154 | $object->get(); |
| 155 | 155 | } |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function testGetMShopException() |
| 159 | 159 | { |
| 160 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 160 | + $object = $this->getClientMock('getSubClients'); |
|
| 161 | 161 | |
| 162 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 163 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 162 | + $object->expects($this->once())->method('getSubClients') |
|
| 163 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 164 | 164 | |
| 165 | 165 | $object->get(); |
| 166 | 166 | } |
@@ -168,19 +168,19 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | public function testGetViewException() |
| 170 | 170 | { |
| 171 | - $object = new \Aimeos\Admin\JQAdm\Attribute\Standard( $this->context, [] ); |
|
| 171 | + $object = new \Aimeos\Admin\JQAdm\Attribute\Standard($this->context, []); |
|
| 172 | 172 | |
| 173 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 173 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 174 | 174 | $object->getView(); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | public function testSave() |
| 179 | 179 | { |
| 180 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
| 181 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute/type' ); |
|
| 180 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
| 181 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute/type'); |
|
| 182 | 182 | |
| 183 | - $typeId = $typeManager->findItem( 'color', [], 'product' )->getId(); |
|
| 183 | + $typeId = $typeManager->findItem('color', [], 'product')->getId(); |
|
| 184 | 184 | |
| 185 | 185 | $param = array( |
| 186 | 186 | 'site' => 'unittest', |
@@ -195,21 +195,21 @@ discard block |
||
| 195 | 195 | ), |
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 199 | - $this->view->addHelper( 'param', $helper ); |
|
| 198 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 199 | + $this->view->addHelper('param', $helper); |
|
| 200 | 200 | |
| 201 | 201 | $this->object->save(); |
| 202 | 202 | |
| 203 | - $manager->deleteItem( $manager->findItem( 'test', [], 'product', 'color' )->getId() ); |
|
| 203 | + $manager->deleteItem($manager->findItem('test', [], 'product', 'color')->getId()); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | public function testSaveException() |
| 208 | 208 | { |
| 209 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 209 | + $object = $this->getClientMock('fromArray'); |
|
| 210 | 210 | |
| 211 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 212 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 211 | + $object->expects($this->once())->method('fromArray') |
|
| 212 | + ->will($this->throwException(new \RuntimeException())); |
|
| 213 | 213 | |
| 214 | 214 | $object->save(); |
| 215 | 215 | } |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | public function testSaveMShopException() |
| 219 | 219 | { |
| 220 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 220 | + $object = $this->getClientMock('fromArray'); |
|
| 221 | 221 | |
| 222 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 223 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 222 | + $object->expects($this->once())->method('fromArray') |
|
| 223 | + ->will($this->throwException(new \RuntimeException())); |
|
| 224 | 224 | |
| 225 | 225 | $object->save(); |
| 226 | 226 | } |
@@ -228,10 +228,10 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | public function testSaveJQAdmException() |
| 230 | 230 | { |
| 231 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 231 | + $object = $this->getClientMock('fromArray'); |
|
| 232 | 232 | |
| 233 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 234 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 233 | + $object->expects($this->once())->method('fromArray') |
|
| 234 | + ->will($this->throwException(new \RuntimeException())); |
|
| 235 | 235 | |
| 236 | 236 | $object->save(); |
| 237 | 237 | } |
@@ -242,27 +242,27 @@ discard block |
||
| 242 | 242 | $param = array( |
| 243 | 243 | 'site' => 'unittest', 'lang' => 'de', |
| 244 | 244 | 'filter' => array( |
| 245 | - 'key' => array( 0 => 'attribute.code' ), |
|
| 246 | - 'op' => array( 0 => '==' ), |
|
| 247 | - 'val' => array( 0 => '30' ), |
|
| 245 | + 'key' => array(0 => 'attribute.code'), |
|
| 246 | + 'op' => array(0 => '=='), |
|
| 247 | + 'val' => array(0 => '30'), |
|
| 248 | 248 | ), |
| 249 | - 'sort' => array( 'attribute.label', '-attribute.id' ), |
|
| 249 | + 'sort' => array('attribute.label', '-attribute.id'), |
|
| 250 | 250 | ); |
| 251 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 252 | - $this->view->addHelper( 'param', $helper ); |
|
| 251 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 252 | + $this->view->addHelper('param', $helper); |
|
| 253 | 253 | |
| 254 | 254 | $result = $this->object->search(); |
| 255 | 255 | |
| 256 | - $this->assertContains( '>30<', $result ); |
|
| 256 | + $this->assertContains('>30<', $result); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | public function testSearchException() |
| 261 | 261 | { |
| 262 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 262 | + $object = $this->getClientMock('initCriteria'); |
|
| 263 | 263 | |
| 264 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 265 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 264 | + $object->expects($this->once())->method('initCriteria') |
|
| 265 | + ->will($this->throwException(new \RuntimeException())); |
|
| 266 | 266 | |
| 267 | 267 | $object->search(); |
| 268 | 268 | } |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function testSearchMShopException() |
| 272 | 272 | { |
| 273 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 273 | + $object = $this->getClientMock('initCriteria'); |
|
| 274 | 274 | |
| 275 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 276 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 275 | + $object->expects($this->once())->method('initCriteria') |
|
| 276 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 277 | 277 | |
| 278 | 278 | $object->search(); |
| 279 | 279 | } |
@@ -281,34 +281,34 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | public function testGetSubClient() |
| 283 | 283 | { |
| 284 | - $result = $this->object->getSubClient( 'image' ); |
|
| 285 | - $this->assertInstanceOf( '\Aimeos\Admin\JQAdm\Iface', $result ); |
|
| 284 | + $result = $this->object->getSubClient('image'); |
|
| 285 | + $this->assertInstanceOf('\Aimeos\Admin\JQAdm\Iface', $result); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | public function testGetSubClientInvalid() |
| 290 | 290 | { |
| 291 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 292 | - $this->object->getSubClient( '$unknown$' ); |
|
| 291 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 292 | + $this->object->getSubClient('$unknown$'); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | |
| 296 | 296 | public function testGetSubClientUnknown() |
| 297 | 297 | { |
| 298 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 299 | - $this->object->getSubClient( 'unknown' ); |
|
| 298 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 299 | + $this->object->getSubClient('unknown'); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
| 303 | - public function getClientMock( $method ) |
|
| 303 | + public function getClientMock($method) |
|
| 304 | 304 | { |
| 305 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Attribute\Standard' ) |
|
| 306 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
| 307 | - ->setMethods( [$method] ) |
|
| 305 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Attribute\Standard') |
|
| 306 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
| 307 | + ->setMethods([$method]) |
|
| 308 | 308 | ->getMock(); |
| 309 | 309 | |
| 310 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 311 | - $object->setView( $this->getViewNoRender() ); |
|
| 310 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 311 | + $object->setView($this->getViewNoRender()); |
|
| 312 | 312 | |
| 313 | 313 | return $object; |
| 314 | 314 | } |
@@ -316,19 +316,19 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | protected function getViewNoRender() |
| 318 | 318 | { |
| 319 | - $view = $this->getMockBuilder( '\Aimeos\MW\View\Standard' ) |
|
| 320 | - ->setConstructorArgs( array( [] ) ) |
|
| 321 | - ->setMethods( array( 'render', 'config' ) ) |
|
| 319 | + $view = $this->getMockBuilder('\Aimeos\MW\View\Standard') |
|
| 320 | + ->setConstructorArgs(array([])) |
|
| 321 | + ->setMethods(array('render', 'config')) |
|
| 322 | 322 | ->getMock(); |
| 323 | 323 | |
| 324 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
| 324 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
| 325 | 325 | |
| 326 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( '30', [], 'product', 'length' )->getId()]; |
|
| 327 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
| 328 | - $view->addHelper( 'param', $helper ); |
|
| 326 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('30', [], 'product', 'length')->getId()]; |
|
| 327 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
| 328 | + $view->addHelper('param', $helper); |
|
| 329 | 329 | |
| 330 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
| 331 | - $view->addHelper( 'access', $helper ); |
|
| 330 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
| 331 | + $view->addHelper('access', $helper); |
|
| 332 | 332 | |
| 333 | 333 | return $view; |
| 334 | 334 | } |
@@ -295,6 +295,9 @@ |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
| 298 | + /** |
|
| 299 | + * @param string $method |
|
| 300 | + */ |
|
| 298 | 301 | public function getClientMock( $method ) |
| 299 | 302 | { |
| 300 | 303 | $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Catalog\Standard' ) |
@@ -21,43 +21,43 @@ discard block |
||
| 21 | 21 | $this->view = \TestHelperJqadm::getView(); |
| 22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
| 23 | 23 | |
| 24 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 25 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
| 26 | - $this->view ->addHelper( 'request', $helper ); |
|
| 27 | - |
|
| 28 | - $this->object = new \Aimeos\Admin\JQAdm\Catalog\Standard( $this->context ); |
|
| 29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
| 30 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 31 | - $this->object->setView( $this->view ); |
|
| 24 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 25 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
| 26 | + $this->view ->addHelper('request', $helper); |
|
| 27 | + |
|
| 28 | + $this->object = new \Aimeos\Admin\JQAdm\Catalog\Standard($this->context); |
|
| 29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
| 30 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 31 | + $this->object->setView($this->view); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->view, $this->context ); |
|
| 37 | + unset($this->object, $this->view, $this->context); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | public function testCopy() |
| 42 | 42 | { |
| 43 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
| 43 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
| 44 | 44 | |
| 45 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'cafe' )->getId()]; |
|
| 46 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 47 | - $this->view->addHelper( 'param', $helper ); |
|
| 45 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('cafe')->getId()]; |
|
| 46 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 47 | + $this->view->addHelper('param', $helper); |
|
| 48 | 48 | |
| 49 | 49 | $result = $this->object->copy(); |
| 50 | 50 | |
| 51 | - $this->assertContains( 'cafe_copy', $result ); |
|
| 51 | + $this->assertContains('cafe_copy', $result); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testCopyException() |
| 56 | 56 | { |
| 57 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 57 | + $object = $this->getClientMock('getSubClients'); |
|
| 58 | 58 | |
| 59 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 60 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 59 | + $object->expects($this->once())->method('getSubClients') |
|
| 60 | + ->will($this->throwException(new \RuntimeException())); |
|
| 61 | 61 | |
| 62 | 62 | $object->copy(); |
| 63 | 63 | } |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function testCopyMShopException() |
| 67 | 67 | { |
| 68 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 68 | + $object = $this->getClientMock('getSubClients'); |
|
| 69 | 69 | |
| 70 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 71 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 70 | + $object->expects($this->once())->method('getSubClients') |
|
| 71 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 72 | 72 | |
| 73 | 73 | $object->copy(); |
| 74 | 74 | } |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | public function testCreate() |
| 78 | 78 | { |
| 79 | - $this->assertContains( 'item-catalog', $this->object->create() ); |
|
| 79 | + $this->assertContains('item-catalog', $this->object->create()); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | public function testCreateException() |
| 84 | 84 | { |
| 85 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 85 | + $object = $this->getClientMock('getSubClients'); |
|
| 86 | 86 | |
| 87 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 88 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 87 | + $object->expects($this->once())->method('getSubClients') |
|
| 88 | + ->will($this->throwException(new \RuntimeException())); |
|
| 89 | 89 | |
| 90 | 90 | $object->create(); |
| 91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function testCreateMShopException() |
| 95 | 95 | { |
| 96 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 96 | + $object = $this->getClientMock('getSubClients'); |
|
| 97 | 97 | |
| 98 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 99 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 98 | + $object->expects($this->once())->method('getSubClients') |
|
| 99 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 100 | 100 | |
| 101 | 101 | $object->create(); |
| 102 | 102 | } |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function testDelete() |
| 106 | 106 | { |
| 107 | - $this->assertNotNull( $this->object->delete() ); |
|
| 107 | + $this->assertNotNull($this->object->delete()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | public function testDeleteException() |
| 112 | 112 | { |
| 113 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 113 | + $object = $this->getClientMock('getSubClients'); |
|
| 114 | 114 | |
| 115 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 116 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 115 | + $object->expects($this->once())->method('getSubClients') |
|
| 116 | + ->will($this->throwException(new \RuntimeException())); |
|
| 117 | 117 | |
| 118 | 118 | $object->delete(); |
| 119 | 119 | } |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | public function testDeleteMShopException() |
| 123 | 123 | { |
| 124 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 124 | + $object = $this->getClientMock('getSubClients'); |
|
| 125 | 125 | |
| 126 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 127 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 126 | + $object->expects($this->once())->method('getSubClients') |
|
| 127 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 128 | 128 | |
| 129 | 129 | $object->delete(); |
| 130 | 130 | } |
@@ -132,24 +132,24 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function testGet() |
| 134 | 134 | { |
| 135 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
| 135 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
| 136 | 136 | |
| 137 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'cafe' )->getId()]; |
|
| 138 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 139 | - $this->view->addHelper( 'param', $helper ); |
|
| 137 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('cafe')->getId()]; |
|
| 138 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 139 | + $this->view->addHelper('param', $helper); |
|
| 140 | 140 | |
| 141 | 141 | $result = $this->object->get(); |
| 142 | 142 | |
| 143 | - $this->assertContains( 'cafe', $result ); |
|
| 143 | + $this->assertContains('cafe', $result); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | public function testGetException() |
| 148 | 148 | { |
| 149 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 149 | + $object = $this->getClientMock('getSubClients'); |
|
| 150 | 150 | |
| 151 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 152 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 151 | + $object->expects($this->once())->method('getSubClients') |
|
| 152 | + ->will($this->throwException(new \RuntimeException())); |
|
| 153 | 153 | |
| 154 | 154 | $object->get(); |
| 155 | 155 | } |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function testGetMShopException() |
| 159 | 159 | { |
| 160 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 160 | + $object = $this->getClientMock('getSubClients'); |
|
| 161 | 161 | |
| 162 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
| 163 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 162 | + $object->expects($this->once())->method('getSubClients') |
|
| 163 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 164 | 164 | |
| 165 | 165 | $object->get(); |
| 166 | 166 | } |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | public function testGetViewException() |
| 170 | 170 | { |
| 171 | - $object = new \Aimeos\Admin\JQAdm\Catalog\Standard( $this->context, [] ); |
|
| 171 | + $object = new \Aimeos\Admin\JQAdm\Catalog\Standard($this->context, []); |
|
| 172 | 172 | |
| 173 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 173 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 174 | 174 | $object->getView(); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -187,31 +187,31 @@ discard block |
||
| 187 | 187 | 'catalog.datestart' => null, |
| 188 | 188 | 'catalog.dateend' => null, |
| 189 | 189 | 'config' => array( |
| 190 | - 'key' => array( 0 => 'test key' ), |
|
| 191 | - 'val' => array( 0 => 'test value' ), |
|
| 190 | + 'key' => array(0 => 'test key'), |
|
| 191 | + 'val' => array(0 => 'test value'), |
|
| 192 | 192 | ), |
| 193 | 193 | ), |
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 197 | - $this->view->addHelper( 'param', $helper ); |
|
| 196 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 197 | + $this->view->addHelper('param', $helper); |
|
| 198 | 198 | |
| 199 | 199 | $this->object->save(); |
| 200 | 200 | |
| 201 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
| 202 | - $item = $manager->findItem( 'jqadm catalog test' ); |
|
| 203 | - $manager->deleteItem( $item->getId() ); |
|
| 201 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
| 202 | + $item = $manager->findItem('jqadm catalog test'); |
|
| 203 | + $manager->deleteItem($item->getId()); |
|
| 204 | 204 | |
| 205 | - $this->assertEquals( ['test key' => 'test value'], $item->getConfig() ); |
|
| 205 | + $this->assertEquals(['test key' => 'test value'], $item->getConfig()); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | public function testSaveException() |
| 210 | 210 | { |
| 211 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 211 | + $object = $this->getClientMock('fromArray'); |
|
| 212 | 212 | |
| 213 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 214 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 213 | + $object->expects($this->once())->method('fromArray') |
|
| 214 | + ->will($this->throwException(new \RuntimeException())); |
|
| 215 | 215 | |
| 216 | 216 | $object->save(); |
| 217 | 217 | } |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | public function testSaveMShopException() |
| 221 | 221 | { |
| 222 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 222 | + $object = $this->getClientMock('fromArray'); |
|
| 223 | 223 | |
| 224 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 225 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 224 | + $object->expects($this->once())->method('fromArray') |
|
| 225 | + ->will($this->throwException(new \RuntimeException())); |
|
| 226 | 226 | |
| 227 | 227 | $object->save(); |
| 228 | 228 | } |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | public function testSaveJQAdmException() |
| 232 | 232 | { |
| 233 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 233 | + $object = $this->getClientMock('fromArray'); |
|
| 234 | 234 | |
| 235 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 236 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 235 | + $object->expects($this->once())->method('fromArray') |
|
| 236 | + ->will($this->throwException(new \RuntimeException())); |
|
| 237 | 237 | |
| 238 | 238 | $object->save(); |
| 239 | 239 | } |
@@ -241,22 +241,22 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | public function testSearch() |
| 243 | 243 | { |
| 244 | - $param = array( 'site' => 'unittest' ); |
|
| 245 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 246 | - $this->view->addHelper( 'param', $helper ); |
|
| 244 | + $param = array('site' => 'unittest'); |
|
| 245 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 246 | + $this->view->addHelper('param', $helper); |
|
| 247 | 247 | |
| 248 | 248 | $result = $this->object->search(); |
| 249 | 249 | |
| 250 | - $this->assertContains( '<div class="tree-content">', $result ); |
|
| 250 | + $this->assertContains('<div class="tree-content">', $result); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | public function testSearchException() |
| 255 | 255 | { |
| 256 | - $object = $this->getClientMock( 'getRootId' ); |
|
| 256 | + $object = $this->getClientMock('getRootId'); |
|
| 257 | 257 | |
| 258 | - $object->expects( $this->once() )->method( 'getRootId' ) |
|
| 259 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 258 | + $object->expects($this->once())->method('getRootId') |
|
| 259 | + ->will($this->throwException(new \RuntimeException())); |
|
| 260 | 260 | |
| 261 | 261 | $object->search(); |
| 262 | 262 | } |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | public function testSearchMShopException() |
| 266 | 266 | { |
| 267 | - $object = $this->getClientMock( 'getRootId' ); |
|
| 267 | + $object = $this->getClientMock('getRootId'); |
|
| 268 | 268 | |
| 269 | - $object->expects( $this->once() )->method( 'getRootId' ) |
|
| 270 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 269 | + $object->expects($this->once())->method('getRootId') |
|
| 270 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 271 | 271 | |
| 272 | 272 | $object->search(); |
| 273 | 273 | } |
@@ -275,34 +275,34 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | public function testGetSubClient() |
| 277 | 277 | { |
| 278 | - $result = $this->object->getSubClient( 'image' ); |
|
| 279 | - $this->assertInstanceOf( '\Aimeos\Admin\JQAdm\Iface', $result ); |
|
| 278 | + $result = $this->object->getSubClient('image'); |
|
| 279 | + $this->assertInstanceOf('\Aimeos\Admin\JQAdm\Iface', $result); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
| 283 | 283 | public function testGetSubClientInvalid() |
| 284 | 284 | { |
| 285 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 286 | - $this->object->getSubClient( '$unknown$' ); |
|
| 285 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 286 | + $this->object->getSubClient('$unknown$'); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | public function testGetSubClientUnknown() |
| 291 | 291 | { |
| 292 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 293 | - $this->object->getSubClient( 'unknown' ); |
|
| 292 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 293 | + $this->object->getSubClient('unknown'); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
| 297 | - public function getClientMock( $method ) |
|
| 297 | + public function getClientMock($method) |
|
| 298 | 298 | { |
| 299 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Catalog\Standard' ) |
|
| 300 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
| 301 | - ->setMethods( [$method] ) |
|
| 299 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Catalog\Standard') |
|
| 300 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
| 301 | + ->setMethods([$method]) |
|
| 302 | 302 | ->getMock(); |
| 303 | 303 | |
| 304 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 305 | - $object->setView( $this->getViewNoRender() ); |
|
| 304 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 305 | + $object->setView($this->getViewNoRender()); |
|
| 306 | 306 | |
| 307 | 307 | return $object; |
| 308 | 308 | } |
@@ -310,19 +310,19 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | protected function getViewNoRender() |
| 312 | 312 | { |
| 313 | - $view = $this->getMockBuilder( '\Aimeos\MW\View\Standard' ) |
|
| 314 | - ->setConstructorArgs( array( [] ) ) |
|
| 315 | - ->setMethods( array( 'render', 'config' ) ) |
|
| 313 | + $view = $this->getMockBuilder('\Aimeos\MW\View\Standard') |
|
| 314 | + ->setConstructorArgs(array([])) |
|
| 315 | + ->setMethods(array('render', 'config')) |
|
| 316 | 316 | ->getMock(); |
| 317 | 317 | |
| 318 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
| 318 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
| 319 | 319 | |
| 320 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'cafe' )->getId()]; |
|
| 321 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
| 322 | - $view->addHelper( 'param', $helper ); |
|
| 320 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('cafe')->getId()]; |
|
| 321 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
| 322 | + $view->addHelper('param', $helper); |
|
| 323 | 323 | |
| 324 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
| 325 | - $view->addHelper( 'access', $helper ); |
|
| 324 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
| 325 | + $view->addHelper('access', $helper); |
|
| 326 | 326 | |
| 327 | 327 | return $view; |
| 328 | 328 | } |
@@ -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 createClientBasePublic( \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::createClient( $this->context, 'Standard' ); |
|
| 33 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client ); |
|
| 32 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 35 | + $iClient = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $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::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 47 | + $new = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 55 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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', $result ); |
|
| 60 | + $this->assertInstanceOf('\Aimeos\Admin\JQAdm\Iface', $result); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function testAddDecoratorsInvalidName() |
| 65 | 65 | { |
| 66 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, 'Standard' ); |
|
| 66 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 75 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 85 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClient( $this->context, 'Standard' ); |
|
| 98 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
| 99 | + \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, 'Standard'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | public function testAddClientDecoratorsEmptyPath() |
| 104 | 104 | { |
| 105 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, 'Standard' ); |
|
| 105 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($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::createClientBasePublic( $this->context, 'Test', 'Test' ); |
|
| 114 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
| 115 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::createClientBasePublic($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 createClientBasePublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 136 | - $classname, $interface ) |
|
| 135 | + public static function createClientBasePublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 136 | + $classname, $interface) |
|
| 137 | 137 | { |
| 138 | - return self::createClientBase( $context, $classname, $interface ); |
|
| 138 | + return self::createClientBase($context, $classname, $interface); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -307,6 +307,9 @@ |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
| 310 | + /** |
|
| 311 | + * @param string $method |
|
| 312 | + */ |
|
| 310 | 313 | public function getClientMock( $method ) |
| 311 | 314 | { |
| 312 | 315 | $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Coupon\Standard' ) |
@@ -19,22 +19,22 @@ discard block |
||
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | 21 | $this->view = \TestHelperJqadm::getView(); |
| 22 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 23 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
| 24 | - $this->view ->addHelper( 'request', $helper ); |
|
| 22 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 23 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
| 24 | + $this->view ->addHelper('request', $helper); |
|
| 25 | 25 | |
| 26 | 26 | $this->context = \TestHelperJqadm::getContext(); |
| 27 | 27 | |
| 28 | - $this->object = new \Aimeos\Admin\JQAdm\Coupon\Standard( $this->context ); |
|
| 29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
| 30 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 31 | - $this->object->setView( $this->view ); |
|
| 28 | + $this->object = new \Aimeos\Admin\JQAdm\Coupon\Standard($this->context); |
|
| 29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
| 30 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 31 | + $this->object->setView($this->view); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->view, $this->context ); |
|
| 37 | + unset($this->object, $this->view, $this->context); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -42,16 +42,16 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $result = $this->object->create(); |
| 44 | 44 | |
| 45 | - $this->assertContains( 'item-coupon', $result ); |
|
| 45 | + $this->assertContains('item-coupon', $result); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | public function testCreateException() |
| 50 | 50 | { |
| 51 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 51 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 52 | 52 | |
| 53 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 54 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 53 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 54 | + ->will($this->throwException(new \RuntimeException())); |
|
| 55 | 55 | |
| 56 | 56 | $object->create(); |
| 57 | 57 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function testCreateMShopException() |
| 61 | 61 | { |
| 62 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 62 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 63 | 63 | |
| 64 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 65 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 64 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 65 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 66 | 66 | |
| 67 | 67 | $object->create(); |
| 68 | 68 | } |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | public function testCopy() |
| 72 | 72 | { |
| 73 | 73 | $param = ['site' => 'unittest', 'id' => $this->getCoupon()->getId()]; |
| 74 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 75 | - $this->view->addHelper( 'param', $helper ); |
|
| 74 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 75 | + $this->view->addHelper('param', $helper); |
|
| 76 | 76 | |
| 77 | 77 | $result = $this->object->copy(); |
| 78 | 78 | |
| 79 | - $this->assertContains( 'Unit test example', $result ); |
|
| 79 | + $this->assertContains('Unit test example', $result); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | public function testCopyException() |
| 84 | 84 | { |
| 85 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 85 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 86 | 86 | |
| 87 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 88 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 87 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 88 | + ->will($this->throwException(new \RuntimeException())); |
|
| 89 | 89 | |
| 90 | 90 | $object->copy(); |
| 91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function testCopyMShopException() |
| 95 | 95 | { |
| 96 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 96 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 97 | 97 | |
| 98 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 99 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 98 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 99 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 100 | 100 | |
| 101 | 101 | $object->copy(); |
| 102 | 102 | } |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function testDelete() |
| 106 | 106 | { |
| 107 | - $this->assertNotNull( $this->object->delete() ); |
|
| 107 | + $this->assertNotNull($this->object->delete()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | public function testDeleteException() |
| 112 | 112 | { |
| 113 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 113 | + $object = $this->getClientMock('getSubClients'); |
|
| 114 | 114 | |
| 115 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
| 116 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 115 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
| 116 | + ->will($this->throwException(new \RuntimeException())); |
|
| 117 | 117 | |
| 118 | 118 | $object->delete(); |
| 119 | 119 | } |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | public function testDeleteMShopException() |
| 123 | 123 | { |
| 124 | - $object = $this->getClientMock( 'getSubClients' ); |
|
| 124 | + $object = $this->getClientMock('getSubClients'); |
|
| 125 | 125 | |
| 126 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
| 127 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 126 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
| 127 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 128 | 128 | |
| 129 | 129 | $object->delete(); |
| 130 | 130 | } |
@@ -133,21 +133,21 @@ discard block |
||
| 133 | 133 | public function testGet() |
| 134 | 134 | { |
| 135 | 135 | $param = ['site' => 'unittest', 'id' => $this->getCoupon()->getId()]; |
| 136 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 137 | - $this->view->addHelper( 'param', $helper ); |
|
| 136 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 137 | + $this->view->addHelper('param', $helper); |
|
| 138 | 138 | |
| 139 | 139 | $result = $this->object->get(); |
| 140 | 140 | |
| 141 | - $this->assertContains( 'Unit test example', $result ); |
|
| 141 | + $this->assertContains('Unit test example', $result); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | public function testGetException() |
| 146 | 146 | { |
| 147 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 147 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 148 | 148 | |
| 149 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 150 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 149 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 150 | + ->will($this->throwException(new \RuntimeException())); |
|
| 151 | 151 | |
| 152 | 152 | $object->get(); |
| 153 | 153 | } |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function testGetMShopException() |
| 157 | 157 | { |
| 158 | - $object = $this->getClientMock( 'getSubClientNames' ); |
|
| 158 | + $object = $this->getClientMock('getSubClientNames'); |
|
| 159 | 159 | |
| 160 | - $object->expects( $this->once() )->method( 'getSubClientNames' ) |
|
| 161 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 160 | + $object->expects($this->once())->method('getSubClientNames') |
|
| 161 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 162 | 162 | |
| 163 | 163 | $object->get(); |
| 164 | 164 | } |
@@ -166,16 +166,16 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | public function testGetViewException() |
| 168 | 168 | { |
| 169 | - $object = new \Aimeos\Admin\JQAdm\Coupon\Standard( $this->context, [] ); |
|
| 169 | + $object = new \Aimeos\Admin\JQAdm\Coupon\Standard($this->context, []); |
|
| 170 | 170 | |
| 171 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 171 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 172 | 172 | $object->getView(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public function testSave() |
| 177 | 177 | { |
| 178 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'coupon' ); |
|
| 178 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'coupon'); |
|
| 179 | 179 | |
| 180 | 180 | $param = array( |
| 181 | 181 | 'site' => 'unittest', |
@@ -186,27 +186,27 @@ discard block |
||
| 186 | 186 | 'coupon.datestart' => null, |
| 187 | 187 | 'coupon.dateend' => null, |
| 188 | 188 | 'config' => array( |
| 189 | - 'key' => array( 0 => 'test key' ), |
|
| 190 | - 'val' => array( 0 => 'test value' ), |
|
| 189 | + 'key' => array(0 => 'test key'), |
|
| 190 | + 'val' => array(0 => 'test value'), |
|
| 191 | 191 | ), |
| 192 | 192 | ), |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 196 | - $this->view->addHelper( 'param', $helper ); |
|
| 195 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 196 | + $this->view->addHelper('param', $helper); |
|
| 197 | 197 | |
| 198 | 198 | $this->object->save(); |
| 199 | 199 | |
| 200 | - $manager->deleteItem( $this->getCoupon( 'jqadm test label' )->getId() ); |
|
| 200 | + $manager->deleteItem($this->getCoupon('jqadm test label')->getId()); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | public function testSaveException() |
| 205 | 205 | { |
| 206 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 206 | + $object = $this->getClientMock('fromArray'); |
|
| 207 | 207 | |
| 208 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 209 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 208 | + $object->expects($this->once())->method('fromArray') |
|
| 209 | + ->will($this->throwException(new \RuntimeException())); |
|
| 210 | 210 | |
| 211 | 211 | $object->save(); |
| 212 | 212 | } |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function testSaveMShopException() |
| 216 | 216 | { |
| 217 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 217 | + $object = $this->getClientMock('fromArray'); |
|
| 218 | 218 | |
| 219 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 220 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 219 | + $object->expects($this->once())->method('fromArray') |
|
| 220 | + ->will($this->throwException(new \RuntimeException())); |
|
| 221 | 221 | |
| 222 | 222 | $object->save(); |
| 223 | 223 | } |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | public function testSaveJQAdmException() |
| 227 | 227 | { |
| 228 | - $object = $this->getClientMock( 'fromArray' ); |
|
| 228 | + $object = $this->getClientMock('fromArray'); |
|
| 229 | 229 | |
| 230 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
| 231 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 230 | + $object->expects($this->once())->method('fromArray') |
|
| 231 | + ->will($this->throwException(new \RuntimeException())); |
|
| 232 | 232 | |
| 233 | 233 | $object->save(); |
| 234 | 234 | } |
@@ -239,27 +239,27 @@ discard block |
||
| 239 | 239 | $param = array( |
| 240 | 240 | 'site' => 'unittest', 'lang' => 'de', |
| 241 | 241 | 'filter' => array( |
| 242 | - 'key' => array( 0 => 'coupon.label' ), |
|
| 243 | - 'op' => array( 0 => '==' ), |
|
| 244 | - 'val' => array( 0 => 'Unit test example' ), |
|
| 242 | + 'key' => array(0 => 'coupon.label'), |
|
| 243 | + 'op' => array(0 => '=='), |
|
| 244 | + 'val' => array(0 => 'Unit test example'), |
|
| 245 | 245 | ), |
| 246 | - 'sort' => array( '-coupon.id' ), |
|
| 246 | + 'sort' => array('-coupon.id'), |
|
| 247 | 247 | ); |
| 248 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 249 | - $this->view->addHelper( 'param', $helper ); |
|
| 248 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 249 | + $this->view->addHelper('param', $helper); |
|
| 250 | 250 | |
| 251 | 251 | $result = $this->object->search(); |
| 252 | 252 | |
| 253 | - $this->assertContains( '>Unit test example<', $result ); |
|
| 253 | + $this->assertContains('>Unit test example<', $result); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | public function testSearchException() |
| 258 | 258 | { |
| 259 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 259 | + $object = $this->getClientMock('initCriteria'); |
|
| 260 | 260 | |
| 261 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 262 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 261 | + $object->expects($this->once())->method('initCriteria') |
|
| 262 | + ->will($this->throwException(new \RuntimeException())); |
|
| 263 | 263 | |
| 264 | 264 | $object->search(); |
| 265 | 265 | } |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | public function testSearchMShopException() |
| 269 | 269 | { |
| 270 | - $object = $this->getClientMock( 'initCriteria' ); |
|
| 270 | + $object = $this->getClientMock('initCriteria'); |
|
| 271 | 271 | |
| 272 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
| 273 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 272 | + $object->expects($this->once())->method('initCriteria') |
|
| 273 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 274 | 274 | |
| 275 | 275 | $object->search(); |
| 276 | 276 | } |
@@ -278,43 +278,43 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | public function testGetSubClient() |
| 280 | 280 | { |
| 281 | - $result = $this->object->getSubClient( 'code' ); |
|
| 282 | - $this->assertInstanceOf( '\Aimeos\Admin\JQAdm\Iface', $result ); |
|
| 281 | + $result = $this->object->getSubClient('code'); |
|
| 282 | + $this->assertInstanceOf('\Aimeos\Admin\JQAdm\Iface', $result); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
| 286 | 286 | public function testGetSubClientInvalid() |
| 287 | 287 | { |
| 288 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 289 | - $this->object->getSubClient( '$unknown$' ); |
|
| 288 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 289 | + $this->object->getSubClient('$unknown$'); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
| 293 | 293 | public function testGetSubClientUnknown() |
| 294 | 294 | { |
| 295 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 296 | - $this->object->getSubClient( 'unknown' ); |
|
| 295 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 296 | + $this->object->getSubClient('unknown'); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| 300 | 300 | public function testGetSubClientDecoratorInvalid() |
| 301 | 301 | { |
| 302 | - $this->context->getConfig()->set( 'admin/jqadm/coupon/code/decorators/global', array( 'Invalid' ) ); |
|
| 302 | + $this->context->getConfig()->set('admin/jqadm/coupon/code/decorators/global', array('Invalid')); |
|
| 303 | 303 | |
| 304 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
| 305 | - $this->object->getSubClient( 'code' ); |
|
| 304 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
| 305 | + $this->object->getSubClient('code'); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
| 309 | - public function getClientMock( $method ) |
|
| 309 | + public function getClientMock($method) |
|
| 310 | 310 | { |
| 311 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Coupon\Standard' ) |
|
| 312 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
| 313 | - ->setMethods( [$method] ) |
|
| 311 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Coupon\Standard') |
|
| 312 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
| 313 | + ->setMethods([$method]) |
|
| 314 | 314 | ->getMock(); |
| 315 | 315 | |
| 316 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
| 317 | - $object->setView( $this->getViewNoRender() ); |
|
| 316 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
| 317 | + $object->setView($this->getViewNoRender()); |
|
| 318 | 318 | |
| 319 | 319 | return $object; |
| 320 | 320 | } |
@@ -322,32 +322,32 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | protected function getViewNoRender() |
| 324 | 324 | { |
| 325 | - $view = $this->getMockBuilder( '\Aimeos\MW\View\Standard' ) |
|
| 326 | - ->setConstructorArgs( array( [] ) ) |
|
| 327 | - ->setMethods( array( 'render', 'config' ) ) |
|
| 325 | + $view = $this->getMockBuilder('\Aimeos\MW\View\Standard') |
|
| 326 | + ->setConstructorArgs(array([])) |
|
| 327 | + ->setMethods(array('render', 'config')) |
|
| 328 | 328 | ->getMock(); |
| 329 | 329 | |
| 330 | 330 | $param = ['site' => 'unittest', 'id' => $this->getCoupon()->getId()]; |
| 331 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
| 332 | - $view->addHelper( 'param', $helper ); |
|
| 331 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
| 332 | + $view->addHelper('param', $helper); |
|
| 333 | 333 | |
| 334 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
| 335 | - $view->addHelper( 'access', $helper ); |
|
| 334 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
| 335 | + $view->addHelper('access', $helper); |
|
| 336 | 336 | |
| 337 | 337 | return $view; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
| 341 | - protected function getCoupon( $label = 'Unit test example' ) |
|
| 341 | + protected function getCoupon($label = 'Unit test example') |
|
| 342 | 342 | { |
| 343 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'coupon' ); |
|
| 343 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'coupon'); |
|
| 344 | 344 | |
| 345 | 345 | $search = $manager->createSearch(); |
| 346 | - $search->setConditions( $search->compare( '==', 'coupon.label', $label ) ); |
|
| 347 | - $items = $manager->searchItems( $search ); |
|
| 346 | + $search->setConditions($search->compare('==', 'coupon.label', $label)); |
|
| 347 | + $items = $manager->searchItems($search); |
|
| 348 | 348 | |
| 349 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 350 | - throw new \RuntimeException( sprintf( 'No coupon for label "%1$s" found', $label ) ); |
|
| 349 | + if (($item = reset($items)) === false) { |
|
| 350 | + throw new \RuntimeException(sprintf('No coupon for label "%1$s" found', $label)); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $item; |