@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Catalog import CSV' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog import CSV'); |
|
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', 'Imports new and updates existing categories from CSV files' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing categories from CSV files'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $context = $this->getContext(); |
55 | 55 | $config = $context->getConfig(); |
56 | 56 | $logger = $context->getLogger(); |
57 | - $domains = array( 'media', 'text' ); |
|
57 | + $domains = array('media', 'text'); |
|
58 | 58 | $mappings = $this->getDefaultMapping(); |
59 | 59 | |
60 | 60 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @see controller/common/catalog/import/csv/converter |
75 | 75 | * @see controller/common/catalog/import/csv/max-size |
76 | 76 | */ |
77 | - $domains = $config->get( 'controller/common/catalog/import/csv/domains', $domains ); |
|
77 | + $domains = $config->get('controller/common/catalog/import/csv/domains', $domains); |
|
78 | 78 | |
79 | 79 | /** controller/jobs/catalog/import/csv/domains |
80 | 80 | * List of item domain names that should be retrieved along with the catalog items |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @see controller/jobs/catalog/import/csv/backup |
95 | 95 | * @see controller/common/catalog/import/csv/max-size |
96 | 96 | */ |
97 | - $domains = $config->get( 'controller/jobs/catalog/import/csv/domains', $domains ); |
|
97 | + $domains = $config->get('controller/jobs/catalog/import/csv/domains', $domains); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | /** controller/common/catalog/import/csv/mapping |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @see controller/common/catalog/import/csv/converter |
120 | 120 | * @see controller/common/catalog/import/csv/max-size |
121 | 121 | */ |
122 | - $mappings = $config->get( 'controller/common/catalog/import/csv/mapping', $mappings ); |
|
122 | + $mappings = $config->get('controller/common/catalog/import/csv/mapping', $mappings); |
|
123 | 123 | |
124 | 124 | /** controller/jobs/catalog/import/csv/mapping |
125 | 125 | * List of mappings between the position in the CSV file and item keys |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @see controller/jobs/catalog/import/csv/backup |
140 | 140 | * @see controller/common/catalog/import/csv/max-size |
141 | 141 | */ |
142 | - $mappings = $config->get( 'controller/jobs/catalog/import/csv/mapping', $mappings ); |
|
142 | + $mappings = $config->get('controller/jobs/catalog/import/csv/mapping', $mappings); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** controller/common/catalog/import/csv/converter |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @see controller/common/catalog/import/csv/mapping |
182 | 182 | * @see controller/common/catalog/import/csv/max-size |
183 | 183 | */ |
184 | - $converters = $config->get( 'controller/common/catalog/import/csv/converter', [] ); |
|
184 | + $converters = $config->get('controller/common/catalog/import/csv/converter', []); |
|
185 | 185 | |
186 | 186 | /** controller/jobs/catalog/import/csv/converter |
187 | 187 | * List of converter names for the values at the position in the CSV file |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @see controller/jobs/catalog/import/csv/backup |
202 | 202 | * @see controller/common/catalog/import/csv/max-size |
203 | 203 | */ |
204 | - $converters = $config->get( 'controller/jobs/catalog/import/csv/converter', $converters ); |
|
204 | + $converters = $config->get('controller/jobs/catalog/import/csv/converter', $converters); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | /** controller/common/catalog/import/csv/max-size |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @see controller/common/catalog/import/csv/mapping |
222 | 222 | * @see controller/common/catalog/import/csv/converter |
223 | 223 | */ |
224 | - $maxcnt = (int) $config->get( 'controller/common/catalog/import/csv/max-size', 1000 ); |
|
224 | + $maxcnt = (int) $config->get('controller/common/catalog/import/csv/max-size', 1000); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | /** controller/jobs/catalog/import/csv/skip-lines |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @see controller/jobs/catalog/import/csv/backup |
244 | 244 | * @see controller/common/catalog/import/csv/max-size |
245 | 245 | */ |
246 | - $skiplines = (int) $config->get( 'controller/jobs/catalog/import/csv/skip-lines', 0 ); |
|
246 | + $skiplines = (int) $config->get('controller/jobs/catalog/import/csv/skip-lines', 0); |
|
247 | 247 | |
248 | 248 | |
249 | 249 | /** controller/jobs/catalog/import/csv/strict |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @see controller/jobs/catalog/import/csv/backup |
268 | 268 | * @see controller/common/catalog/import/csv/max-size |
269 | 269 | */ |
270 | - $strict = (bool) $config->get( 'controller/jobs/catalog/import/csv/strict', true ); |
|
270 | + $strict = (bool) $config->get('controller/jobs/catalog/import/csv/strict', true); |
|
271 | 271 | |
272 | 272 | |
273 | 273 | /** controller/jobs/catalog/import/csv/backup |
@@ -300,75 +300,75 @@ discard block |
||
300 | 300 | * @see controller/jobs/catalog/import/csv/strict |
301 | 301 | * @see controller/common/catalog/import/csv/max-size |
302 | 302 | */ |
303 | - $backup = $config->get( 'controller/jobs/catalog/import/csv/backup' ); |
|
303 | + $backup = $config->get('controller/jobs/catalog/import/csv/backup'); |
|
304 | 304 | |
305 | 305 | |
306 | - if( !isset( $mappings['item'] ) || !is_array( $mappings['item'] ) ) |
|
306 | + if (!isset($mappings['item']) || !is_array($mappings['item'])) |
|
307 | 307 | { |
308 | - $msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' ); |
|
309 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
308 | + $msg = sprintf('Required mapping key "%1$s" is missing or contains no array', 'item'); |
|
309 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | try |
313 | 313 | { |
314 | 314 | $procMappings = $mappings; |
315 | - unset( $procMappings['item'] ); |
|
315 | + unset($procMappings['item']); |
|
316 | 316 | |
317 | - $codePos = $this->getCodePosition( $mappings['item'] ); |
|
318 | - $convlist = $this->getConverterList( $converters ); |
|
319 | - $processor = $this->getProcessors( $procMappings ); |
|
320 | - $catalogMap = $this->getCatalogMap( $domains ); |
|
317 | + $codePos = $this->getCodePosition($mappings['item']); |
|
318 | + $convlist = $this->getConverterList($converters); |
|
319 | + $processor = $this->getProcessors($procMappings); |
|
320 | + $catalogMap = $this->getCatalogMap($domains); |
|
321 | 321 | $container = $this->getContainer(); |
322 | 322 | $path = $container->getName(); |
323 | 323 | |
324 | 324 | |
325 | - $msg = sprintf( 'Started catalog import from "%1$s" (%2$s)', $path, __CLASS__ ); |
|
326 | - $logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE ); |
|
325 | + $msg = sprintf('Started catalog import from "%1$s" (%2$s)', $path, __CLASS__); |
|
326 | + $logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE); |
|
327 | 327 | |
328 | - foreach( $container as $content ) |
|
328 | + foreach ($container as $content) |
|
329 | 329 | { |
330 | 330 | $name = $content->getName(); |
331 | 331 | |
332 | - for( $i = 0; $i < $skiplines; $i++ ) { |
|
332 | + for ($i = 0; $i < $skiplines; $i++) { |
|
333 | 333 | $content->next(); |
334 | 334 | } |
335 | 335 | |
336 | - while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] ) |
|
336 | + while (($data = $this->getData($content, $maxcnt, $codePos)) !== []) |
|
337 | 337 | { |
338 | - $data = $this->convertData( $convlist, $data ); |
|
339 | - $errcnt = $this->import( $catalogMap, $data, $mappings['item'], $processor, $strict ); |
|
340 | - $chunkcnt = count( $data ); |
|
338 | + $data = $this->convertData($convlist, $data); |
|
339 | + $errcnt = $this->import($catalogMap, $data, $mappings['item'], $processor, $strict); |
|
340 | + $chunkcnt = count($data); |
|
341 | 341 | |
342 | 342 | $msg = 'Imported catalog lines from "%1$s": %2$d/%3$d (%4$s)'; |
343 | - $logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
343 | + $logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
344 | 344 | |
345 | 345 | $errors += $errcnt; |
346 | 346 | $total += $chunkcnt; |
347 | - unset( $data ); |
|
347 | + unset($data); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | 351 | $container->close(); |
352 | 352 | } |
353 | - catch( \Exception $e ) |
|
353 | + catch (\Exception $e) |
|
354 | 354 | { |
355 | - $logger->log( 'Catalog import error: ' . $e->getMessage() ); |
|
356 | - $logger->log( $e->getTraceAsString() ); |
|
355 | + $logger->log('Catalog import error: ' . $e->getMessage()); |
|
356 | + $logger->log($e->getTraceAsString()); |
|
357 | 357 | |
358 | - throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() ); |
|
358 | + throw new \Aimeos\Controller\Jobs\Exception($e->getMessage()); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $msg = 'Finished catalog import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)'; |
362 | - $logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
362 | + $logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
363 | 363 | |
364 | - if( $errors > 0 ) |
|
364 | + if ($errors > 0) |
|
365 | 365 | { |
366 | - $msg = sprintf( 'Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total ); |
|
367 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
366 | + $msg = sprintf('Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total); |
|
367 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
368 | 368 | } |
369 | 369 | |
370 | - if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) { |
|
371 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) ); |
|
370 | + if (!empty($backup) && @rename($path, strftime($backup)) === false) { |
|
371 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file')); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | * @return integer Position of the "catalog.code" column |
381 | 381 | * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "catalog.code" is found |
382 | 382 | */ |
383 | - protected function getCodePosition( array $mapping ) |
|
383 | + protected function getCodePosition(array $mapping) |
|
384 | 384 | { |
385 | - foreach( $mapping as $pos => $key ) |
|
385 | + foreach ($mapping as $pos => $key) |
|
386 | 386 | { |
387 | - if( $key === 'catalog.code' ) { |
|
387 | + if ($key === 'catalog.code') { |
|
388 | 388 | return $pos; |
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
392 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "catalog.code" column in CSV mapping found' ) ); |
|
392 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "catalog.code" column in CSV mapping found')); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @see controller/jobs/catalog/import/csv/container/content |
425 | 425 | * @see controller/jobs/catalog/import/csv/container/options |
426 | 426 | */ |
427 | - $location = $config->get( 'controller/jobs/catalog/import/csv/location' ); |
|
427 | + $location = $config->get('controller/jobs/catalog/import/csv/location'); |
|
428 | 428 | |
429 | 429 | /** controller/jobs/catalog/import/csv/container/type |
430 | 430 | * Nave of the container type to read the data from |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @see controller/jobs/catalog/import/csv/container/content |
448 | 448 | * @see controller/jobs/catalog/import/csv/container/options |
449 | 449 | */ |
450 | - $container = $config->get( 'controller/jobs/catalog/import/csv/container/type', 'Directory' ); |
|
450 | + $container = $config->get('controller/jobs/catalog/import/csv/container/type', 'Directory'); |
|
451 | 451 | |
452 | 452 | /** controller/jobs/catalog/import/csv/container/content |
453 | 453 | * Name of the content type inside the container to read the data from |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @see controller/jobs/catalog/import/csv/container/type |
469 | 469 | * @see controller/jobs/catalog/import/csv/container/options |
470 | 470 | */ |
471 | - $content = $config->get( 'controller/jobs/catalog/import/csv/container/content', 'CSV' ); |
|
471 | + $content = $config->get('controller/jobs/catalog/import/csv/container/content', 'CSV'); |
|
472 | 472 | |
473 | 473 | /** controller/jobs/catalog/import/csv/container/options |
474 | 474 | * List of file container options for the catalog import files |
@@ -486,15 +486,15 @@ discard block |
||
486 | 486 | * @see controller/jobs/catalog/import/csv/container/content |
487 | 487 | * @see controller/jobs/catalog/import/csv/container/type |
488 | 488 | */ |
489 | - $options = $config->get( 'controller/jobs/catalog/import/csv/container/options', [] ); |
|
489 | + $options = $config->get('controller/jobs/catalog/import/csv/container/options', []); |
|
490 | 490 | |
491 | - if( $location === null ) |
|
491 | + if ($location === null) |
|
492 | 492 | { |
493 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location' ); |
|
494 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
493 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location'); |
|
494 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
495 | 495 | } |
496 | 496 | |
497 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
497 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | * @param array $domains List of domain names whose items should be fetched too |
505 | 505 | * @return array Associative list of catalog codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values |
506 | 506 | */ |
507 | - protected function getCatalogMap( array $domains ) |
|
507 | + protected function getCatalogMap(array $domains) |
|
508 | 508 | { |
509 | 509 | $map = []; |
510 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); |
|
511 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
510 | + $manager = \Aimeos\MShop::create($this->getContext(), 'catalog'); |
|
511 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
512 | 512 | |
513 | - foreach( $manager->searchItems( $search, $domains ) as $item ) { |
|
513 | + foreach ($manager->searchItems($search, $domains) as $item) { |
|
514 | 514 | $map[$item->getCode()] = $item; |
515 | 515 | } |
516 | 516 | |
@@ -526,23 +526,23 @@ discard block |
||
526 | 526 | * @param string $code Catalog item code of the parent category |
527 | 527 | * @return string|null ID of the parent category or null for top level nodes |
528 | 528 | */ |
529 | - protected function getParentId( array $catalogMap, array $map, $code ) |
|
529 | + protected function getParentId(array $catalogMap, array $map, $code) |
|
530 | 530 | { |
531 | - if( !isset( $map['catalog.parent'] ) ) |
|
531 | + if (!isset($map['catalog.parent'])) |
|
532 | 532 | { |
533 | - $msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code ); |
|
534 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
533 | + $msg = sprintf('Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code); |
|
534 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
535 | 535 | } |
536 | 536 | |
537 | - $parent = trim( $map['catalog.parent'] ); |
|
537 | + $parent = trim($map['catalog.parent']); |
|
538 | 538 | |
539 | - if( $parent != '' && !isset( $catalogMap[$parent] ) ) |
|
539 | + if ($parent != '' && !isset($catalogMap[$parent])) |
|
540 | 540 | { |
541 | - $msg = sprintf( 'Parent node for code "%1$s" not found', $parent ); |
|
542 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
541 | + $msg = sprintf('Parent node for code "%1$s" not found', $parent); |
|
542 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
543 | 543 | } |
544 | 544 | |
545 | - return ( $parent != '' ? $catalogMap[$parent]->getId() : null ); |
|
545 | + return ($parent != '' ? $catalogMap[$parent]->getId() : null); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -557,65 +557,65 @@ discard block |
||
557 | 557 | * @return integer Number of catalogs that couldn't be imported |
558 | 558 | * @throws \Aimeos\Controller\Jobs\Exception |
559 | 559 | */ |
560 | - protected function import( array &$catalogMap, array $data, array $mapping, |
|
561 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict ) |
|
560 | + protected function import(array &$catalogMap, array $data, array $mapping, |
|
561 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict) |
|
562 | 562 | { |
563 | 563 | $errors = 0; |
564 | 564 | $context = $this->getContext(); |
565 | - $manager = \Aimeos\MShop::create( $context, 'catalog' ); |
|
565 | + $manager = \Aimeos\MShop::create($context, 'catalog'); |
|
566 | 566 | |
567 | - foreach( $data as $code => $list ) |
|
567 | + foreach ($data as $code => $list) |
|
568 | 568 | { |
569 | 569 | $manager->begin(); |
570 | 570 | |
571 | 571 | try |
572 | 572 | { |
573 | - $code = trim( $code ); |
|
573 | + $code = trim($code); |
|
574 | 574 | |
575 | - if( isset( $catalogMap[$code] ) ) { |
|
575 | + if (isset($catalogMap[$code])) { |
|
576 | 576 | $item = $catalogMap[$code]; |
577 | 577 | } else { |
578 | 578 | $item = $manager->createItem(); |
579 | 579 | } |
580 | 580 | |
581 | - $map = $this->getMappedChunk( $list, $mapping ); |
|
581 | + $map = $this->getMappedChunk($list, $mapping); |
|
582 | 582 | |
583 | - if( isset( $map[0] ) ) |
|
583 | + if (isset($map[0])) |
|
584 | 584 | { |
585 | 585 | $map = $map[0]; // there can only be one chunk for the base catalog data |
586 | - $parentid = $this->getParentId( $catalogMap, $map, $code ); |
|
587 | - $item->fromArray( $map ); |
|
586 | + $parentid = $this->getParentId($catalogMap, $map, $code); |
|
587 | + $item->fromArray($map); |
|
588 | 588 | |
589 | - if( isset( $catalogMap[$code] ) ) |
|
589 | + if (isset($catalogMap[$code])) |
|
590 | 590 | { |
591 | - $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); |
|
592 | - $item = $manager->saveItem( $item ); |
|
591 | + $manager->moveItem($item->getId(), $item->getParentId(), $parentid); |
|
592 | + $item = $manager->saveItem($item); |
|
593 | 593 | } |
594 | 594 | else |
595 | 595 | { |
596 | - $item = $manager->insertItem( $item, $parentid ); |
|
596 | + $item = $manager->insertItem($item, $parentid); |
|
597 | 597 | } |
598 | 598 | |
599 | - $list = $processor->process( $item, $list ); |
|
599 | + $list = $processor->process($item, $list); |
|
600 | 600 | $catalogMap[$code] = $item; |
601 | 601 | |
602 | - $manager->saveItem( $item ); |
|
602 | + $manager->saveItem($item); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | $manager->commit(); |
606 | 606 | } |
607 | - catch( \Exception $e ) |
|
607 | + catch (\Exception $e) |
|
608 | 608 | { |
609 | 609 | $manager->rollback(); |
610 | 610 | |
611 | - $msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() ); |
|
612 | - $context->getLogger()->log( $msg ); |
|
611 | + $msg = sprintf('Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage()); |
|
612 | + $context->getLogger()->log($msg); |
|
613 | 613 | |
614 | 614 | $errors++; |
615 | 615 | } |
616 | 616 | |
617 | - if( $strict && !empty( $list ) ) { |
|
618 | - $context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) ); |
|
617 | + if ($strict && !empty($list)) { |
|
618 | + $context->getLogger()->log('Not imported: ' . print_r($list, true)); |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescale product images' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescale product images'); |
|
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', 'Rescales product images to the new sizes' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescales product images to the new sizes'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,41 +51,41 @@ discard block |
||
51 | 51 | public function run() |
52 | 52 | { |
53 | 53 | $context = $this->getContext(); |
54 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
55 | - $manager = \Aimeos\MShop::create( $context, 'media' ); |
|
54 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
55 | + $manager = \Aimeos\MShop::create($context, 'media'); |
|
56 | 56 | |
57 | 57 | $search = $manager->createSearch(); |
58 | 58 | $expr = array( |
59 | - $search->compare( '==', 'media.domain', 'product' ), |
|
60 | - $search->compare( '=~', 'media.mimetype', 'image/' ), |
|
59 | + $search->compare('==', 'media.domain', 'product'), |
|
60 | + $search->compare('=~', 'media.mimetype', 'image/'), |
|
61 | 61 | ); |
62 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
63 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
62 | + $search->setConditions($search->combine('&&', $expr)); |
|
63 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
64 | 64 | |
65 | 65 | $start = 0; |
66 | 66 | |
67 | 67 | do |
68 | 68 | { |
69 | - $search->setSlice( $start ); |
|
70 | - $items = $manager->searchItems( $search ); |
|
69 | + $search->setSlice($start); |
|
70 | + $items = $manager->searchItems($search); |
|
71 | 71 | |
72 | - foreach( $items as $item ) |
|
72 | + foreach ($items as $item) |
|
73 | 73 | { |
74 | 74 | try |
75 | 75 | { |
76 | - $cntl->scale( $item, 'fs-media' ); |
|
77 | - $manager->saveItem( $item ); |
|
76 | + $cntl->scale($item, 'fs-media'); |
|
77 | + $manager->saveItem($item); |
|
78 | 78 | } |
79 | - catch( \Exception $e ) |
|
79 | + catch (\Exception $e) |
|
80 | 80 | { |
81 | - $msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() ); |
|
82 | - $context->getLogger()->log( $msg ); |
|
81 | + $msg = sprintf('Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage()); |
|
82 | + $context->getLogger()->log($msg); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - $count = count( $items ); |
|
86 | + $count = count($items); |
|
87 | 87 | $start += $count; |
88 | 88 | } |
89 | - while( $count === $search->getSliceSize() ); |
|
89 | + while ($count === $search->getSliceSize()); |
|
90 | 90 | } |
91 | 91 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index optimization' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index optimization'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Optimizes the index for searching products faster' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Optimizes the index for searching products faster'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MShop\Index\Manager\Factory::create( $this->getContext() )->optimize(); |
|
54 | + \Aimeos\MShop\Index\Manager\Factory::create($this->getContext())->optimize(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index rebuild' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index rebuild'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rebuilds the index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rebuilds the index for searching products'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - $timestamp = date( 'Y-m-d H:i:s' ); |
|
54 | + $timestamp = date('Y-m-d H:i:s'); |
|
55 | 55 | $context = clone $this->getContext(); |
56 | 56 | |
57 | - $context->getLocale()->setLanguageId( null ); |
|
58 | - $context->getLocale()->setCurrencyId( null ); |
|
57 | + $context->getLocale()->setLanguageId(null); |
|
58 | + $context->getLocale()->setCurrencyId(null); |
|
59 | 59 | |
60 | - $manager = \Aimeos\MShop\Index\Manager\Factory::create( $context ); |
|
60 | + $manager = \Aimeos\MShop\Index\Manager\Factory::create($context); |
|
61 | 61 | |
62 | 62 | $manager->rebuildIndex(); |
63 | - $manager->cleanupIndex( $timestamp ); |
|
63 | + $manager->cleanupIndex($timestamp); |
|
64 | 64 | } |
65 | 65 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop::cache( false ); |
|
18 | + \Aimeos\MShop::cache(false); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - public static function getContext( $site = 'unittest' ) |
|
22 | + public static function getContext($site = 'unittest') |
|
23 | 23 | { |
24 | - if( !isset( self::$context[$site] ) ) { |
|
25 | - self::$context[$site] = self::createContext( $site ); |
|
24 | + if (!isset(self::$context[$site])) { |
|
25 | + self::$context[$site] = self::createContext($site); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function getAimeos() |
33 | 33 | { |
34 | - if( !isset( self::$aimeos ) ) |
|
34 | + if (!isset(self::$aimeos)) |
|
35 | 35 | { |
36 | 36 | require_once 'Bootstrap.php'; |
37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
38 | 38 | |
39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$aimeos; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | public static function getControllerPaths() |
48 | 48 | { |
49 | - return self::getAimeos()->getCustomPaths( 'controller/jobs' ); |
|
49 | + return self::getAimeos()->getCustomPaths('controller/jobs'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param string $site |
55 | 55 | */ |
56 | - private static function createContext( $site ) |
|
56 | + private static function createContext($site) |
|
57 | 57 | { |
58 | 58 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
59 | 59 | $aimeos = self::getAimeos(); |
@@ -63,80 +63,80 @@ discard block |
||
63 | 63 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
64 | 64 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
65 | 65 | |
66 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
67 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
68 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
69 | - $ctx->setConfig( $conf ); |
|
66 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
67 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
68 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
69 | + $ctx->setConfig($conf); |
|
70 | 70 | |
71 | 71 | |
72 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
73 | - $ctx->setLogger( $logger ); |
|
72 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
73 | + $ctx->setLogger($logger); |
|
74 | 74 | |
75 | 75 | |
76 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
77 | - $ctx->setDatabaseManager( $dbm ); |
|
76 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
77 | + $ctx->setDatabaseManager($dbm); |
|
78 | 78 | |
79 | 79 | |
80 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
81 | - $ctx->setFilesystemManager( $fs ); |
|
80 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
81 | + $ctx->setFilesystemManager($fs); |
|
82 | 82 | |
83 | 83 | |
84 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
85 | - $ctx->setMessageQueueManager( $mq ); |
|
84 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
85 | + $ctx->setMessageQueueManager($mq); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $cache = new \Aimeos\MW\Cache\None(); |
89 | - $ctx->setCache( $cache ); |
|
89 | + $ctx->setCache($cache); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $session = new \Aimeos\MW\Session\None(); |
93 | - $ctx->setSession( $session ); |
|
93 | + $ctx->setSession($session); |
|
94 | 94 | |
95 | 95 | |
96 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
97 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
96 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
97 | + $ctx->setI18n(array('de' => $i18n)); |
|
98 | 98 | |
99 | 99 | |
100 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
101 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
102 | - $ctx->setLocale( $locale ); |
|
100 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
101 | + $locale = $localeManager->bootstrap($site, 'de', '', false); |
|
102 | + $ctx->setLocale($locale); |
|
103 | 103 | |
104 | 104 | |
105 | - $view = self::createView( $conf ); |
|
106 | - $ctx->setView( $view ); |
|
105 | + $view = self::createView($conf); |
|
106 | + $ctx->setView($view); |
|
107 | 107 | |
108 | 108 | |
109 | - $ctx->setEditor( 'core:controller/jobs' ); |
|
109 | + $ctx->setEditor('core:controller/jobs'); |
|
110 | 110 | |
111 | 111 | return $ctx; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | - protected static function createView( \Aimeos\MW\Config\Iface $config ) |
|
115 | + protected static function createView(\Aimeos\MW\Config\Iface $config) |
|
116 | 116 | { |
117 | 117 | $tmplpaths = array_merge_recursive( |
118 | - self::getAimeos()->getCustomPaths( 'client/html/templates' ), |
|
119 | - self::getAimeos()->getCustomPaths( 'controller/jobs/templates' ) |
|
118 | + self::getAimeos()->getCustomPaths('client/html/templates'), |
|
119 | + self::getAimeos()->getCustomPaths('controller/jobs/templates') |
|
120 | 120 | ); |
121 | 121 | |
122 | - $view = new \Aimeos\MW\View\Standard( $tmplpaths ); |
|
122 | + $view = new \Aimeos\MW\View\Standard($tmplpaths); |
|
123 | 123 | |
124 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
125 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
126 | - $view->addHelper( 'translate', $helper ); |
|
124 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
125 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
126 | + $view->addHelper('translate', $helper); |
|
127 | 127 | |
128 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
129 | - $view->addHelper( 'url', $helper ); |
|
128 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
129 | + $view->addHelper('url', $helper); |
|
130 | 130 | |
131 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
132 | - $view->addHelper( 'number', $helper ); |
|
131 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
132 | + $view->addHelper('number', $helper); |
|
133 | 133 | |
134 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
135 | - $view->addHelper( 'date', $helper ); |
|
134 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
135 | + $view->addHelper('date', $helper); |
|
136 | 136 | |
137 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) ); |
|
138 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
139 | - $view->addHelper( 'config', $helper ); |
|
137 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html')); |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
139 | + $view->addHelper('config', $helper); |
|
140 | 140 | |
141 | 141 | return $view; |
142 | 142 | } |
@@ -18,119 +18,119 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop::cache( true ); |
|
21 | + \Aimeos\MShop::cache(true); |
|
22 | 22 | |
23 | 23 | $this->context = \TestHelperJobs::getContext(); |
24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
25 | 25 | $config = $this->context->getConfig(); |
26 | 26 | |
27 | - $config->set( 'controller/jobs/product/import/csv/skip-lines', 1 ); |
|
28 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid' ); |
|
27 | + $config->set('controller/jobs/product/import/csv/skip-lines', 1); |
|
28 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid'); |
|
29 | 29 | |
30 | - $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
30 | + $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | protected function tearDown() |
35 | 35 | { |
36 | - \Aimeos\MShop::cache( false ); |
|
36 | + \Aimeos\MShop::cache(false); |
|
37 | 37 | \Aimeos\MShop::clear(); |
38 | 38 | |
39 | 39 | $this->object = null; |
40 | 40 | |
41 | - if( file_exists( 'tmp/import.zip' ) ) { |
|
42 | - unlink( 'tmp/import.zip' ); |
|
41 | + if (file_exists('tmp/import.zip')) { |
|
42 | + unlink('tmp/import.zip'); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetName() |
48 | 48 | { |
49 | - $this->assertEquals( 'Product import CSV', $this->object->getName() ); |
|
49 | + $this->assertEquals('Product import CSV', $this->object->getName()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testGetDescription() |
54 | 54 | { |
55 | 55 | $text = 'Imports new and updates existing products from CSV files'; |
56 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
56 | + $this->assertEquals($text, $this->object->getDescription()); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testRun() |
61 | 61 | { |
62 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
63 | - $nondelete = array( 'attribute', 'product' ); |
|
64 | - $delete = array( 'media', 'price', 'text' ); |
|
62 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
63 | + $nondelete = array('attribute', 'product'); |
|
64 | + $delete = array('media', 'price', 'text'); |
|
65 | 65 | |
66 | 66 | $convert = array( |
67 | 67 | 1 => 'Text/LatinUTF8', |
68 | 68 | ); |
69 | 69 | |
70 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/converter', $convert ); |
|
70 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/converter', $convert); |
|
71 | 71 | |
72 | 72 | $this->object->run(); |
73 | 73 | |
74 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
75 | - $properties = $this->getProperties( array_keys( $result ) ); |
|
76 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
74 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
75 | + $properties = $this->getProperties(array_keys($result)); |
|
76 | + $this->delete($prodcodes, $delete, $nondelete); |
|
77 | 77 | |
78 | - $this->assertEquals( 2, count( $result ) ); |
|
79 | - $this->assertEquals( 2, count( $properties ) ); |
|
78 | + $this->assertEquals(2, count($result)); |
|
79 | + $this->assertEquals(2, count($properties)); |
|
80 | 80 | |
81 | - foreach( $result as $product ) { |
|
82 | - $this->assertEquals( 5, count( $product->getListItems() ) ); |
|
81 | + foreach ($result as $product) { |
|
82 | + $this->assertEquals(5, count($product->getListItems())); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | public function testRunUpdate() |
88 | 88 | { |
89 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
90 | - $nondelete = array( 'attribute', 'product' ); |
|
91 | - $delete = array( 'media', 'price', 'text' ); |
|
89 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
90 | + $nondelete = array('attribute', 'product'); |
|
91 | + $delete = array('media', 'price', 'text'); |
|
92 | 92 | |
93 | 93 | $this->object->run(); |
94 | 94 | $this->object->run(); |
95 | 95 | |
96 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
97 | - $properties = $this->getProperties( array_keys( $result ) ); |
|
98 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
96 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
97 | + $properties = $this->getProperties(array_keys($result)); |
|
98 | + $this->delete($prodcodes, $delete, $nondelete); |
|
99 | 99 | |
100 | - $this->assertEquals( 2, count( $result ) ); |
|
101 | - $this->assertEquals( 2, count( $properties ) ); |
|
100 | + $this->assertEquals(2, count($result)); |
|
101 | + $this->assertEquals(2, count($properties)); |
|
102 | 102 | |
103 | - foreach( $result as $product ) { |
|
104 | - $this->assertEquals( 5, count( $product->getListItems() ) ); |
|
103 | + foreach ($result as $product) { |
|
104 | + $this->assertEquals(5, count($product->getListItems())); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testRunPosition() |
110 | 110 | { |
111 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
112 | - $nondelete = array( 'attribute', 'product' ); |
|
113 | - $delete = array( 'media', 'price', 'text' ); |
|
111 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
112 | + $nondelete = array('attribute', 'product'); |
|
113 | + $delete = array('media', 'price', 'text'); |
|
114 | 114 | |
115 | 115 | $config = $this->context->getConfig(); |
116 | - $mapping = $config->set( 'controller/jobs/product/import/csv/mapping', [] ); |
|
117 | - $mapping['item'] = array( 0 => 'product.label', 1 => 'product.code' ); |
|
116 | + $mapping = $config->set('controller/jobs/product/import/csv/mapping', []); |
|
117 | + $mapping['item'] = array(0 => 'product.label', 1 => 'product.code'); |
|
118 | 118 | |
119 | - $config->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
120 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position' ); |
|
119 | + $config->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
120 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position'); |
|
121 | 121 | |
122 | 122 | $this->object->run(); |
123 | 123 | |
124 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
125 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
124 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
125 | + $this->delete($prodcodes, $delete, $nondelete); |
|
126 | 126 | |
127 | - $this->assertEquals( 2, count( $result ) ); |
|
127 | + $this->assertEquals(2, count($result)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | 131 | public function testRunProcessorInvalidPosition() |
132 | 132 | { |
133 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
133 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
134 | 134 | |
135 | 135 | $mapping = array( |
136 | 136 | 'item' => array( |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | ), |
151 | 151 | ); |
152 | 152 | |
153 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
153 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
154 | 154 | |
155 | 155 | $this->object->run(); |
156 | 156 | |
157 | - $this->delete( $prodcodes, array( 'text', 'media' ), [] ); |
|
157 | + $this->delete($prodcodes, array('text', 'media'), []); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | ), |
167 | 167 | ); |
168 | 168 | |
169 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
169 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
170 | 170 | |
171 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
171 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
172 | 172 | $this->object->run(); |
173 | 173 | } |
174 | 174 | |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ), |
209 | 209 | ); |
210 | 210 | |
211 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
211 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
212 | 212 | |
213 | 213 | $config = $this->context->getConfig(); |
214 | - $config->set( 'controller/jobs/product/import/csv/skip-lines', 0 ); |
|
215 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid' ); |
|
214 | + $config->set('controller/jobs/product/import/csv/skip-lines', 0); |
|
215 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid'); |
|
216 | 216 | |
217 | - $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
217 | + $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos); |
|
218 | 218 | |
219 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
219 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
220 | 220 | $this->object->run(); |
221 | 221 | } |
222 | 222 | |
@@ -224,104 +224,104 @@ discard block |
||
224 | 224 | public function testRunBackup() |
225 | 225 | { |
226 | 226 | $config = $this->context->getConfig(); |
227 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
228 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' ); |
|
229 | - $config->set( 'controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' ); |
|
227 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
228 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip'); |
|
229 | + $config->set('controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip'); |
|
230 | 230 | |
231 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
232 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
231 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
232 | + throw new \RuntimeException('Unable to copy test file'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->object->run(); |
236 | 236 | |
237 | - $filename = strftime( 'tmp/test-%Y-%m-%d.zip' ); |
|
238 | - $this->assertTrue( file_exists( $filename ) ); |
|
237 | + $filename = strftime('tmp/test-%Y-%m-%d.zip'); |
|
238 | + $this->assertTrue(file_exists($filename)); |
|
239 | 239 | |
240 | - unlink( $filename ); |
|
240 | + unlink($filename); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | public function testRunBackupInvalid() |
245 | 245 | { |
246 | 246 | $config = $this->context->getConfig(); |
247 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
248 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' ); |
|
249 | - $config->set( 'controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip' ); |
|
247 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
248 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip'); |
|
249 | + $config->set('controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip'); |
|
250 | 250 | |
251 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
252 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
251 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
252 | + throw new \RuntimeException('Unable to copy test file'); |
|
253 | 253 | } |
254 | 254 | |
255 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
255 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
256 | 256 | $this->object->run(); |
257 | 257 | } |
258 | 258 | |
259 | 259 | |
260 | - protected function delete( array $prodcodes, array $delete, array $nondelete ) |
|
260 | + protected function delete(array $prodcodes, array $delete, array $nondelete) |
|
261 | 261 | { |
262 | - $catListManager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context )->getSubmanager( 'lists' ); |
|
263 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context ); |
|
264 | - $listManager = $productManager->getSubManager( 'lists' ); |
|
262 | + $catListManager = \Aimeos\MShop\Catalog\Manager\Factory::create($this->context)->getSubmanager('lists'); |
|
263 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::create($this->context); |
|
264 | + $listManager = $productManager->getSubManager('lists'); |
|
265 | 265 | |
266 | - foreach( $this->get( $prodcodes, $delete + $nondelete ) as $id => $product ) |
|
266 | + foreach ($this->get($prodcodes, $delete + $nondelete) as $id => $product) |
|
267 | 267 | { |
268 | - foreach( $delete as $domain ) |
|
268 | + foreach ($delete as $domain) |
|
269 | 269 | { |
270 | - $manager = \Aimeos\MShop::create( $this->context, $domain ); |
|
270 | + $manager = \Aimeos\MShop::create($this->context, $domain); |
|
271 | 271 | |
272 | - foreach( $product->getListItems( $domain ) as $listItem ) |
|
272 | + foreach ($product->getListItems($domain) as $listItem) |
|
273 | 273 | { |
274 | - $manager->deleteItem( $listItem->getRefItem()->getId() ); |
|
275 | - $listManager->deleteItem( $listItem->getId() ); |
|
274 | + $manager->deleteItem($listItem->getRefItem()->getId()); |
|
275 | + $listManager->deleteItem($listItem->getId()); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - foreach( $nondelete as $domain ) |
|
279 | + foreach ($nondelete as $domain) |
|
280 | 280 | { |
281 | - $ids = array_keys( $product->getListItems( $domain ) ); |
|
282 | - $listManager->deleteItems( $ids ); |
|
281 | + $ids = array_keys($product->getListItems($domain)); |
|
282 | + $listManager->deleteItems($ids); |
|
283 | 283 | } |
284 | 284 | |
285 | - $productManager->deleteItem( $product->getId() ); |
|
285 | + $productManager->deleteItem($product->getId()); |
|
286 | 286 | |
287 | 287 | $search = $catListManager->createSearch(); |
288 | - $search->setConditions( $search->compare( '==', 'catalog.lists.refid', $id ) ); |
|
289 | - $result = $catListManager->searchItems( $search ); |
|
288 | + $search->setConditions($search->compare('==', 'catalog.lists.refid', $id)); |
|
289 | + $result = $catListManager->searchItems($search); |
|
290 | 290 | |
291 | - $catListManager->deleteItems( array_keys( $result ) ); |
|
291 | + $catListManager->deleteItems(array_keys($result)); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | - $attrManager = \Aimeos\MShop\Attribute\Manager\Factory::create( $this->context ); |
|
295 | + $attrManager = \Aimeos\MShop\Attribute\Manager\Factory::create($this->context); |
|
296 | 296 | |
297 | 297 | $search = $attrManager->createSearch(); |
298 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'import-test' ) ); |
|
298 | + $search->setConditions($search->compare('==', 'attribute.code', 'import-test')); |
|
299 | 299 | |
300 | - $result = $attrManager->searchItems( $search ); |
|
300 | + $result = $attrManager->searchItems($search); |
|
301 | 301 | |
302 | - $attrManager->deleteItems( array_keys( $result ) ); |
|
302 | + $attrManager->deleteItems(array_keys($result)); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | - protected function get( array $prodcodes, array $domains ) |
|
306 | + protected function get(array $prodcodes, array $domains) |
|
307 | 307 | { |
308 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context ); |
|
308 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::create($this->context); |
|
309 | 309 | |
310 | 310 | $search = $productManager->createSearch(); |
311 | - $search->setConditions( $search->compare( '==', 'product.code', $prodcodes ) ); |
|
311 | + $search->setConditions($search->compare('==', 'product.code', $prodcodes)); |
|
312 | 312 | |
313 | - return $productManager->searchItems( $search, $domains ); |
|
313 | + return $productManager->searchItems($search, $domains); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
317 | - protected function getProperties( array $prodids ) |
|
317 | + protected function getProperties(array $prodids) |
|
318 | 318 | { |
319 | - $manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context )->getSubManager( 'property' ); |
|
319 | + $manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context)->getSubManager('property'); |
|
320 | 320 | |
321 | 321 | $search = $manager->createSearch(); |
322 | - $search->setConditions( $search->compare( '==', 'product.property.parentid', $prodids ) ); |
|
323 | - $search->setSortations( array( $search->sort( '+', 'product.property.type' ) ) ); |
|
322 | + $search->setConditions($search->compare('==', 'product.property.parentid', $prodids)); |
|
323 | + $search->setSortations(array($search->sort('+', 'product.property.type'))); |
|
324 | 324 | |
325 | - return $manager->searchItems( $search ); |
|
325 | + return $manager->searchItems($search); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | \ No newline at end of file |
@@ -20,95 +20,95 @@ |
||
20 | 20 | $this->context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard( $this->context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard($this->context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - unset( $this->object, $this->context ); |
|
29 | + unset($this->object, $this->context); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Subscription export CSV', $this->object->getName() ); |
|
35 | + $this->assertEquals('Subscription export CSV', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | - $this->assertEquals( 'Exports subscriptions to CSV file', $this->object->getDescription() ); |
|
41 | + $this->assertEquals('Exports subscriptions to CSV file', $this->object->getDescription()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testRun() |
46 | 46 | { |
47 | - $mqmStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Manager\\Standard' ) |
|
48 | - ->setConstructorArgs( [$this->context->getConfig()] ) |
|
49 | - ->setMethods( ['get'] ) |
|
47 | + $mqmStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Manager\\Standard') |
|
48 | + ->setConstructorArgs([$this->context->getConfig()]) |
|
49 | + ->setMethods(['get']) |
|
50 | 50 | ->getMock(); |
51 | 51 | |
52 | - $mqStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Standard' ) |
|
52 | + $mqStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Standard') |
|
53 | 53 | ->disableOriginalConstructor() |
54 | - ->setMethods( ['getQueue'] ) |
|
54 | + ->setMethods(['getQueue']) |
|
55 | 55 | ->getMock(); |
56 | 56 | |
57 | - $queueStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Queue\\Standard' ) |
|
57 | + $queueStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Queue\\Standard') |
|
58 | 58 | ->disableOriginalConstructor() |
59 | - ->setMethods( ['del', 'get'] ) |
|
59 | + ->setMethods(['del', 'get']) |
|
60 | 60 | ->getMock(); |
61 | 61 | |
62 | - $msgStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Message\\Standard' ) |
|
62 | + $msgStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Message\\Standard') |
|
63 | 63 | ->disableOriginalConstructor() |
64 | - ->setMethods( ['getBody'] ) |
|
64 | + ->setMethods(['getBody']) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | 67 | |
68 | - $this->context->setMessageQueueManager( $mqmStub ); |
|
68 | + $this->context->setMessageQueueManager($mqmStub); |
|
69 | 69 | |
70 | 70 | |
71 | - $mqmStub->expects( $this->once() )->method( 'get' ) |
|
72 | - ->will( $this->returnValue( $mqStub ) ); |
|
71 | + $mqmStub->expects($this->once())->method('get') |
|
72 | + ->will($this->returnValue($mqStub)); |
|
73 | 73 | |
74 | - $mqStub->expects( $this->once() )->method( 'getQueue' ) |
|
75 | - ->will( $this->returnValue( $queueStub ) ); |
|
74 | + $mqStub->expects($this->once())->method('getQueue') |
|
75 | + ->will($this->returnValue($queueStub)); |
|
76 | 76 | |
77 | - $queueStub->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
78 | - ->will( $this->onConsecutiveCalls( $msgStub, null ) ); |
|
77 | + $queueStub->expects($this->exactly(2))->method('get') |
|
78 | + ->will($this->onConsecutiveCalls($msgStub, null)); |
|
79 | 79 | |
80 | - $queueStub->expects( $this->once() )->method( 'del' ); |
|
80 | + $queueStub->expects($this->once())->method('del'); |
|
81 | 81 | |
82 | - $msgStub->expects( $this->once() )->method( 'getBody' ) |
|
83 | - ->will( $this->returnValue( '{"sitecode":"unittest"}' ) ); |
|
82 | + $msgStub->expects($this->once())->method('getBody') |
|
83 | + ->will($this->returnValue('{"sitecode":"unittest"}')); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->object->run(); |
87 | 87 | |
88 | 88 | |
89 | - $jobManager = \Aimeos\MAdmin::create( $this->context, 'job' ); |
|
89 | + $jobManager = \Aimeos\MAdmin::create($this->context, 'job'); |
|
90 | 90 | $jobSearch = $jobManager->createSearch(); |
91 | - $jobSearch->setConditions( $jobSearch->compare( '=~', 'job.label', 'subscription-export_' ) ); |
|
92 | - $jobItems = $jobManager->searchItems( $jobSearch ); |
|
93 | - $jobManager->deleteItems( array_keys( $jobItems ) ); |
|
91 | + $jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'subscription-export_')); |
|
92 | + $jobItems = $jobManager->searchItems($jobSearch); |
|
93 | + $jobManager->deleteItems(array_keys($jobItems)); |
|
94 | 94 | |
95 | - $this->assertEquals( 1, count( $jobItems ) ); |
|
95 | + $this->assertEquals(1, count($jobItems)); |
|
96 | 96 | |
97 | 97 | |
98 | - $filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel(); |
|
99 | - $fp = fopen( $filename, 'r' ); |
|
98 | + $filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel(); |
|
99 | + $fp = fopen($filename, 'r'); |
|
100 | 100 | |
101 | - $subscription = fgetcsv( $fp ); |
|
102 | - $address1 = fgetcsv( $fp ); |
|
103 | - $address2 = fgetcsv( $fp ); |
|
104 | - $product1 = fgetcsv( $fp ); |
|
101 | + $subscription = fgetcsv($fp); |
|
102 | + $address1 = fgetcsv($fp); |
|
103 | + $address2 = fgetcsv($fp); |
|
104 | + $product1 = fgetcsv($fp); |
|
105 | 105 | |
106 | - fclose( $fp ); |
|
107 | - unlink( $filename ); |
|
106 | + fclose($fp); |
|
107 | + unlink($filename); |
|
108 | 108 | |
109 | - $this->assertEquals( 'subscription', $subscription[0] ); |
|
110 | - $this->assertEquals( 'address', $address1[0] ); |
|
111 | - $this->assertEquals( 'address', $address2[0] ); |
|
112 | - $this->assertEquals( 'product', $product1[0] ); |
|
109 | + $this->assertEquals('subscription', $subscription[0]); |
|
110 | + $this->assertEquals('address', $address1[0]); |
|
111 | + $this->assertEquals('address', $address2[0]); |
|
112 | + $this->assertEquals('product', $product1[0]); |
|
113 | 113 | } |
114 | 114 | } |
@@ -20,49 +20,49 @@ discard block |
||
20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
21 | 21 | $this->context = \TestHelperJobs::getContext(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard( $this->context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard($this->context, $aimeos); |
|
24 | 24 | |
25 | - \Aimeos\MShop::cache( true ); |
|
25 | + \Aimeos\MShop::cache(true); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | protected function tearDown() |
30 | 30 | { |
31 | - \Aimeos\MShop::cache( false ); |
|
31 | + \Aimeos\MShop::cache(false); |
|
32 | 32 | \Aimeos\MShop::clear(); |
33 | 33 | |
34 | - unset( $this->object, $this->context ); |
|
34 | + unset($this->object, $this->context); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetName() |
39 | 39 | { |
40 | - $this->assertEquals( 'Subscription process end', $this->object->getName() ); |
|
40 | + $this->assertEquals('Subscription process end', $this->object->getName()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetDescription() |
45 | 45 | { |
46 | - $this->assertEquals( 'Terminates expired subscriptions', $this->object->getDescription() ); |
|
46 | + $this->assertEquals('Terminates expired subscriptions', $this->object->getDescription()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testRun() |
51 | 51 | { |
52 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
52 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
53 | 53 | $item = $this->getSubscription(); |
54 | 54 | |
55 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
56 | - ->setConstructorArgs( [$this->context] ) |
|
57 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
55 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
56 | + ->setConstructorArgs([$this->context]) |
|
57 | + ->setMethods(['searchItems', 'saveItem']) |
|
58 | 58 | ->getMock(); |
59 | 59 | |
60 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
60 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
61 | 61 | |
62 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
63 | - ->will( $this->returnValue( [$item] ) ); |
|
62 | + $managerStub->expects($this->once())->method('searchItems') |
|
63 | + ->will($this->returnValue([$item])); |
|
64 | 64 | |
65 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
65 | + $managerStub->expects($this->once())->method('saveItem'); |
|
66 | 66 | |
67 | 67 | $this->object->run(); |
68 | 68 | } |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | |
71 | 71 | public function testRunException() |
72 | 72 | { |
73 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
74 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] ); |
|
73 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
74 | + $this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']); |
|
75 | 75 | |
76 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
77 | - ->setConstructorArgs( [$this->context] ) |
|
78 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
76 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
77 | + ->setConstructorArgs([$this->context]) |
|
78 | + ->setMethods(['searchItems', 'saveItem']) |
|
79 | 79 | ->getMock(); |
80 | 80 | |
81 | - \Aimeos\MShop::inject( $this->context, 'subscription', $managerStub ); |
|
81 | + \Aimeos\MShop::inject($this->context, 'subscription', $managerStub); |
|
82 | 82 | |
83 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
84 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
83 | + $managerStub->expects($this->once())->method('searchItems') |
|
84 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
85 | 85 | |
86 | - $managerStub->expects( $this->never() )->method( 'saveItem' ); |
|
86 | + $managerStub->expects($this->never())->method('saveItem'); |
|
87 | 87 | |
88 | 88 | $this->object->run(); |
89 | 89 | } |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | |
92 | 92 | protected function getSubscription() |
93 | 93 | { |
94 | - $manager = \Aimeos\MShop::create( $this->context, 'subscription' ); |
|
94 | + $manager = \Aimeos\MShop::create($this->context, 'subscription'); |
|
95 | 95 | |
96 | 96 | $search = $manager->createSearch(); |
97 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
97 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
98 | 98 | |
99 | - $items = $manager->searchItems( $search ); |
|
99 | + $items = $manager->searchItems($search); |
|
100 | 100 | |
101 | - if( ( $item = reset( $items ) ) !== false ) { |
|
101 | + if (($item = reset($items)) !== false) { |
|
102 | 102 | return $item; |
103 | 103 | } |
104 | 104 | |
105 | - throw new \Exception( 'No subscription item found' ); |
|
105 | + throw new \Exception('No subscription item found'); |
|
106 | 106 | } |
107 | 107 | } |
@@ -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::cache( true ); |
|
26 | + \Aimeos\MShop::cache(true); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - \Aimeos\MShop::cache( false ); |
|
32 | + \Aimeos\MShop::cache(false); |
|
33 | 33 | \Aimeos\MShop::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::inject( $this->context, 'subscription', $managerStub ); |
|
66 | + \Aimeos\MShop::inject($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::inject( $this->context, 'subscription', $managerStub ); |
|
94 | + \Aimeos\MShop::inject($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,79 +104,79 @@ discard block |
||
104 | 104 | |
105 | 105 | public function testAddBasketAddresses() |
106 | 106 | { |
107 | - $basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem(); |
|
108 | - $address = \Aimeos\MShop::create( $this->context, 'order/base/address' )->createItem(); |
|
107 | + $basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem(); |
|
108 | + $address = \Aimeos\MShop::create($this->context, 'order/base/address')->createItem(); |
|
109 | 109 | |
110 | 110 | $addresses = ['payment' => $address]; |
111 | - $basket = $this->access( 'addBasketAddresses' )->invokeArgs( $this->object, [$this->context, $basket, $addresses] ); |
|
111 | + $basket = $this->access('addBasketAddresses')->invokeArgs($this->object, [$this->context, $basket, $addresses]); |
|
112 | 112 | |
113 | - $this->assertEquals( 1, count( $basket->getAddresses() ) ); |
|
114 | - $this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress( 'payment' ) ); |
|
113 | + $this->assertEquals(1, count($basket->getAddresses())); |
|
114 | + $this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress('payment')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | 118 | public function testAddBasketCoupons() |
119 | 119 | { |
120 | - $this->context->getConfig()->set( 'controller/jobs/subcription/process/renew/standard/use-coupons', true ); |
|
120 | + $this->context->getConfig()->set('controller/jobs/subcription/process/renew/standard/use-coupons', true); |
|
121 | 121 | |
122 | - $basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem(); |
|
123 | - $product = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC', ['price'] ); |
|
124 | - $orderProduct = \Aimeos\MShop::create( $this->context, 'order/base/product' )->createItem(); |
|
122 | + $basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem(); |
|
123 | + $product = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC', ['price']); |
|
124 | + $orderProduct = \Aimeos\MShop::create($this->context, 'order/base/product')->createItem(); |
|
125 | 125 | |
126 | - $price = $product->getRefItems( 'price', 'default', 'default' ); |
|
127 | - $basket->addProduct( $orderProduct->copyFrom( $product )->setPrice( reset( $price ) ) ); |
|
126 | + $price = $product->getRefItems('price', 'default', 'default'); |
|
127 | + $basket->addProduct($orderProduct->copyFrom($product)->setPrice(reset($price))); |
|
128 | 128 | |
129 | - $this->assertEquals( '600.00', $basket->getPrice()->getValue() ); |
|
130 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
131 | - $this->assertEquals( '0.00', $basket->getPrice()->getRebate() ); |
|
129 | + $this->assertEquals('600.00', $basket->getPrice()->getValue()); |
|
130 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
131 | + $this->assertEquals('0.00', $basket->getPrice()->getRebate()); |
|
132 | 132 | |
133 | - $basket = $this->access( 'addBasketCoupons' )->invokeArgs( $this->object, [$this->context, $basket, ['90AB']] ); |
|
133 | + $basket = $this->access('addBasketCoupons')->invokeArgs($this->object, [$this->context, $basket, ['90AB']]); |
|
134 | 134 | |
135 | - $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
|
136 | - $this->assertEquals( 2, count( $basket->getProducts() ) ); |
|
137 | - $this->assertEquals( '537.00', $basket->getPrice()->getValue() ); |
|
138 | - $this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); |
|
139 | - $this->assertEquals( '63.00', $basket->getPrice()->getRebate() ); |
|
135 | + $this->assertEquals(1, count($basket->getCoupons())); |
|
136 | + $this->assertEquals(2, count($basket->getProducts())); |
|
137 | + $this->assertEquals('537.00', $basket->getPrice()->getValue()); |
|
138 | + $this->assertEquals('30.00', $basket->getPrice()->getCosts()); |
|
139 | + $this->assertEquals('63.00', $basket->getPrice()->getRebate()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | public function testAddBasketProducts() |
144 | 144 | { |
145 | - $basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem(); |
|
146 | - $product = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' ); |
|
147 | - $manager = \Aimeos\MShop::create( $this->context, 'order/base/product' ); |
|
145 | + $basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem(); |
|
146 | + $product = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC'); |
|
147 | + $manager = \Aimeos\MShop::create($this->context, 'order/base/product'); |
|
148 | 148 | |
149 | 149 | $orderProducts = [ |
150 | - $manager->createItem()->copyFrom( $product )->setId( 1 ), |
|
151 | - $manager->createItem()->copyFrom( $product )->setId( 2 ), |
|
150 | + $manager->createItem()->copyFrom($product)->setId(1), |
|
151 | + $manager->createItem()->copyFrom($product)->setId(2), |
|
152 | 152 | ]; |
153 | 153 | |
154 | - $basket = $this->access( 'addBasketProducts' )->invokeArgs( $this->object, [$this->context, $basket, $orderProducts, 1] ); |
|
154 | + $basket = $this->access('addBasketProducts')->invokeArgs($this->object, [$this->context, $basket, $orderProducts, 1]); |
|
155 | 155 | |
156 | - $this->assertEquals( 1, count( $basket->getProducts() ) ); |
|
157 | - $this->assertNull( $basket->getProduct( 0 )->getId() ); |
|
156 | + $this->assertEquals(1, count($basket->getProducts())); |
|
157 | + $this->assertNull($basket->getProduct(0)->getId()); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | public function testAddBasketServices() |
162 | 162 | { |
163 | - $basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem(); |
|
164 | - $manager = \Aimeos\MShop::create( $this->context, 'order/base/service' ); |
|
163 | + $basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem(); |
|
164 | + $manager = \Aimeos\MShop::create($this->context, 'order/base/service'); |
|
165 | 165 | |
166 | 166 | $orderServices = [ |
167 | - 'delivery' => [$manager->createItem()->setCode( 'shiptest' )], |
|
168 | - 'payment' => [$manager->createItem()->setCode( 'paytest' )], |
|
167 | + 'delivery' => [$manager->createItem()->setCode('shiptest')], |
|
168 | + 'payment' => [$manager->createItem()->setCode('paytest')], |
|
169 | 169 | ]; |
170 | 170 | |
171 | - $basket = $this->access( 'addBasketServices' )->invokeArgs( $this->object, [$this->context, $basket, $orderServices] ); |
|
171 | + $basket = $this->access('addBasketServices')->invokeArgs($this->object, [$this->context, $basket, $orderServices]); |
|
172 | 172 | |
173 | 173 | $class = \Aimeos\MShop\Order\Item\Base\Service\Iface::class; |
174 | 174 | |
175 | - $this->assertEquals( 2, count( $basket->getServices() ) ); |
|
176 | - $this->assertEquals( 1, count( $basket->getService( 'delivery' ) ) ); |
|
177 | - $this->assertInstanceOf( $class, $basket->getService( 'delivery', 'unitcode' ) ); |
|
178 | - $this->assertEquals( 1, count( $basket->getService( 'payment' ) ) ); |
|
179 | - $this->assertInstanceOf( $class, $basket->getService( 'payment', 'paytest' ) ); |
|
175 | + $this->assertEquals(2, count($basket->getServices())); |
|
176 | + $this->assertEquals(1, count($basket->getService('delivery'))); |
|
177 | + $this->assertInstanceOf($class, $basket->getService('delivery', 'unitcode')); |
|
178 | + $this->assertEquals(1, count($basket->getService('payment'))); |
|
179 | + $this->assertInstanceOf($class, $basket->getService('payment', 'paytest')); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -184,34 +184,34 @@ discard block |
||
184 | 184 | { |
185 | 185 | $item = $this->getSubscription(); |
186 | 186 | |
187 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
188 | - ->setConstructorArgs( [$this->context] ) |
|
189 | - ->setMethods( ['store'] ) |
|
187 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
188 | + ->setConstructorArgs([$this->context]) |
|
189 | + ->setMethods(['store']) |
|
190 | 190 | ->getMock(); |
191 | 191 | |
192 | - \Aimeos\MShop::inject( $this->context, 'order/base', $managerStub ); |
|
192 | + \Aimeos\MShop::inject($this->context, 'order/base', $managerStub); |
|
193 | 193 | |
194 | - $managerStub->expects( $this->once() )->method( 'store' ); |
|
194 | + $managerStub->expects($this->once())->method('store'); |
|
195 | 195 | |
196 | - $this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] ); |
|
196 | + $this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | 200 | public function testCreateOrderInvoice() |
201 | 201 | { |
202 | 202 | $item = $this->getSubscription(); |
203 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
203 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
204 | 204 | |
205 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
206 | - ->setConstructorArgs( [$this->context] ) |
|
207 | - ->setMethods( ['saveItem'] ) |
|
205 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
206 | + ->setConstructorArgs([$this->context]) |
|
207 | + ->setMethods(['saveItem']) |
|
208 | 208 | ->getMock(); |
209 | 209 | |
210 | - \Aimeos\MShop::inject( $this->context, 'order', $managerStub ); |
|
210 | + \Aimeos\MShop::inject($this->context, 'order', $managerStub); |
|
211 | 211 | |
212 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
212 | + $managerStub->expects($this->once())->method('saveItem'); |
|
213 | 213 | |
214 | - $this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] ); |
|
214 | + $this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -219,55 +219,55 @@ discard block |
||
219 | 219 | { |
220 | 220 | $item = $this->getSubscription(); |
221 | 221 | $invoice = $this->getOrderItem(); |
222 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
222 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
223 | 223 | |
224 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
225 | - ->setConstructorArgs( [$this->context] ) |
|
226 | - ->setMethods( ['saveItem'] ) |
|
224 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
225 | + ->setConstructorArgs([$this->context]) |
|
226 | + ->setMethods(['saveItem']) |
|
227 | 227 | ->getMock(); |
228 | 228 | |
229 | - \Aimeos\MShop::inject( $this->context, 'order', $managerStub ); |
|
229 | + \Aimeos\MShop::inject($this->context, 'order', $managerStub); |
|
230 | 230 | |
231 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
231 | + $managerStub->expects($this->once())->method('saveItem'); |
|
232 | 232 | |
233 | - $this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] ); |
|
233 | + $this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | protected function getOrderItem() |
238 | 238 | { |
239 | - return \Aimeos\MShop::create( $this->context, 'order' )->createItem(); |
|
239 | + return \Aimeos\MShop::create($this->context, 'order')->createItem(); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
243 | - protected function getOrderBaseItem( $baseId ) |
|
243 | + protected function getOrderBaseItem($baseId) |
|
244 | 244 | { |
245 | - return \Aimeos\MShop::create( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] ); |
|
245 | + return \Aimeos\MShop::create($this->context, 'order/base')->getItem($baseId, ['order/base/service']); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
249 | 249 | protected function getSubscription() |
250 | 250 | { |
251 | - $manager = \Aimeos\MShop::create( $this->context, 'subscription' ); |
|
251 | + $manager = \Aimeos\MShop::create($this->context, 'subscription'); |
|
252 | 252 | |
253 | 253 | $search = $manager->createSearch(); |
254 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
254 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
255 | 255 | |
256 | - $items = $manager->searchItems( $search ); |
|
256 | + $items = $manager->searchItems($search); |
|
257 | 257 | |
258 | - if( ( $item = reset( $items ) ) !== false ) { |
|
258 | + if (($item = reset($items)) !== false) { |
|
259 | 259 | return $item; |
260 | 260 | } |
261 | 261 | |
262 | - throw new \Exception( 'No subscription item found' ); |
|
262 | + throw new \Exception('No subscription item found'); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
266 | - protected function access( $name ) |
|
266 | + protected function access($name) |
|
267 | 267 | { |
268 | - $class = new \ReflectionClass( \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class ); |
|
269 | - $method = $class->getMethod( $name ); |
|
270 | - $method->setAccessible( true ); |
|
268 | + $class = new \ReflectionClass(\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class); |
|
269 | + $method = $class->getMethod($name); |
|
270 | + $method->setAccessible(true); |
|
271 | 271 | |
272 | 272 | return $method; |
273 | 273 | } |