@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
44 | 44 | { |
45 | 45 | $result = []; |
46 | 46 | |
47 | - foreach( $order->getProducts() as $item ) |
|
47 | + foreach ($order->getProducts() as $item) |
|
48 | 48 | { |
49 | 49 | $data = []; |
50 | 50 | $list = $item->toArray(); |
51 | 51 | |
52 | - foreach( $item->getAttributeItems() as $attrItem ) |
|
52 | + foreach ($item->getAttributeItems() as $attrItem) |
|
53 | 53 | { |
54 | - foreach( $attrItem->toArray() as $key => $value ) |
|
54 | + foreach ($attrItem->toArray() as $key => $value) |
|
55 | 55 | { |
56 | - if( isset( $list[$key] ) ) { |
|
56 | + if (isset($list[$key])) { |
|
57 | 57 | $list[$key] .= "\n" . $value; |
58 | 58 | } else { |
59 | 59 | $list[$key] = $value; |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - foreach( $this->getMapping() as $pos => $key ) |
|
64 | + foreach ($this->getMapping() as $pos => $key) |
|
65 | 65 | { |
66 | - if( array_key_exists( $key, $list ) ) { |
|
66 | + if (array_key_exists($key, $list)) { |
|
67 | 67 | $data[$pos] = $list[$key]; |
68 | 68 | } else { |
69 | 69 | $data[$pos] = ''; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - ksort( $data ); |
|
73 | + ksort($data); |
|
74 | 74 | $result[] = $data; |
75 | 75 | } |
76 | 76 |
@@ -40,25 +40,25 @@ discard block |
||
40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
44 | 44 | { |
45 | 45 | $result = []; |
46 | 46 | $services = $order->getServices(); |
47 | 47 | |
48 | - krsort( $services ); |
|
48 | + krsort($services); |
|
49 | 49 | |
50 | - foreach( $services as $list ) |
|
50 | + foreach ($services as $list) |
|
51 | 51 | { |
52 | - foreach( $list as $item ) |
|
52 | + foreach ($list as $item) |
|
53 | 53 | { |
54 | 54 | $data = []; |
55 | 55 | $list = $item->toArray(); |
56 | 56 | |
57 | - foreach( $item->getAttributeItems() as $attrItem ) |
|
57 | + foreach ($item->getAttributeItems() as $attrItem) |
|
58 | 58 | { |
59 | - foreach( $attrItem->toArray() as $key => $value ) |
|
59 | + foreach ($attrItem->toArray() as $key => $value) |
|
60 | 60 | { |
61 | - if( isset( $list[$key] ) ) { |
|
61 | + if (isset($list[$key])) { |
|
62 | 62 | $list[$key] .= "\n" . $value; |
63 | 63 | } else { |
64 | 64 | $list[$key] = $value; |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - foreach( $this->getMapping() as $pos => $key ) |
|
69 | + foreach ($this->getMapping() as $pos => $key) |
|
70 | 70 | { |
71 | - if( array_key_exists( $key, $list ) ) { |
|
71 | + if (array_key_exists($key, $list)) { |
|
72 | 72 | $data[$pos] = $list[$key]; |
73 | 73 | } else { |
74 | 74 | $data[$pos] = ''; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - ksort( $data ); |
|
78 | + ksort($data); |
|
79 | 79 | $result[] = $data; |
80 | 80 | } |
81 | 81 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product site map' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product site map'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Creates a product site map for search engines' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates a product site map for search engines'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $container = $this->createContainer(); |
54 | 54 | |
55 | - $files = $this->export( $container ); |
|
56 | - $this->createSitemapIndex( $container, $files ); |
|
55 | + $files = $this->export($container); |
|
56 | + $this->createSitemapIndex($container, $files); |
|
57 | 57 | |
58 | 58 | $container->close(); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param \Aimeos\MW\Container\Content\Iface $content File content object |
66 | 66 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items |
67 | 67 | */ |
68 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) |
|
68 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) |
|
69 | 69 | { |
70 | 70 | $config = $this->getContext()->getConfig(); |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @see controller/jobs/product/export/sitemap/max-items |
97 | 97 | * @see controller/jobs/product/export/sitemap/max-query |
98 | 98 | */ |
99 | - $changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' ); |
|
99 | + $changefreq = $config->get('controller/jobs/product/export/sitemap/changefreq', 'daily'); |
|
100 | 100 | |
101 | 101 | /** controller/jobs/product/export/sitemap/standard/template-items |
102 | 102 | * Relative path to the XML items template of the product site map job controller. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $view->siteItems = $items; |
130 | 130 | $view->siteFreq = $changefreq; |
131 | 131 | |
132 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
132 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @see controller/jobs/product/export/sitemap/max-query |
176 | 176 | * @see controller/jobs/product/export/sitemap/changefreq |
177 | 177 | */ |
178 | - $location = $config->get( 'controller/jobs/product/export/sitemap/location' ); |
|
178 | + $location = $config->get('controller/jobs/product/export/sitemap/location'); |
|
179 | 179 | |
180 | 180 | /** controller/jobs/product/export/sitemap/container/options |
181 | 181 | * List of file container options for the site map files |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | * @see controller/jobs/product/export/sitemap/max-query |
197 | 197 | * @see controller/jobs/product/export/sitemap/changefreq |
198 | 198 | */ |
199 | - $default = array( 'gzip-mode' => 'wb' ); |
|
200 | - $options = $config->get( 'controller/jobs/product/export/sitemap/container/options', $default ); |
|
199 | + $default = array('gzip-mode' => 'wb'); |
|
200 | + $options = $config->get('controller/jobs/product/export/sitemap/container/options', $default); |
|
201 | 201 | |
202 | - if( $location === null ) |
|
202 | + if ($location === null) |
|
203 | 203 | { |
204 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location' ); |
|
205 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
204 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location'); |
|
205 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
206 | 206 | } |
207 | 207 | |
208 | - return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options ); |
|
208 | + return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param integer $filenum New file number |
217 | 217 | * @return \Aimeos\MW\Container\Content\Iface New content object |
218 | 218 | */ |
219 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
219 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
220 | 220 | { |
221 | 221 | /** controller/jobs/product/export/sitemap/standard/template-header |
222 | 222 | * Relative path to the XML site map header template of the product site map job controller. |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $context = $this->getContext(); |
247 | 247 | $view = $context->getView(); |
248 | 248 | |
249 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
250 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
251 | - $container->add( $content ); |
|
249 | + $content = $container->create($this->getFilename($filenum)); |
|
250 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
251 | + $container->add($content); |
|
252 | 252 | |
253 | 253 | return $content; |
254 | 254 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param \Aimeos\MW\Container\Content\Iface $content |
261 | 261 | */ |
262 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
262 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
263 | 263 | { |
264 | 264 | /** controller/jobs/product/export/sitemap/standard/template-footer |
265 | 265 | * Relative path to the XML site map footer template of the product site map job controller. |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $context = $this->getContext(); |
290 | 290 | $view = $context->getView(); |
291 | 291 | |
292 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
292 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param \Aimeos\MW\Container\Iface $container File container object |
300 | 300 | * @param array $files List of generated site map file names |
301 | 301 | */ |
302 | - protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) |
|
302 | + protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files) |
|
303 | 303 | { |
304 | 304 | /** controller/jobs/product/export/sitemap/standard/template-index |
305 | 305 | * Relative path to the XML site map index template of the product site map job controller. |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | |
332 | 332 | $view->siteFiles = $files; |
333 | 333 | |
334 | - $content = $container->create( 'aimeos-sitemap-index.xml' ); |
|
335 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
336 | - $container->add( $content ); |
|
334 | + $content = $container->create('aimeos-sitemap-index.xml'); |
|
335 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
336 | + $container->add($content); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -344,44 +344,44 @@ discard block |
||
344 | 344 | * @param boolean $default True to filter exported products by default criteria |
345 | 345 | * @return array List of content (file) names |
346 | 346 | */ |
347 | - protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) |
|
347 | + protected function export(\Aimeos\MW\Container\Iface $container, $default = true) |
|
348 | 348 | { |
349 | - $domains = $this->getConfig( 'domains', [] ); |
|
350 | - $maxItems = $this->getConfig( 'max-items', 10000 ); |
|
351 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); |
|
349 | + $domains = $this->getConfig('domains', []); |
|
350 | + $maxItems = $this->getConfig('max-items', 10000); |
|
351 | + $maxQuery = $this->getConfig('max-query', 1000); |
|
352 | 352 | |
353 | 353 | $start = 0; $filenum = 1; |
354 | 354 | $names = []; |
355 | 355 | |
356 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' ); |
|
356 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'index'); |
|
357 | 357 | |
358 | - $search = $manager->createSearch( $default ); |
|
359 | - $search->setConditions( $search->compare( '!=', 'index.catalog.id', null ) ); |
|
360 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
361 | - $search->setSlice( 0, $maxQuery ); |
|
358 | + $search = $manager->createSearch($default); |
|
359 | + $search->setConditions($search->compare('!=', 'index.catalog.id', null)); |
|
360 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
361 | + $search->setSlice(0, $maxQuery); |
|
362 | 362 | |
363 | - $content = $this->createContent( $container, $filenum ); |
|
363 | + $content = $this->createContent($container, $filenum); |
|
364 | 364 | $names[] = $content->getResource(); |
365 | 365 | |
366 | 366 | do |
367 | 367 | { |
368 | - $items = $manager->searchItems( $search, $domains ); |
|
369 | - $this->addItems( $content, $items ); |
|
368 | + $items = $manager->searchItems($search, $domains); |
|
369 | + $this->addItems($content, $items); |
|
370 | 370 | |
371 | - $count = count( $items ); |
|
371 | + $count = count($items); |
|
372 | 372 | $start += $count; |
373 | - $search->setSlice( $start, $maxQuery ); |
|
373 | + $search->setSlice($start, $maxQuery); |
|
374 | 374 | |
375 | - if( $start + $maxQuery > $maxItems * $filenum ) |
|
375 | + if ($start + $maxQuery > $maxItems * $filenum) |
|
376 | 376 | { |
377 | - $this->closeContent( $content ); |
|
378 | - $content = $this->createContent( $container, ++$filenum ); |
|
377 | + $this->closeContent($content); |
|
378 | + $content = $this->createContent($container, ++$filenum); |
|
379 | 379 | $names[] = $content->getResource(); |
380 | 380 | } |
381 | 381 | } |
382 | - while( $count >= $search->getSliceSize() ); |
|
382 | + while ($count >= $search->getSliceSize()); |
|
383 | 383 | |
384 | - $this->closeContent( $content ); |
|
384 | + $this->closeContent($content); |
|
385 | 385 | |
386 | 386 | return $names; |
387 | 387 | } |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * @param mixed $default Default value if name is unknown |
395 | 395 | * @return mixed Configuration value |
396 | 396 | */ |
397 | - protected function getConfig( $name, $default = null ) |
|
397 | + protected function getConfig($name, $default = null) |
|
398 | 398 | { |
399 | 399 | $config = $this->getContext()->getConfig(); |
400 | 400 | |
401 | - switch( $name ) |
|
401 | + switch ($name) |
|
402 | 402 | { |
403 | 403 | case 'domains': |
404 | 404 | /** controller/jobs/product/export/sitemap/domains |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @see controller/jobs/product/export/sitemap/max-query |
420 | 420 | * @see controller/jobs/product/export/sitemap/changefreq |
421 | 421 | */ |
422 | - return $config->get( 'controller/jobs/product/export/sitemap/domains', $default ); |
|
422 | + return $config->get('controller/jobs/product/export/sitemap/domains', $default); |
|
423 | 423 | |
424 | 424 | case 'max-items': |
425 | 425 | /** controller/jobs/product/export/sitemap/max-items |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @see controller/jobs/product/export/sitemap/changefreq |
445 | 445 | * @see controller/jobs/product/export/sitemap/domains |
446 | 446 | */ |
447 | - return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); |
|
447 | + return $config->get('controller/jobs/product/export/sitemap/max-items', 50000); |
|
448 | 448 | |
449 | 449 | case 'max-query': |
450 | 450 | /** controller/jobs/product/export/sitemap/max-query |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @see controller/jobs/product/export/sitemap/changefreq |
466 | 466 | * @see controller/jobs/product/export/sitemap/domains |
467 | 467 | */ |
468 | - return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); |
|
468 | + return $config->get('controller/jobs/product/export/sitemap/max-query', 1000); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | return $default; |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param integer $number Current file number |
479 | 479 | * @return string New file name |
480 | 480 | */ |
481 | - protected function getFilename( $number ) |
|
481 | + protected function getFilename($number) |
|
482 | 482 | { |
483 | - return sprintf( 'aimeos-sitemap-%d.xml', $number ); |
|
483 | + return sprintf('aimeos-sitemap-%d.xml', $number); |
|
484 | 484 | } |
485 | 485 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Process order delivery services', $this->object->getName() ); |
|
35 | + $this->assertEquals('Process order delivery services', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | 41 | $text = 'Sends paid orders to the ERP system or logistic partner'; |
42 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
42 | + $this->assertEquals($text, $this->object->getDescription()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,47 +50,47 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
53 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
54 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
53 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
54 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
55 | 55 | |
56 | 56 | |
57 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
58 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
59 | - ->setConstructorArgs( array( $context ) ) |
|
57 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
58 | + ->setMethods(array('getProvider', 'searchItems')) |
|
59 | + ->setConstructorArgs(array($context)) |
|
60 | 60 | ->getMock(); |
61 | 61 | |
62 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
63 | - ->setMethods( array( 'saveItems', 'searchItems' ) ) |
|
64 | - ->setConstructorArgs( array( $context ) ) |
|
62 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
63 | + ->setMethods(array('saveItems', 'searchItems')) |
|
64 | + ->setConstructorArgs(array($context)) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
68 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
67 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
68 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | $serviceItem = $serviceManagerStub->createItem(); |
72 | 72 | $orderItem = $orderManagerStub->createItem(); |
73 | 73 | |
74 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
75 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
74 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
75 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
76 | 76 | ->getMock(); |
77 | 77 | |
78 | 78 | |
79 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
80 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
79 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
80 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
81 | 81 | |
82 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
83 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
82 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
83 | + ->will($this->returnValue($serviceProviderStub)); |
|
84 | 84 | |
85 | - $orderManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
86 | - ->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) ); |
|
85 | + $orderManagerStub->expects($this->once())->method('searchItems') |
|
86 | + ->will($this->onConsecutiveCalls(array($orderItem), [])); |
|
87 | 87 | |
88 | - $serviceProviderStub->expects( $this->once() )->method( 'processBatch' ); |
|
88 | + $serviceProviderStub->expects($this->once())->method('processBatch'); |
|
89 | 89 | |
90 | - $orderManagerStub->expects( $this->once() )->method( 'saveItems' ); |
|
90 | + $orderManagerStub->expects($this->once())->method('saveItems'); |
|
91 | 91 | |
92 | 92 | |
93 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
93 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
94 | 94 | $object->run(); |
95 | 95 | } |
96 | 96 | |
@@ -102,48 +102,48 @@ discard block |
||
102 | 102 | |
103 | 103 | |
104 | 104 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
105 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
106 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
105 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
106 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
107 | 107 | |
108 | 108 | |
109 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
110 | - ->setMethods( array( 'saveItems', 'searchItems' ) ) |
|
111 | - ->setConstructorArgs( array( $context ) ) |
|
109 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
110 | + ->setMethods(array('saveItems', 'searchItems')) |
|
111 | + ->setConstructorArgs(array($context)) |
|
112 | 112 | ->getMock(); |
113 | 113 | |
114 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
115 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
116 | - ->setConstructorArgs( array( $context ) ) |
|
114 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
115 | + ->setMethods(array('getProvider', 'searchItems')) |
|
116 | + ->setConstructorArgs(array($context)) |
|
117 | 117 | ->getMock(); |
118 | 118 | |
119 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
120 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
119 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
120 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | $serviceItem = $serviceManagerStub->createItem(); |
124 | 124 | $orderItem = $orderManagerStub->createItem(); |
125 | 125 | |
126 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
127 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
126 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
127 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
128 | 128 | ->getMock(); |
129 | 129 | |
130 | 130 | |
131 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
132 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
131 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
132 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
133 | 133 | |
134 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
135 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
134 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
135 | + ->will($this->returnValue($serviceProviderStub)); |
|
136 | 136 | |
137 | - $orderManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
138 | - ->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) ); |
|
137 | + $orderManagerStub->expects($this->once())->method('searchItems') |
|
138 | + ->will($this->onConsecutiveCalls(array($orderItem), [])); |
|
139 | 139 | |
140 | - $serviceProviderStub->expects( $this->once() )->method( 'processBatch' ) |
|
141 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test order service delivery: process' ) ) ); |
|
140 | + $serviceProviderStub->expects($this->once())->method('processBatch') |
|
141 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception('test order service delivery: process'))); |
|
142 | 142 | |
143 | - $orderManagerStub->expects( $this->never() )->method( 'saveItems' ); |
|
143 | + $orderManagerStub->expects($this->never())->method('saveItems'); |
|
144 | 144 | |
145 | 145 | |
146 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
146 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
147 | 147 | $object->run(); |
148 | 148 | } |
149 | 149 | |
@@ -155,36 +155,36 @@ discard block |
||
155 | 155 | |
156 | 156 | |
157 | 157 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
158 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
159 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
158 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
159 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
160 | 160 | |
161 | 161 | |
162 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
163 | - ->setMethods( array( 'saveItem', 'searchItems' ) ) |
|
164 | - ->setConstructorArgs( array( $context ) ) |
|
162 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
163 | + ->setMethods(array('saveItem', 'searchItems')) |
|
164 | + ->setConstructorArgs(array($context)) |
|
165 | 165 | ->getMock(); |
166 | 166 | |
167 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
168 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
169 | - ->setConstructorArgs( array( $context ) ) |
|
167 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
168 | + ->setMethods(array('getProvider', 'searchItems')) |
|
169 | + ->setConstructorArgs(array($context)) |
|
170 | 170 | ->getMock(); |
171 | 171 | |
172 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
173 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
172 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
173 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
174 | 174 | |
175 | 175 | |
176 | 176 | $serviceItem = $serviceManagerStub->createItem(); |
177 | 177 | |
178 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
179 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
178 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
179 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
180 | 180 | |
181 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
182 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test sorder service delivery: getProvider' ) ) ); |
|
181 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
182 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception('test sorder service delivery: getProvider'))); |
|
183 | 183 | |
184 | - $orderManagerStub->expects( $this->never() )->method( 'searchItems' ); |
|
184 | + $orderManagerStub->expects($this->never())->method('searchItems'); |
|
185 | 185 | |
186 | 186 | |
187 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
187 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
188 | 188 | $object->run(); |
189 | 189 | } |
190 | 190 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Batch update of payment/delivery status', $this->object->getName() ); |
|
35 | + $this->assertEquals('Batch update of payment/delivery status', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | 41 | $text = 'Executes payment or delivery service providers that uses batch updates'; |
42 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
42 | + $this->assertEquals($text, $this->object->getDescription()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $name = 'ControllerJobsServiceAsyncProcessDefaultRun'; |
53 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
53 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
54 | 54 | |
55 | 55 | |
56 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
57 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
58 | - ->setConstructorArgs( array( $context ) ) |
|
56 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
57 | + ->setMethods(array('getProvider', 'searchItems')) |
|
58 | + ->setConstructorArgs(array($context)) |
|
59 | 59 | ->getMock(); |
60 | 60 | |
61 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
61 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
62 | 62 | |
63 | 63 | |
64 | 64 | $serviceItem = $serviceManagerStub->createItem(); |
65 | 65 | |
66 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
67 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
66 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
67 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
68 | 68 | ->getMock(); |
69 | 69 | |
70 | 70 | |
71 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
72 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
71 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
72 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
73 | 73 | |
74 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
75 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
74 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
75 | + ->will($this->returnValue($serviceProviderStub)); |
|
76 | 76 | |
77 | - $serviceProviderStub->expects( $this->once() )->method( 'updateAsync' ); |
|
77 | + $serviceProviderStub->expects($this->once())->method('updateAsync'); |
|
78 | 78 | |
79 | 79 | |
80 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
80 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
81 | 81 | $object->run(); |
82 | 82 | } |
83 | 83 | |
@@ -89,27 +89,27 @@ discard block |
||
89 | 89 | |
90 | 90 | |
91 | 91 | $name = 'ControllerJobsServiceAsyncProcessDefaultRun'; |
92 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
92 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
93 | 93 | |
94 | 94 | |
95 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
96 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
97 | - ->setConstructorArgs( array( $context ) ) |
|
95 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
96 | + ->setMethods(array('getProvider', 'searchItems')) |
|
97 | + ->setConstructorArgs(array($context)) |
|
98 | 98 | ->getMock(); |
99 | 99 | |
100 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
100 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | $serviceItem = $serviceManagerStub->createItem(); |
104 | 104 | |
105 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
106 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
105 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
106 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
107 | 107 | |
108 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
109 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception() ) ); |
|
108 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
109 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception())); |
|
110 | 110 | |
111 | 111 | |
112 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
112 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
113 | 113 | $object->run(); |
114 | 114 | } |
115 | 115 | } |
@@ -210,6 +210,9 @@ |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | + /** |
|
214 | + * @param string $name |
|
215 | + */ |
|
213 | 216 | protected function access( $name ) |
214 | 217 | { |
215 | 218 | $class = new \ReflectionClass( '\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard' ); |
@@ -21,62 +21,62 @@ discard block |
||
21 | 21 | $this->aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | $this->context = \TestHelperJobs::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard( $this->context, $this->aimeos ); |
|
24 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard($this->context, $this->aimeos); |
|
25 | 25 | |
26 | - \Aimeos\MShop\Factory::setCache( true ); |
|
26 | + \Aimeos\MShop\Factory::setCache(true); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
32 | + \Aimeos\MShop\Factory::setCache(false); |
|
33 | 33 | \Aimeos\MShop\Factory::clear(); |
34 | 34 | |
35 | - unset( $this->object, $this->context, $this->aimeos ); |
|
35 | + unset($this->object, $this->context, $this->aimeos); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetName() |
40 | 40 | { |
41 | - $this->assertEquals( 'Subscription process renew', $this->object->getName() ); |
|
41 | + $this->assertEquals('Subscription process renew', $this->object->getName()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testGetDescription() |
46 | 46 | { |
47 | - $this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() ); |
|
47 | + $this->assertEquals('Renews subscriptions at next date', $this->object->getDescription()); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testRun() |
52 | 52 | { |
53 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
53 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
54 | 54 | $item = $this->getSubscription(); |
55 | 55 | |
56 | - $object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' ) |
|
57 | - ->setConstructorArgs( [$this->context, $this->aimeos] ) |
|
58 | - ->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] ) |
|
56 | + $object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard') |
|
57 | + ->setConstructorArgs([$this->context, $this->aimeos]) |
|
58 | + ->setMethods(['createOrderBase', 'createOrderInvoice', 'createPayment']) |
|
59 | 59 | ->getMock(); |
60 | 60 | |
61 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
62 | - ->setConstructorArgs( [$this->context] ) |
|
63 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
61 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
62 | + ->setConstructorArgs([$this->context]) |
|
63 | + ->setMethods(['searchItems', 'saveItem']) |
|
64 | 64 | ->getMock(); |
65 | 65 | |
66 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
66 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
67 | 67 | |
68 | - $object->expects( $this->once() )->method( 'createOrderBase' ) |
|
69 | - ->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) ); |
|
68 | + $object->expects($this->once())->method('createOrderBase') |
|
69 | + ->will($this->returnValue($this->getOrderBaseItem($item->getOrderBaseId()))); |
|
70 | 70 | |
71 | - $object->expects( $this->once() )->method( 'createOrderInvoice' ) |
|
72 | - ->will( $this->returnValue( $this->getOrderItem() ) ); |
|
71 | + $object->expects($this->once())->method('createOrderInvoice') |
|
72 | + ->will($this->returnValue($this->getOrderItem())); |
|
73 | 73 | |
74 | - $object->expects( $this->once() )->method( 'createPayment' ); |
|
74 | + $object->expects($this->once())->method('createPayment'); |
|
75 | 75 | |
76 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
77 | - ->will( $this->returnValue( [$item] ) ); |
|
76 | + $managerStub->expects($this->once())->method('searchItems') |
|
77 | + ->will($this->returnValue([$item])); |
|
78 | 78 | |
79 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
79 | + $managerStub->expects($this->once())->method('saveItem'); |
|
80 | 80 | |
81 | 81 | $object->run(); |
82 | 82 | } |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | |
85 | 85 | public function testRunException() |
86 | 86 | { |
87 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
87 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
88 | 88 | |
89 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
90 | - ->setConstructorArgs( [$this->context] ) |
|
91 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
89 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
90 | + ->setConstructorArgs([$this->context]) |
|
91 | + ->setMethods(['searchItems', 'saveItem']) |
|
92 | 92 | ->getMock(); |
93 | 93 | |
94 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
94 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
95 | 95 | |
96 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
97 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
96 | + $managerStub->expects($this->once())->method('searchItems') |
|
97 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
98 | 98 | |
99 | - $managerStub->expects( $this->never() )->method( 'saveItem' ); |
|
99 | + $managerStub->expects($this->never())->method('saveItem'); |
|
100 | 100 | |
101 | 101 | $this->object->run(); |
102 | 102 | } |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | |
105 | 105 | public function testAddCoupons() |
106 | 106 | { |
107 | - $this->context->getConfig()->set( 'controller/jobs/subcription/process/renew/standard/use-coupons', true ); |
|
107 | + $this->context->getConfig()->set('controller/jobs/subcription/process/renew/standard/use-coupons', true); |
|
108 | 108 | |
109 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
110 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] ); |
|
111 | - $orderProduct = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' )->createItem(); |
|
109 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
110 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC', ['price']); |
|
111 | + $orderProduct = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product')->createItem(); |
|
112 | 112 | |
113 | - $price = $product->getRefItems( 'price', 'default', 'default' ); |
|
114 | - $basket->addProduct( $orderProduct->copyFrom( $product )->setPrice( reset( $price ) ) ); |
|
113 | + $price = $product->getRefItems('price', 'default', 'default'); |
|
114 | + $basket->addProduct($orderProduct->copyFrom($product)->setPrice(reset($price))); |
|
115 | 115 | |
116 | - $this->assertEquals( '600.00', $basket->getPrice()->getValue() ); |
|
117 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
118 | - $this->assertEquals( '0.00', $basket->getPrice()->getRebate() ); |
|
116 | + $this->assertEquals('600.00', $basket->getPrice()->getValue()); |
|
117 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
118 | + $this->assertEquals('0.00', $basket->getPrice()->getRebate()); |
|
119 | 119 | |
120 | - $basket = $this->access( 'addBasketCoupons' )->invokeArgs( $this->object, [$this->context, $basket, ['90AB']] ); |
|
120 | + $basket = $this->access('addBasketCoupons')->invokeArgs($this->object, [$this->context, $basket, ['90AB']]); |
|
121 | 121 | |
122 | - $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
|
123 | - $this->assertEquals( 2, count( $basket->getProducts() ) ); |
|
124 | - $this->assertEquals( '537.00', $basket->getPrice()->getValue() ); |
|
125 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
126 | - $this->assertEquals( '63.00', $basket->getPrice()->getRebate() ); |
|
122 | + $this->assertEquals(1, count($basket->getCoupons())); |
|
123 | + $this->assertEquals(2, count($basket->getProducts())); |
|
124 | + $this->assertEquals('537.00', $basket->getPrice()->getValue()); |
|
125 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
126 | + $this->assertEquals('63.00', $basket->getPrice()->getRebate()); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -131,34 +131,34 @@ discard block |
||
131 | 131 | { |
132 | 132 | $item = $this->getSubscription(); |
133 | 133 | |
134 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
135 | - ->setConstructorArgs( [$this->context] ) |
|
136 | - ->setMethods( ['store'] ) |
|
134 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
135 | + ->setConstructorArgs([$this->context]) |
|
136 | + ->setMethods(['store']) |
|
137 | 137 | ->getMock(); |
138 | 138 | |
139 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $managerStub ); |
|
139 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $managerStub); |
|
140 | 140 | |
141 | - $managerStub->expects( $this->once() )->method( 'store' ); |
|
141 | + $managerStub->expects($this->once())->method('store'); |
|
142 | 142 | |
143 | - $this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] ); |
|
143 | + $this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | public function testCreateOrderInvoice() |
148 | 148 | { |
149 | 149 | $item = $this->getSubscription(); |
150 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
150 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
151 | 151 | |
152 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
153 | - ->setConstructorArgs( [$this->context] ) |
|
154 | - ->setMethods( ['saveItem'] ) |
|
152 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
153 | + ->setConstructorArgs([$this->context]) |
|
154 | + ->setMethods(['saveItem']) |
|
155 | 155 | ->getMock(); |
156 | 156 | |
157 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); |
|
157 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub); |
|
158 | 158 | |
159 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
159 | + $managerStub->expects($this->once())->method('saveItem'); |
|
160 | 160 | |
161 | - $this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] ); |
|
161 | + $this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -166,55 +166,55 @@ discard block |
||
166 | 166 | { |
167 | 167 | $item = $this->getSubscription(); |
168 | 168 | $invoice = $this->getOrderItem(); |
169 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
169 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
170 | 170 | |
171 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
172 | - ->setConstructorArgs( [$this->context] ) |
|
173 | - ->setMethods( ['saveItem'] ) |
|
171 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
172 | + ->setConstructorArgs([$this->context]) |
|
173 | + ->setMethods(['saveItem']) |
|
174 | 174 | ->getMock(); |
175 | 175 | |
176 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); |
|
176 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub); |
|
177 | 177 | |
178 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
178 | + $managerStub->expects($this->once())->method('saveItem'); |
|
179 | 179 | |
180 | - $this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] ); |
|
180 | + $this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | protected function getOrderItem() |
185 | 185 | { |
186 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
186 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | - protected function getOrderBaseItem( $baseId ) |
|
190 | + protected function getOrderBaseItem($baseId) |
|
191 | 191 | { |
192 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] ); |
|
192 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->getItem($baseId, ['order/base/service']); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
196 | 196 | protected function getSubscription() |
197 | 197 | { |
198 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
198 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
199 | 199 | |
200 | 200 | $search = $manager->createSearch(); |
201 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
201 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
202 | 202 | |
203 | - $items = $manager->searchItems( $search ); |
|
203 | + $items = $manager->searchItems($search); |
|
204 | 204 | |
205 | - if( ( $item = reset( $items ) ) !== false ) { |
|
205 | + if (($item = reset($items)) !== false) { |
|
206 | 206 | return $item; |
207 | 207 | } |
208 | 208 | |
209 | - throw new \Exception( 'No subscription item found' ); |
|
209 | + throw new \Exception('No subscription item found'); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | - protected function access( $name ) |
|
213 | + protected function access($name) |
|
214 | 214 | { |
215 | - $class = new \ReflectionClass( '\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard' ); |
|
216 | - $method = $class->getMethod( $name ); |
|
217 | - $method->setAccessible( true ); |
|
215 | + $class = new \ReflectionClass('\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard'); |
|
216 | + $method = $class->getMethod($name); |
|
217 | + $method->setAccessible(true); |
|
218 | 218 | |
219 | 219 | return $method; |
220 | 220 | } |
@@ -34,50 +34,50 @@ |
||
34 | 34 | ); |
35 | 35 | |
36 | 36 | |
37 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard( $context, $mapping ); |
|
38 | - |
|
39 | - $invoice = $this->getInvoice( $context ); |
|
40 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
41 | - |
|
42 | - $data = $object->process( $invoice, $order ); |
|
43 | - |
|
44 | - |
|
45 | - $this->assertEquals( 1, count( $data ) ); |
|
46 | - |
|
47 | - $this->assertEquals( 17, count( $data[0] ) ); |
|
48 | - $this->assertEquals( 'web', $data[0][0] ); |
|
49 | - $this->assertEquals( '2008-02-15 12:34:56', $data[0][1] ); |
|
50 | - $this->assertEquals( '6', $data[0][2] ); |
|
51 | - $this->assertEquals( '', $data[0][3] ); |
|
52 | - $this->assertEquals( '4', $data[0][4] ); |
|
53 | - $this->assertEquals( '', $data[0][5] ); |
|
54 | - $this->assertGreaterThan( 0, $data[0][6] ); |
|
55 | - $this->assertEquals( 'unittest', $data[0][7] ); |
|
56 | - $this->assertEquals( 'de', $data[0][8] ); |
|
57 | - $this->assertEquals( 'EUR', $data[0][9] ); |
|
58 | - $this->assertEquals( '53.50', $data[0][10] ); |
|
59 | - $this->assertEquals( '1.50', $data[0][11] ); |
|
60 | - $this->assertEquals( '14.50', $data[0][12] ); |
|
61 | - $this->assertEquals( '0.0000', $data[0][13] ); |
|
62 | - $this->assertEquals( '1', $data[0][14] ); |
|
63 | - $this->assertEquals( '1', $data[0][15] ); |
|
64 | - $this->assertEquals( 'This is a comment if an order. It can be added by the user.', $data[0][16] ); |
|
37 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard($context, $mapping); |
|
38 | + |
|
39 | + $invoice = $this->getInvoice($context); |
|
40 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
41 | + |
|
42 | + $data = $object->process($invoice, $order); |
|
43 | + |
|
44 | + |
|
45 | + $this->assertEquals(1, count($data)); |
|
46 | + |
|
47 | + $this->assertEquals(17, count($data[0])); |
|
48 | + $this->assertEquals('web', $data[0][0]); |
|
49 | + $this->assertEquals('2008-02-15 12:34:56', $data[0][1]); |
|
50 | + $this->assertEquals('6', $data[0][2]); |
|
51 | + $this->assertEquals('', $data[0][3]); |
|
52 | + $this->assertEquals('4', $data[0][4]); |
|
53 | + $this->assertEquals('', $data[0][5]); |
|
54 | + $this->assertGreaterThan(0, $data[0][6]); |
|
55 | + $this->assertEquals('unittest', $data[0][7]); |
|
56 | + $this->assertEquals('de', $data[0][8]); |
|
57 | + $this->assertEquals('EUR', $data[0][9]); |
|
58 | + $this->assertEquals('53.50', $data[0][10]); |
|
59 | + $this->assertEquals('1.50', $data[0][11]); |
|
60 | + $this->assertEquals('14.50', $data[0][12]); |
|
61 | + $this->assertEquals('0.0000', $data[0][13]); |
|
62 | + $this->assertEquals('1', $data[0][14]); |
|
63 | + $this->assertEquals('1', $data[0][15]); |
|
64 | + $this->assertEquals('This is a comment if an order. It can be added by the user.', $data[0][16]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | - protected function getInvoice( $context ) |
|
68 | + protected function getInvoice($context) |
|
69 | 69 | { |
70 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
70 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
71 | 71 | |
72 | 72 | $search = $manager->createSearch(); |
73 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
73 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
74 | 74 | |
75 | - $items = $manager->searchItems( $search ); |
|
75 | + $items = $manager->searchItems($search); |
|
76 | 76 | |
77 | - if( ( $item = reset( $items ) ) !== false ) { |
|
77 | + if (($item = reset($items)) !== false) { |
|
78 | 78 | return $item; |
79 | 79 | } |
80 | 80 | |
81 | - throw new \Exception( 'No order item found' ); |
|
81 | + throw new \Exception('No order item found'); |
|
82 | 82 | } |
83 | 83 | } |