@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperCntl::getContext(); |
| 23 | - $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
| 23 | + $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 29 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 30 | 30 | \Aimeos\MShop\Factory::clear(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | 1 => '2000-01-01 00:00:00', |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - $product = $this->create( 'job_csv_test' ); |
|
| 46 | + $product = $this->create('job_csv_test'); |
|
| 47 | 47 | |
| 48 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 49 | - $object->process( $product, $data ); |
|
| 48 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
| 49 | + $object->process($product, $data); |
|
| 50 | 50 | |
| 51 | - $items = $this->getStockItems( $product->getCode() ); |
|
| 52 | - $this->delete( $product ); |
|
| 51 | + $items = $this->getStockItems($product->getCode()); |
|
| 52 | + $this->delete($product); |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | - $this->assertEquals( 1, count( $items ) ); |
|
| 55 | + $this->assertEquals(1, count($items)); |
|
| 56 | 56 | |
| 57 | - foreach( $items as $item ) |
|
| 57 | + foreach ($items as $item) |
|
| 58 | 58 | { |
| 59 | - $this->assertEquals( 100, $item->getStocklevel() ); |
|
| 60 | - $this->assertEquals( '2000-01-01 00:00:00', $item->getDateBack() ); |
|
| 59 | + $this->assertEquals(100, $item->getStocklevel()); |
|
| 60 | + $this->assertEquals('2000-01-01 00:00:00', $item->getDateBack()); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | 3 => '200', |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $product = $this->create( 'job_csv_test' ); |
|
| 81 | + $product = $this->create('job_csv_test'); |
|
| 82 | 82 | |
| 83 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 84 | - $object->process( $product, $data ); |
|
| 83 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
| 84 | + $object->process($product, $data); |
|
| 85 | 85 | |
| 86 | - $items = $this->getStockItems( $product->getCode() ); |
|
| 87 | - $this->delete( $product ); |
|
| 86 | + $items = $this->getStockItems($product->getCode()); |
|
| 87 | + $this->delete($product); |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - $this->assertEquals( 2, count( $items ) ); |
|
| 90 | + $this->assertEquals(2, count($items)); |
|
| 91 | 91 | |
| 92 | - foreach( $items as $item ) { |
|
| 93 | - $this->assertEquals( 200, $item->getStocklevel() ); |
|
| 92 | + foreach ($items as $item) { |
|
| 93 | + $this->assertEquals(200, $item->getStocklevel()); |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -109,21 +109,21 @@ discard block |
||
| 109 | 109 | 0 => '20', |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - $product = $this->create( 'job_csv_test' ); |
|
| 112 | + $product = $this->create('job_csv_test'); |
|
| 113 | 113 | |
| 114 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 114 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
| 115 | 115 | |
| 116 | - $object->process( $product, $data ); |
|
| 117 | - $object->process( $product, $dataUpdate ); |
|
| 116 | + $object->process($product, $data); |
|
| 117 | + $object->process($product, $dataUpdate); |
|
| 118 | 118 | |
| 119 | - $items = $this->getStockItems( $product->getCode() ); |
|
| 120 | - $this->delete( $product ); |
|
| 119 | + $items = $this->getStockItems($product->getCode()); |
|
| 120 | + $this->delete($product); |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | - $item = reset( $items ); |
|
| 123 | + $item = reset($items); |
|
| 124 | 124 | |
| 125 | - $this->assertEquals( 1, count( $items ) ); |
|
| 126 | - $this->assertEquals( 20, $item->getStocklevel() ); |
|
| 125 | + $this->assertEquals(1, count($items)); |
|
| 126 | + $this->assertEquals(20, $item->getStocklevel()); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -137,19 +137,19 @@ discard block |
||
| 137 | 137 | 0 => 50, |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $product = $this->create( 'job_csv_test' ); |
|
| 140 | + $product = $this->create('job_csv_test'); |
|
| 141 | 141 | |
| 142 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 143 | - $object->process( $product, $data ); |
|
| 142 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
| 143 | + $object->process($product, $data); |
|
| 144 | 144 | |
| 145 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, [], $this->endpoint ); |
|
| 146 | - $object->process( $product, [] ); |
|
| 145 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, [], $this->endpoint); |
|
| 146 | + $object->process($product, []); |
|
| 147 | 147 | |
| 148 | - $items = $this->getStockItems( $product->getCode() ); |
|
| 149 | - $this->delete( $product ); |
|
| 148 | + $items = $this->getStockItems($product->getCode()); |
|
| 149 | + $this->delete($product); |
|
| 150 | 150 | |
| 151 | 151 | |
| 152 | - $this->assertEquals( 0, count( $items ) ); |
|
| 152 | + $this->assertEquals(0, count($items)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | 2 => '', |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - $product = $this->create( 'job_csv_test' ); |
|
| 170 | + $product = $this->create('job_csv_test'); |
|
| 171 | 171 | |
| 172 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 173 | - $object->process( $product, $data ); |
|
| 172 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
| 173 | + $object->process($product, $data); |
|
| 174 | 174 | |
| 175 | - $items = $this->getStockItems( $product->getCode() ); |
|
| 176 | - $this->delete( $product ); |
|
| 175 | + $items = $this->getStockItems($product->getCode()); |
|
| 176 | + $this->delete($product); |
|
| 177 | 177 | |
| 178 | - $this->assertEquals( 1, count( $items ) ); |
|
| 178 | + $this->assertEquals(1, count($items)); |
|
| 179 | 179 | |
| 180 | - foreach( $items as $item ) |
|
| 180 | + foreach ($items as $item) |
|
| 181 | 181 | { |
| 182 | - $this->assertEquals( null, $item->getStocklevel() ); |
|
| 183 | - $this->assertEquals( null, $item->getDateBack() ); |
|
| 182 | + $this->assertEquals(null, $item->getStocklevel()); |
|
| 183 | + $this->assertEquals(null, $item->getDateBack()); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -188,41 +188,41 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * @param string $code |
| 190 | 190 | */ |
| 191 | - protected function create( $code ) |
|
| 191 | + protected function create($code) |
|
| 192 | 192 | { |
| 193 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
| 194 | - $typeManager = $manager->getSubManager( 'type' ); |
|
| 193 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
| 194 | + $typeManager = $manager->getSubManager('type'); |
|
| 195 | 195 | |
| 196 | 196 | $typeSearch = $typeManager->createSearch(); |
| 197 | - $typeSearch->setConditions( $typeSearch->compare( '==', 'product.type.code', 'default' ) ); |
|
| 198 | - $typeResult = $typeManager->searchItems( $typeSearch ); |
|
| 197 | + $typeSearch->setConditions($typeSearch->compare('==', 'product.type.code', 'default')); |
|
| 198 | + $typeResult = $typeManager->searchItems($typeSearch); |
|
| 199 | 199 | |
| 200 | - if( ( $typeItem = reset( $typeResult ) ) === false ) { |
|
| 201 | - throw new \RuntimeException( 'No product type "default" found' ); |
|
| 200 | + if (($typeItem = reset($typeResult)) === false) { |
|
| 201 | + throw new \RuntimeException('No product type "default" found'); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $item = $manager->createItem(); |
| 205 | - $item->setTypeid( $typeItem->getId() ); |
|
| 206 | - $item->setCode( $code ); |
|
| 205 | + $item->setTypeid($typeItem->getId()); |
|
| 206 | + $item->setCode($code); |
|
| 207 | 207 | |
| 208 | - return $manager->saveItem( $item ); |
|
| 208 | + return $manager->saveItem($item); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
| 212 | - protected function delete( \Aimeos\MShop\Product\Item\Iface $product ) |
|
| 212 | + protected function delete(\Aimeos\MShop\Product\Item\Iface $product) |
|
| 213 | 213 | { |
| 214 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
| 215 | - $manager->deleteItem( $product->getId() ); |
|
| 214 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
| 215 | + $manager->deleteItem($product->getId()); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
| 219 | - protected function getStockItems( $code ) |
|
| 219 | + protected function getStockItems($code) |
|
| 220 | 220 | { |
| 221 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'stock' ); |
|
| 221 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'stock'); |
|
| 222 | 222 | |
| 223 | 223 | $search = $manager->createSearch(); |
| 224 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $code ) ); |
|
| 224 | + $search->setConditions($search->compare('==', 'stock.productcode', $code)); |
|
| 225 | 225 | |
| 226 | - return $manager->searchItems( $search ); |
|
| 226 | + return $manager->searchItems($search); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | \ No newline at end of file |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $context = \TestHelperJobs::getContext(); |
| 17 | 17 | $aimeos = \TestHelperJobs::getAimeos(); |
| 18 | 18 | |
| 19 | - $obj = \Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController( $context, $aimeos ); |
|
| 20 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj ); |
|
| 19 | + $obj = \Aimeos\Controller\Jobs\Order\Export\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\Order\Export\Csv\Factory::createController( $context, $aimeos, 'Wrong$$$Name' ); |
|
| 29 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 30 | + \Aimeos\Controller\Jobs\Order\Export\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\Order\Export\Csv\Factory::createController( $context, $aimeos, 'WrongClass' ); |
|
| 39 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 40 | + \Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos, 'WrongClass'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -46,8 +46,8 @@ 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\Order\Export\Csv\Factory::createController( $context, $aimeos, 'Factory' ); |
|
| 49 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 50 | + \Aimeos\Controller\Jobs\Order\Export\Csv\Factory::createController($context, $aimeos, 'Factory'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
| 30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/jobs/order/export/csv/name |
| 35 | 35 | * Class name of the used order suggestions scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2015.01 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if ( $name === null ) { |
|
| 67 | + if ($name === null) { |
|
| 68 | 68 | $name = $context->getConfig()->get('controller/jobs/order/export/csv/name', 'Standard'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if ( ctype_alnum($name) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | 73 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Export\\Csv\\' . $name : '<not a string>'; |
| 74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Export\\Csv\\' . $name; |
| 79 | 79 | |
| 80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/jobs/order/export/csv/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the order export CSV job controller |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | * @see controller/jobs/order/export/csv/decorators/excludes |
| 155 | 155 | * @see controller/jobs/order/export/csv/decorators/global |
| 156 | 156 | */ |
| 157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/export/csv' ); |
|
| 157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/export/csv'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -18,37 +18,37 @@ |
||
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard( $context, $mapping ); |
|
| 21 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard($context, $mapping); |
|
| 22 | 22 | |
| 23 | - $invoice = $this->getInvoice( $context ); |
|
| 24 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
| 23 | + $invoice = $this->getInvoice($context); |
|
| 24 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
| 25 | 25 | |
| 26 | - $data = $object->process( $invoice, $order ); |
|
| 26 | + $data = $object->process($invoice, $order); |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - $this->assertEquals( 2, count( $data ) ); |
|
| 29 | + $this->assertEquals(2, count($data)); |
|
| 30 | 30 | |
| 31 | - $this->assertEquals( 1, count( $data[0] ) ); |
|
| 32 | - $this->assertEquals( '5678', $data[0][0] ); |
|
| 31 | + $this->assertEquals(1, count($data[0])); |
|
| 32 | + $this->assertEquals('5678', $data[0][0]); |
|
| 33 | 33 | |
| 34 | - $this->assertEquals( 1, count( $data[1] ) ); |
|
| 35 | - $this->assertEquals( 'OPQR', $data[1][0] ); |
|
| 34 | + $this->assertEquals(1, count($data[1])); |
|
| 35 | + $this->assertEquals('OPQR', $data[1][0]); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - protected function getInvoice( $context ) |
|
| 39 | + protected function getInvoice($context) |
|
| 40 | 40 | { |
| 41 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 41 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 42 | 42 | |
| 43 | 43 | $search = $manager->createSearch(); |
| 44 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
| 44 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
| 45 | 45 | |
| 46 | - $items = $manager->searchItems( $search ); |
|
| 46 | + $items = $manager->searchItems($search); |
|
| 47 | 47 | |
| 48 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 48 | + if (($item = reset($items)) !== false) { |
|
| 49 | 49 | return $item; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - throw new \Exception( 'No order item found' ); |
|
| 52 | + throw new \Exception('No order item found'); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -38,77 +38,77 @@ |
||
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | |
| 41 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard( $context, $mapping ); |
|
| 42 | - |
|
| 43 | - $invoice = $this->getInvoice( $context ); |
|
| 44 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
| 45 | - |
|
| 46 | - $data = $object->process( $invoice, $order ); |
|
| 47 | - |
|
| 48 | - |
|
| 49 | - $this->assertEquals( 2, count( $data ) ); |
|
| 50 | - |
|
| 51 | - $this->assertEquals( 21, count( $data[0] ) ); |
|
| 52 | - $this->assertEquals( 'payment', $data[0][0] ); |
|
| 53 | - $this->assertEquals( 'mr', $data[0][1] ); |
|
| 54 | - $this->assertEquals( '', $data[0][2] ); |
|
| 55 | - $this->assertEquals( '', $data[0][3] ); |
|
| 56 | - $this->assertEquals( '', $data[0][4] ); |
|
| 57 | - $this->assertEquals( 'Our', $data[0][5] ); |
|
| 58 | - $this->assertEquals( 'Unittest', $data[0][6] ); |
|
| 59 | - $this->assertEquals( 'Durchschnitt', $data[0][7] ); |
|
| 60 | - $this->assertEquals( '1', $data[0][8] ); |
|
| 61 | - $this->assertEquals( '', $data[0][9] ); |
|
| 62 | - $this->assertEquals( '20146', $data[0][10] ); |
|
| 63 | - $this->assertEquals( 'Hamburg', $data[0][11] ); |
|
| 64 | - $this->assertEquals( 'Hamburg', $data[0][12] ); |
|
| 65 | - $this->assertEquals( 'DE', $data[0][13] ); |
|
| 66 | - $this->assertEquals( 'de', $data[0][14] ); |
|
| 67 | - $this->assertEquals( '055544332211', $data[0][15] ); |
|
| 68 | - $this->assertEquals( '055544332213', $data[0][16] ); |
|
| 69 | - $this->assertEquals( '[email protected]', $data[0][17] ); |
|
| 70 | - $this->assertEquals( 'www.metaways.net', $data[0][18] ); |
|
| 71 | - $this->assertEquals( '11.000000', $data[0][19] ); |
|
| 72 | - $this->assertEquals( '52.000000', $data[0][20] ); |
|
| 73 | - |
|
| 74 | - $this->assertEquals( 21, count( $data[1] ) ); |
|
| 75 | - $this->assertEquals( 'delivery', $data[1][0] ); |
|
| 76 | - $this->assertEquals( 'mr', $data[1][1] ); |
|
| 77 | - $this->assertEquals( 'Example company', $data[1][2] ); |
|
| 78 | - $this->assertEquals( 'DE999999999', $data[1][3] ); |
|
| 79 | - $this->assertEquals( 'Dr.', $data[1][4] ); |
|
| 80 | - $this->assertEquals( 'Our', $data[1][5] ); |
|
| 81 | - $this->assertEquals( 'Unittest', $data[1][6] ); |
|
| 82 | - $this->assertEquals( 'Pickhuben', $data[1][7] ); |
|
| 83 | - $this->assertEquals( '2-4', $data[1][8] ); |
|
| 84 | - $this->assertEquals( '', $data[1][9] ); |
|
| 85 | - $this->assertEquals( '20457', $data[1][10] ); |
|
| 86 | - $this->assertEquals( 'Hamburg', $data[1][11] ); |
|
| 87 | - $this->assertEquals( 'Hamburg', $data[1][12] ); |
|
| 88 | - $this->assertEquals( 'DE', $data[1][13] ); |
|
| 89 | - $this->assertEquals( 'de', $data[1][14] ); |
|
| 90 | - $this->assertEquals( '055544332211', $data[1][15] ); |
|
| 91 | - $this->assertEquals( '055544332212', $data[1][16] ); |
|
| 92 | - $this->assertEquals( '[email protected]', $data[1][17] ); |
|
| 93 | - $this->assertEquals( 'www.example.com', $data[1][18] ); |
|
| 94 | - $this->assertEquals( '10.000000', $data[1][19] ); |
|
| 95 | - $this->assertEquals( '50.000000', $data[1][20] ); |
|
| 41 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard($context, $mapping); |
|
| 42 | + |
|
| 43 | + $invoice = $this->getInvoice($context); |
|
| 44 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
| 45 | + |
|
| 46 | + $data = $object->process($invoice, $order); |
|
| 47 | + |
|
| 48 | + |
|
| 49 | + $this->assertEquals(2, count($data)); |
|
| 50 | + |
|
| 51 | + $this->assertEquals(21, count($data[0])); |
|
| 52 | + $this->assertEquals('payment', $data[0][0]); |
|
| 53 | + $this->assertEquals('mr', $data[0][1]); |
|
| 54 | + $this->assertEquals('', $data[0][2]); |
|
| 55 | + $this->assertEquals('', $data[0][3]); |
|
| 56 | + $this->assertEquals('', $data[0][4]); |
|
| 57 | + $this->assertEquals('Our', $data[0][5]); |
|
| 58 | + $this->assertEquals('Unittest', $data[0][6]); |
|
| 59 | + $this->assertEquals('Durchschnitt', $data[0][7]); |
|
| 60 | + $this->assertEquals('1', $data[0][8]); |
|
| 61 | + $this->assertEquals('', $data[0][9]); |
|
| 62 | + $this->assertEquals('20146', $data[0][10]); |
|
| 63 | + $this->assertEquals('Hamburg', $data[0][11]); |
|
| 64 | + $this->assertEquals('Hamburg', $data[0][12]); |
|
| 65 | + $this->assertEquals('DE', $data[0][13]); |
|
| 66 | + $this->assertEquals('de', $data[0][14]); |
|
| 67 | + $this->assertEquals('055544332211', $data[0][15]); |
|
| 68 | + $this->assertEquals('055544332213', $data[0][16]); |
|
| 69 | + $this->assertEquals('[email protected]', $data[0][17]); |
|
| 70 | + $this->assertEquals('www.metaways.net', $data[0][18]); |
|
| 71 | + $this->assertEquals('11.000000', $data[0][19]); |
|
| 72 | + $this->assertEquals('52.000000', $data[0][20]); |
|
| 73 | + |
|
| 74 | + $this->assertEquals(21, count($data[1])); |
|
| 75 | + $this->assertEquals('delivery', $data[1][0]); |
|
| 76 | + $this->assertEquals('mr', $data[1][1]); |
|
| 77 | + $this->assertEquals('Example company', $data[1][2]); |
|
| 78 | + $this->assertEquals('DE999999999', $data[1][3]); |
|
| 79 | + $this->assertEquals('Dr.', $data[1][4]); |
|
| 80 | + $this->assertEquals('Our', $data[1][5]); |
|
| 81 | + $this->assertEquals('Unittest', $data[1][6]); |
|
| 82 | + $this->assertEquals('Pickhuben', $data[1][7]); |
|
| 83 | + $this->assertEquals('2-4', $data[1][8]); |
|
| 84 | + $this->assertEquals('', $data[1][9]); |
|
| 85 | + $this->assertEquals('20457', $data[1][10]); |
|
| 86 | + $this->assertEquals('Hamburg', $data[1][11]); |
|
| 87 | + $this->assertEquals('Hamburg', $data[1][12]); |
|
| 88 | + $this->assertEquals('DE', $data[1][13]); |
|
| 89 | + $this->assertEquals('de', $data[1][14]); |
|
| 90 | + $this->assertEquals('055544332211', $data[1][15]); |
|
| 91 | + $this->assertEquals('055544332212', $data[1][16]); |
|
| 92 | + $this->assertEquals('[email protected]', $data[1][17]); |
|
| 93 | + $this->assertEquals('www.example.com', $data[1][18]); |
|
| 94 | + $this->assertEquals('10.000000', $data[1][19]); |
|
| 95 | + $this->assertEquals('50.000000', $data[1][20]); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - protected function getInvoice( $context ) |
|
| 99 | + protected function getInvoice($context) |
|
| 100 | 100 | { |
| 101 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 101 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 102 | 102 | |
| 103 | 103 | $search = $manager->createSearch(); |
| 104 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
| 104 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
| 105 | 105 | |
| 106 | - $items = $manager->searchItems( $search ); |
|
| 106 | + $items = $manager->searchItems($search); |
|
| 107 | 107 | |
| 108 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 108 | + if (($item = reset($items)) !== false) { |
|
| 109 | 109 | return $item; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - throw new \Exception( 'No order item found' ); |
|
| 112 | + throw new \Exception('No order item found'); |
|
| 113 | 113 | } |
| 114 | 114 | } |
@@ -34,50 +34,50 @@ |
||
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | |
| 37 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard( $context, $mapping ); |
|
| 38 | - |
|
| 39 | - $invoice = $this->getInvoice( $context ); |
|
| 40 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
| 41 | - |
|
| 42 | - $data = $object->process( $invoice, $order ); |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - $this->assertEquals( 1, count( $data ) ); |
|
| 46 | - |
|
| 47 | - $this->assertEquals( 17, count( $data[0] ) ); |
|
| 48 | - $this->assertEquals( 'web', $data[0][0] ); |
|
| 49 | - $this->assertEquals( '2008-02-15 12:34:56', $data[0][1] ); |
|
| 50 | - $this->assertEquals( '6', $data[0][2] ); |
|
| 51 | - $this->assertEquals( '', $data[0][3] ); |
|
| 52 | - $this->assertEquals( '4', $data[0][4] ); |
|
| 53 | - $this->assertEquals( '', $data[0][5] ); |
|
| 54 | - $this->assertGreaterThan( 0, $data[0][6] ); |
|
| 55 | - $this->assertEquals( 'unittest', $data[0][7] ); |
|
| 56 | - $this->assertEquals( 'de', $data[0][8] ); |
|
| 57 | - $this->assertEquals( 'EUR', $data[0][9] ); |
|
| 58 | - $this->assertEquals( '53.50', $data[0][10] ); |
|
| 59 | - $this->assertEquals( '1.50', $data[0][11] ); |
|
| 60 | - $this->assertEquals( '14.50', $data[0][12] ); |
|
| 61 | - $this->assertEquals( '0.0000', $data[0][13] ); |
|
| 62 | - $this->assertEquals( '1', $data[0][14] ); |
|
| 63 | - $this->assertEquals( '0', $data[0][15] ); |
|
| 64 | - $this->assertEquals( 'This is a comment if an order. It can be added by the user.', $data[0][16] ); |
|
| 37 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Invoice\Standard($context, $mapping); |
|
| 38 | + |
|
| 39 | + $invoice = $this->getInvoice($context); |
|
| 40 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
| 41 | + |
|
| 42 | + $data = $object->process($invoice, $order); |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + $this->assertEquals(1, count($data)); |
|
| 46 | + |
|
| 47 | + $this->assertEquals(17, count($data[0])); |
|
| 48 | + $this->assertEquals('web', $data[0][0]); |
|
| 49 | + $this->assertEquals('2008-02-15 12:34:56', $data[0][1]); |
|
| 50 | + $this->assertEquals('6', $data[0][2]); |
|
| 51 | + $this->assertEquals('', $data[0][3]); |
|
| 52 | + $this->assertEquals('4', $data[0][4]); |
|
| 53 | + $this->assertEquals('', $data[0][5]); |
|
| 54 | + $this->assertGreaterThan(0, $data[0][6]); |
|
| 55 | + $this->assertEquals('unittest', $data[0][7]); |
|
| 56 | + $this->assertEquals('de', $data[0][8]); |
|
| 57 | + $this->assertEquals('EUR', $data[0][9]); |
|
| 58 | + $this->assertEquals('53.50', $data[0][10]); |
|
| 59 | + $this->assertEquals('1.50', $data[0][11]); |
|
| 60 | + $this->assertEquals('14.50', $data[0][12]); |
|
| 61 | + $this->assertEquals('0.0000', $data[0][13]); |
|
| 62 | + $this->assertEquals('1', $data[0][14]); |
|
| 63 | + $this->assertEquals('0', $data[0][15]); |
|
| 64 | + $this->assertEquals('This is a comment if an order. It can be added by the user.', $data[0][16]); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - protected function getInvoice( $context ) |
|
| 68 | + protected function getInvoice($context) |
|
| 69 | 69 | { |
| 70 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 70 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 71 | 71 | |
| 72 | 72 | $search = $manager->createSearch(); |
| 73 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
| 73 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
| 74 | 74 | |
| 75 | - $items = $manager->searchItems( $search ); |
|
| 75 | + $items = $manager->searchItems($search); |
|
| 76 | 76 | |
| 77 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 77 | + if (($item = reset($items)) !== false) { |
|
| 78 | 78 | return $item; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - throw new \Exception( 'No order item found' ); |
|
| 81 | + throw new \Exception('No order item found'); |
|
| 82 | 82 | } |
| 83 | 83 | } |
@@ -40,17 +40,17 @@ |
||
| 40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
| 41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
| 43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
| 44 | 44 | { |
| 45 | 45 | $result = []; |
| 46 | 46 | |
| 47 | - foreach( $order->getCoupons() as $code => $products ) |
|
| 47 | + foreach ($order->getCoupons() as $code => $products) |
|
| 48 | 48 | { |
| 49 | 49 | $data = []; |
| 50 | 50 | |
| 51 | - foreach( $this->getMapping() as $pos => $key ) |
|
| 51 | + foreach ($this->getMapping() as $pos => $key) |
|
| 52 | 52 | { |
| 53 | - if( $key === 'order.base.coupon.code' ) { |
|
| 53 | + if ($key === 'order.base.coupon.code') { |
|
| 54 | 54 | $data[$pos] = $code; |
| 55 | 55 | } else { |
| 56 | 56 | $data[$pos] = ''; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 30 | 30 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 31 | 31 | */ |
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping ) |
|
| 32 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping) |
|
| 33 | 33 | { |
| 34 | 34 | $this->context = $context; |
| 35 | 35 | $this->mapping = $mapping; |
@@ -40,28 +40,28 @@ |
||
| 40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
| 41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
| 43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
| 44 | 44 | { |
| 45 | 45 | $result = []; |
| 46 | 46 | $addresses = $order->getAddresses(); |
| 47 | 47 | |
| 48 | - krsort( $addresses ); |
|
| 48 | + krsort($addresses); |
|
| 49 | 49 | |
| 50 | - foreach( $addresses as $item ) |
|
| 50 | + foreach ($addresses as $item) |
|
| 51 | 51 | { |
| 52 | 52 | $data = []; |
| 53 | 53 | $list = $item->toArray(); |
| 54 | 54 | |
| 55 | - foreach( $this->getMapping() as $pos => $key ) |
|
| 55 | + foreach ($this->getMapping() as $pos => $key) |
|
| 56 | 56 | { |
| 57 | - if( array_key_exists( $key, $list ) ) { |
|
| 57 | + if (array_key_exists($key, $list)) { |
|
| 58 | 58 | $data[$pos] = $list[$key]; |
| 59 | 59 | } else { |
| 60 | 60 | $data[$pos] = ''; |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - ksort( $data ); |
|
| 64 | + ksort($data); |
|
| 65 | 65 | $result[] = $data; |
| 66 | 66 | } |
| 67 | 67 | |