@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $context = \TestHelperJobs::getContext(); |
| 17 | 17 | $aimeos = \TestHelperJobs::getAimeos(); |
| 18 | 18 | |
| 19 | - $obj = \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController( $context, $aimeos ); |
|
| 20 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
| 19 | + $obj = \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController($context, $aimeos); |
|
| 20 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | $context = \TestHelperJobs::getContext(); |
| 27 | 27 | $aimeos = \TestHelperJobs::getAimeos(); |
| 28 | 28 | |
| 29 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 30 | - \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController( $context, $aimeos, 'Wrong$$$Name' ); |
|
| 29 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 30 | + \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController($context, $aimeos, 'Wrong$$$Name'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $context = \TestHelperJobs::getContext(); |
| 37 | 37 | $aimeos = \TestHelperJobs::getAimeos(); |
| 38 | 38 | |
| 39 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 40 | - \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController( $context, $aimeos, 'WrongClass' ); |
|
| 39 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 40 | + \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController($context, $aimeos, 'WrongClass'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $context = \TestHelperJobs::getContext(); |
| 47 | 47 | $aimeos = \TestHelperJobs::getAimeos(); |
| 48 | 48 | |
| 49 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 50 | - \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController( $context, $aimeos, 'Factory' ); |
|
| 49 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 50 | + \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Factory::createController($context, $aimeos, 'Factory'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |
@@ -29,59 +29,59 @@ |
||
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Service\Standard( $context, $mapping ); |
|
| 33 | - |
|
| 34 | - $invoice = $this->getInvoice( $context ); |
|
| 35 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
| 36 | - |
|
| 37 | - $data = $object->process( $invoice, $order ); |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - $this->assertEquals( 2, count( $data ) ); |
|
| 41 | - |
|
| 42 | - $this->assertEquals( 12, count( $data[0] ) ); |
|
| 43 | - $this->assertEquals( 'payment', $data[0][0] ); |
|
| 44 | - $this->assertEquals( 'OGONE', $data[0][1] ); |
|
| 45 | - $this->assertEquals( 'ogone', $data[0][2] ); |
|
| 46 | - $this->assertEquals( 'somewhere/thump1.jpg', $data[0][3] ); |
|
| 47 | - $this->assertEquals( '0.00', $data[0][4] ); |
|
| 48 | - $this->assertEquals( '0.00', $data[0][5] ); |
|
| 49 | - $this->assertEquals( '0.00', $data[0][6] ); |
|
| 50 | - $this->assertEquals( '0.0000', $data[0][7] ); |
|
| 51 | - $this->assertEquals( "payment\npayment\npayment\npayment\npayment\npayment\npayment\npayment\npayment", $data[0][8] ); |
|
| 52 | - $this->assertEquals( "ACOWNER\nACSTRING\nNAME\nOgone-alias-name\nOgone-alias-value\nREFID\nTXDATE\nX-ACCOUNT\nX-STATUS", $data[0][9] ); |
|
| 53 | - $this->assertEquals( "account owner\naccount number\npayment method\nogone alias name\nogone alias value\nreference id\ntransaction date\ntransaction account\ntransaction status", $data[0][10] ); |
|
| 54 | - $this->assertEquals( "test user\n9876543\nCreditCard\naliasName\naliasValue\n12345678\n2009-08-18\nKraft02\n9", $data[0][11] ); |
|
| 55 | - |
|
| 56 | - $this->assertEquals( 12, count( $data[1] ) ); |
|
| 57 | - $this->assertEquals( 'delivery', $data[1][0] ); |
|
| 58 | - $this->assertEquals( '73', $data[1][1] ); |
|
| 59 | - $this->assertEquals( 'solucia', $data[1][2] ); |
|
| 60 | - $this->assertEquals( 'somewhere/thump1.jpg', $data[1][3] ); |
|
| 61 | - $this->assertEquals( '0.00', $data[1][4] ); |
|
| 62 | - $this->assertEquals( '5.00', $data[1][5] ); |
|
| 63 | - $this->assertEquals( '0.00', $data[1][6] ); |
|
| 64 | - $this->assertEquals( '0.0000', $data[1][7] ); |
|
| 65 | - $this->assertEquals( '', $data[1][8] ); |
|
| 66 | - $this->assertEquals( '', $data[1][9] ); |
|
| 67 | - $this->assertEquals( '', $data[1][10] ); |
|
| 68 | - $this->assertEquals( '', $data[1][11] ); |
|
| 32 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Service\Standard($context, $mapping); |
|
| 33 | + |
|
| 34 | + $invoice = $this->getInvoice($context); |
|
| 35 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
| 36 | + |
|
| 37 | + $data = $object->process($invoice, $order); |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + $this->assertEquals(2, count($data)); |
|
| 41 | + |
|
| 42 | + $this->assertEquals(12, count($data[0])); |
|
| 43 | + $this->assertEquals('payment', $data[0][0]); |
|
| 44 | + $this->assertEquals('OGONE', $data[0][1]); |
|
| 45 | + $this->assertEquals('ogone', $data[0][2]); |
|
| 46 | + $this->assertEquals('somewhere/thump1.jpg', $data[0][3]); |
|
| 47 | + $this->assertEquals('0.00', $data[0][4]); |
|
| 48 | + $this->assertEquals('0.00', $data[0][5]); |
|
| 49 | + $this->assertEquals('0.00', $data[0][6]); |
|
| 50 | + $this->assertEquals('0.0000', $data[0][7]); |
|
| 51 | + $this->assertEquals("payment\npayment\npayment\npayment\npayment\npayment\npayment\npayment\npayment", $data[0][8]); |
|
| 52 | + $this->assertEquals("ACOWNER\nACSTRING\nNAME\nOgone-alias-name\nOgone-alias-value\nREFID\nTXDATE\nX-ACCOUNT\nX-STATUS", $data[0][9]); |
|
| 53 | + $this->assertEquals("account owner\naccount number\npayment method\nogone alias name\nogone alias value\nreference id\ntransaction date\ntransaction account\ntransaction status", $data[0][10]); |
|
| 54 | + $this->assertEquals("test user\n9876543\nCreditCard\naliasName\naliasValue\n12345678\n2009-08-18\nKraft02\n9", $data[0][11]); |
|
| 55 | + |
|
| 56 | + $this->assertEquals(12, count($data[1])); |
|
| 57 | + $this->assertEquals('delivery', $data[1][0]); |
|
| 58 | + $this->assertEquals('73', $data[1][1]); |
|
| 59 | + $this->assertEquals('solucia', $data[1][2]); |
|
| 60 | + $this->assertEquals('somewhere/thump1.jpg', $data[1][3]); |
|
| 61 | + $this->assertEquals('0.00', $data[1][4]); |
|
| 62 | + $this->assertEquals('5.00', $data[1][5]); |
|
| 63 | + $this->assertEquals('0.00', $data[1][6]); |
|
| 64 | + $this->assertEquals('0.0000', $data[1][7]); |
|
| 65 | + $this->assertEquals('', $data[1][8]); |
|
| 66 | + $this->assertEquals('', $data[1][9]); |
|
| 67 | + $this->assertEquals('', $data[1][10]); |
|
| 68 | + $this->assertEquals('', $data[1][11]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - protected function getInvoice( $context ) |
|
| 72 | + protected function getInvoice($context) |
|
| 73 | 73 | { |
| 74 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 74 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 75 | 75 | |
| 76 | 76 | $search = $manager->createSearch(); |
| 77 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
| 77 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
| 78 | 78 | |
| 79 | - $items = $manager->searchItems( $search ); |
|
| 79 | + $items = $manager->searchItems($search); |
|
| 80 | 80 | |
| 81 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 81 | + if (($item = reset($items)) !== false) { |
|
| 82 | 82 | return $item; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - throw new \Exception( 'No order item found' ); |
|
| 85 | + throw new \Exception('No order item found'); |
|
| 86 | 86 | } |
| 87 | 87 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function getName() |
| 31 | 31 | { |
| 32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Batch update of payment/delivery status' ); |
|
| 32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Batch update of payment/delivery status'); |
|
| 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', 'Executes payment or delivery service providers that uses batch updates' ); |
|
| 43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Executes payment or delivery service providers that uses batch updates'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -52,32 +52,32 @@ discard block |
||
| 52 | 52 | public function run() |
| 53 | 53 | { |
| 54 | 54 | $context = $this->getContext(); |
| 55 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 55 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 56 | 56 | |
| 57 | 57 | $search = $serviceManager->createSearch(); |
| 58 | 58 | $start = 0; |
| 59 | 59 | |
| 60 | 60 | do |
| 61 | 61 | { |
| 62 | - $serviceItems = $serviceManager->searchItems( $search ); |
|
| 62 | + $serviceItems = $serviceManager->searchItems($search); |
|
| 63 | 63 | |
| 64 | - foreach( $serviceItems as $serviceItem ) |
|
| 64 | + foreach ($serviceItems as $serviceItem) |
|
| 65 | 65 | { |
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | - $serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync(); |
|
| 68 | + $serviceManager->getProvider($serviceItem, $serviceItem->getType())->updateAsync(); |
|
| 69 | 69 | } |
| 70 | - catch( \Exception $e ) |
|
| 70 | + catch (\Exception $e) |
|
| 71 | 71 | { |
| 72 | 72 | $msg = 'Executing updateAsyc() of "%1$s" failed: %2$s'; |
| 73 | - $context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) ); |
|
| 73 | + $context->getLogger()->log(sprintf($msg, $serviceItem->getProvider(), $e->getMessage())); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $count = count( $serviceItems ); |
|
| 77 | + $count = count($serviceItems); |
|
| 78 | 78 | $start += $count; |
| 79 | - $search->setSlice( $start ); |
|
| 79 | + $search->setSlice($start); |
|
| 80 | 80 | } |
| 81 | - while( $count >= $search->getSliceSize() ); |
|
| 81 | + while ($count >= $search->getSliceSize()); |
|
| 82 | 82 | } |
| 83 | 83 | } |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | 68 | $serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync(); |
| 69 | - } |
|
| 70 | - catch( \Exception $e ) |
|
| 69 | + } catch( \Exception $e ) |
|
| 71 | 70 | { |
| 72 | 71 | $msg = 'Executing updateAsyc() of "%1$s" failed: %2$s'; |
| 73 | 72 | $context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) ); |
@@ -248,6 +248,9 @@ |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| 251 | + /** |
|
| 252 | + * @param string $catcode |
|
| 253 | + */ |
|
| 251 | 254 | protected function get( $catcode, array $domains = [] ) |
| 252 | 255 | { |
| 253 | 256 | $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
@@ -18,65 +18,65 @@ 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/catalog/import/csv/skip-lines', 1 ); |
|
| 28 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid' ); |
|
| 27 | + $config->set('controller/jobs/catalog/import/csv/skip-lines', 1); |
|
| 28 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid'); |
|
| 29 | 29 | |
| 30 | - $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
| 30 | + $this->object = new \Aimeos\Controller\Jobs\Catalog\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( 'Catalog import CSV', $this->object->getName() ); |
|
| 49 | + $this->assertEquals('Catalog 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 categories 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 | - $catcodes = array( 'job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4' ); |
|
| 63 | - $domains = array( 'media', 'text' ); |
|
| 62 | + $catcodes = array('job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4'); |
|
| 63 | + $domains = array('media', 'text'); |
|
| 64 | 64 | |
| 65 | 65 | $convert = array( |
| 66 | 66 | 1 => 'Text/LatinUTF8', |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/converter', $convert ); |
|
| 69 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/converter', $convert); |
|
| 70 | 70 | |
| 71 | 71 | $this->object->run(); |
| 72 | 72 | |
| 73 | - $tree = $this->get( 'job_csv_test', $domains ); |
|
| 74 | - $this->delete( $tree, $domains ); |
|
| 73 | + $tree = $this->get('job_csv_test', $domains); |
|
| 74 | + $this->delete($tree, $domains); |
|
| 75 | 75 | |
| 76 | - $this->assertEquals( 2, count( $tree->getListItems() ) ); |
|
| 76 | + $this->assertEquals(2, count($tree->getListItems())); |
|
| 77 | 77 | |
| 78 | - foreach( $tree->getChildren() as $node ) { |
|
| 79 | - $this->assertEquals( 2, count( $node->getListItems() ) ); |
|
| 78 | + foreach ($tree->getChildren() as $node) { |
|
| 79 | + $this->assertEquals(2, count($node->getListItems())); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | $this->object->run(); |
| 87 | 87 | $this->object->run(); |
| 88 | 88 | |
| 89 | - $tree = $this->get( 'job_csv_test', ['media', 'text'] ); |
|
| 90 | - $this->delete( $tree, ['media', 'text'] ); |
|
| 89 | + $tree = $this->get('job_csv_test', ['media', 'text']); |
|
| 90 | + $this->delete($tree, ['media', 'text']); |
|
| 91 | 91 | |
| 92 | - $this->assertEquals( 2, count( $tree->getListItems() ) ); |
|
| 92 | + $this->assertEquals(2, count($tree->getListItems())); |
|
| 93 | 93 | |
| 94 | - foreach( $tree->getChildren() as $node ) { |
|
| 95 | - $this->assertEquals( 2, count( $node->getListItems() ) ); |
|
| 94 | + foreach ($tree->getChildren() as $node) { |
|
| 95 | + $this->assertEquals(2, count($node->getListItems())); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,18 +100,18 @@ discard block |
||
| 100 | 100 | public function testRunPosition() |
| 101 | 101 | { |
| 102 | 102 | $config = $this->context->getConfig(); |
| 103 | - $mapping = $config->set( 'controller/jobs/catalog/import/csv/mapping', [] ); |
|
| 104 | - $mapping['item'] = array( 0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent' ); |
|
| 103 | + $mapping = $config->set('controller/jobs/catalog/import/csv/mapping', []); |
|
| 104 | + $mapping['item'] = array(0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent'); |
|
| 105 | 105 | |
| 106 | - $config->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 107 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position' ); |
|
| 106 | + $config->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 107 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position'); |
|
| 108 | 108 | |
| 109 | 109 | $this->object->run(); |
| 110 | 110 | |
| 111 | - $tree = $this->get( 'job_csv_test' ); |
|
| 112 | - $this->delete( $tree ); |
|
| 111 | + $tree = $this->get('job_csv_test'); |
|
| 112 | + $this->delete($tree); |
|
| 113 | 113 | |
| 114 | - $this->assertEquals( 1, count( $tree->getChildren() ) ); |
|
| 114 | + $this->assertEquals(1, count($tree->getChildren())); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | ), |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 138 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 139 | 139 | |
| 140 | 140 | $this->object->run(); |
| 141 | 141 | |
| 142 | - $tree = $this->get( 'job_csv_test' ); |
|
| 143 | - $this->delete( $tree ); |
|
| 142 | + $tree = $this->get('job_csv_test'); |
|
| 143 | + $this->delete($tree); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | ), |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 155 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 156 | 156 | |
| 157 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 157 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 158 | 158 | $this->object->run(); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | ), |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | - $this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping ); |
|
| 181 | + $this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping); |
|
| 182 | 182 | |
| 183 | 183 | $config = $this->context->getConfig(); |
| 184 | - $config->set( 'controller/jobs/catalog/import/csv/skip-lines', 0 ); |
|
| 185 | - $config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid' ); |
|
| 184 | + $config->set('controller/jobs/catalog/import/csv/skip-lines', 0); |
|
| 185 | + $config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid'); |
|
| 186 | 186 | |
| 187 | - $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
| 187 | + $this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard($this->context, $this->aimeos); |
|
| 188 | 188 | |
| 189 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 189 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 190 | 190 | $this->object->run(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -194,65 +194,65 @@ discard block |
||
| 194 | 194 | public function testRunBackup() |
| 195 | 195 | { |
| 196 | 196 | $config = $this->context->getConfig(); |
| 197 | - $config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' ); |
|
| 198 | - $config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' ); |
|
| 199 | - $config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' ); |
|
| 197 | + $config->set('controller/jobs/catalog/import/csv/container/type', 'Zip'); |
|
| 198 | + $config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip'); |
|
| 199 | + $config->set('controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip'); |
|
| 200 | 200 | |
| 201 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
| 202 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
| 201 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
| 202 | + throw new \RuntimeException('Unable to copy test file'); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $this->object->run(); |
| 206 | 206 | |
| 207 | - $filename = strftime( 'tmp/test-%Y-%m-%d.zip' ); |
|
| 208 | - $this->assertTrue( file_exists( $filename ) ); |
|
| 207 | + $filename = strftime('tmp/test-%Y-%m-%d.zip'); |
|
| 208 | + $this->assertTrue(file_exists($filename)); |
|
| 209 | 209 | |
| 210 | - unlink( $filename ); |
|
| 210 | + unlink($filename); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | public function testRunBackupInvalid() |
| 215 | 215 | { |
| 216 | 216 | $config = $this->context->getConfig(); |
| 217 | - $config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' ); |
|
| 218 | - $config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' ); |
|
| 219 | - $config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip' ); |
|
| 217 | + $config->set('controller/jobs/catalog/import/csv/container/type', 'Zip'); |
|
| 218 | + $config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip'); |
|
| 219 | + $config->set('controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip'); |
|
| 220 | 220 | |
| 221 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
| 222 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
| 221 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
| 222 | + throw new \RuntimeException('Unable to copy test file'); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 225 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 226 | 226 | $this->object->run(); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | |
| 230 | - protected function delete( \Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = [] ) |
|
| 230 | + protected function delete(\Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = []) |
|
| 231 | 231 | { |
| 232 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 232 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 233 | 233 | |
| 234 | - foreach( $domains as $domain ) |
|
| 234 | + foreach ($domains as $domain) |
|
| 235 | 235 | { |
| 236 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, $domain ); |
|
| 236 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, $domain); |
|
| 237 | 237 | |
| 238 | - foreach( $tree->getListItems( $domain ) as $listItem ) { |
|
| 239 | - $manager->deleteItem( $listItem->getRefItem()->getId() ); |
|
| 238 | + foreach ($tree->getListItems($domain) as $listItem) { |
|
| 239 | + $manager->deleteItem($listItem->getRefItem()->getId()); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - foreach( $tree->getChildren() as $node ) { |
|
| 244 | - $this->delete( $node, $domains ); |
|
| 243 | + foreach ($tree->getChildren() as $node) { |
|
| 244 | + $this->delete($node, $domains); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $catalogManager->deleteItem( $tree->getId() ); |
|
| 247 | + $catalogManager->deleteItem($tree->getId()); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| 251 | - protected function get( $catcode, array $domains = [] ) |
|
| 251 | + protected function get($catcode, array $domains = []) |
|
| 252 | 252 | { |
| 253 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 254 | - $root = $manager->findItem( $catcode ); |
|
| 253 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 254 | + $root = $manager->findItem($catcode); |
|
| 255 | 255 | |
| 256 | - return $manager->getTree( $root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ); |
|
| 256 | + return $manager->getTree($root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 28 | 28 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor Decorated processor |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null ) |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null) |
|
| 32 | 32 | { |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param array $data List of CSV fields with position as key and data as value |
| 41 | 41 | * @return array List of data which hasn't been imported |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data ) |
|
| 43 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data) |
|
| 44 | 44 | { |
| 45 | 45 | return $data; |
| 46 | 46 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 27 | 27 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor Decorated processor |
| 28 | 28 | */ |
| 29 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 30 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null ); |
|
| 29 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 30 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -37,5 +37,5 @@ discard block |
||
| 37 | 37 | * @param array $data List of CSV fields with position as key and data as value |
| 38 | 38 | * @return array List of data which hasn't been imported |
| 39 | 39 | */ |
| 40 | - public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data ); |
|
| 40 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data); |
|
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 26 | 26 | */ |
| 27 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ); |
|
| 27 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Returns the item or ID for the given code |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | * @param string|null $type Item type if used and required |
| 34 | 34 | * @return \Aimeos\MShop\Common\Item\Iface|string|null Item object, unique ID or null if not found |
| 35 | 35 | */ |
| 36 | - public function get( $code, $type = null ); |
|
| 36 | + public function get($code, $type = null); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Adds the item or ID to the cache |
| 40 | 40 | * |
| 41 | 41 | * @param \Aimeos\MShop\Common\Item\Iface $item Item object |
| 42 | 42 | */ |
| 43 | - public function set( \Aimeos\MShop\Common\Item\Iface $item ); |
|
| 43 | + public function set(\Aimeos\MShop\Common\Item\Iface $item); |
|
| 44 | 44 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 31 | 31 | { |
| 32 | 32 | $this->context = $context; |
| 33 | 33 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $context = \TestHelperJobs::getContext(); |
| 17 | 17 | $aimeos = \TestHelperJobs::getAimeos(); |
| 18 | 18 | |
| 19 | - $obj = \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController( $context, $aimeos ); |
|
| 20 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
| 19 | + $obj = \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController($context, $aimeos); |
|
| 20 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | $context = \TestHelperJobs::getContext(); |
| 27 | 27 | $aimeos = \TestHelperJobs::getAimeos(); |
| 28 | 28 | |
| 29 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 30 | - \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController( $context, $aimeos, 'Wrong$$$Name' ); |
|
| 29 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 30 | + \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController($context, $aimeos, 'Wrong$$$Name'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $context = \TestHelperJobs::getContext(); |
| 37 | 37 | $aimeos = \TestHelperJobs::getAimeos(); |
| 38 | 38 | |
| 39 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 40 | - \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController( $context, $aimeos, 'WrongClass' ); |
|
| 39 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 40 | + \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController($context, $aimeos, 'WrongClass'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $context = \TestHelperJobs::getContext(); |
| 47 | 47 | $aimeos = \TestHelperJobs::getAimeos(); |
| 48 | 48 | |
| 49 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 50 | - \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController( $context, $aimeos, 'Factory' ); |
|
| 49 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 50 | + \Aimeos\Controller\Jobs\Catalog\Import\Csv\Factory::createController($context, $aimeos, 'Factory'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |