@@ -16,45 +16,45 @@ discard block |
||
16 | 16 | |
17 | 17 | public static function setUpBeforeClass() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperCntl::getContext() ); |
|
20 | - $typeManager = $manager->getSubmanager( 'type' ); |
|
19 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperCntl::getContext()); |
|
20 | + $typeManager = $manager->getSubmanager('type'); |
|
21 | 21 | |
22 | 22 | $typeSearch = $typeManager->createSearch(); |
23 | - $typeSearch->setConditions( $typeSearch->compare( '==', 'product.type.code', 'default' ) ); |
|
24 | - $result = $typeManager->searchItems( $typeSearch ); |
|
23 | + $typeSearch->setConditions($typeSearch->compare('==', 'product.type.code', 'default')); |
|
24 | + $result = $typeManager->searchItems($typeSearch); |
|
25 | 25 | |
26 | - if( ( $typeItem = reset( $result ) ) === false ) { |
|
27 | - throw new \RuntimeException( 'Product type "default" not found' ); |
|
26 | + if (($typeItem = reset($result)) === false) { |
|
27 | + throw new \RuntimeException('Product type "default" not found'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $item = $manager->createItem(); |
31 | - $item->setCode( 'job_csv_prod' ); |
|
32 | - $item->setTypeId( $typeItem->getId() ); |
|
33 | - $item->setStatus( 1 ); |
|
31 | + $item->setCode('job_csv_prod'); |
|
32 | + $item->setTypeId($typeItem->getId()); |
|
33 | + $item->setStatus(1); |
|
34 | 34 | |
35 | - self::$product = $manager->saveItem( $item ); |
|
35 | + self::$product = $manager->saveItem($item); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public static function tearDownAfterClass() |
40 | 40 | { |
41 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperCntl::getContext() ); |
|
42 | - $manager->deleteItem( self::$product->getId() ); |
|
41 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperCntl::getContext()); |
|
42 | + $manager->deleteItem(self::$product->getId()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | protected function setUp() |
47 | 47 | { |
48 | - \Aimeos\MShop\Factory::setCache( true ); |
|
48 | + \Aimeos\MShop\Factory::setCache(true); |
|
49 | 49 | |
50 | 50 | $this->context = \TestHelperCntl::getContext(); |
51 | - $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
51 | + $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | protected function tearDown() |
56 | 56 | { |
57 | - \Aimeos\MShop\Factory::setCache( false ); |
|
57 | + \Aimeos\MShop\Factory::setCache(false); |
|
58 | 58 | \Aimeos\MShop\Factory::clear(); |
59 | 59 | } |
60 | 60 | |
@@ -75,30 +75,30 @@ discard block |
||
75 | 75 | 3 => 'job_csv_test', |
76 | 76 | ); |
77 | 77 | |
78 | - $this->create( 'job_csv_test' ); |
|
78 | + $this->create('job_csv_test'); |
|
79 | 79 | |
80 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
81 | - $object->process( self::$product, $data ); |
|
80 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
81 | + $object->process(self::$product, $data); |
|
82 | 82 | |
83 | - $category = $this->get( 'job_csv_test' ); |
|
84 | - $this->delete( $category ); |
|
83 | + $category = $this->get('job_csv_test'); |
|
84 | + $this->delete($category); |
|
85 | 85 | |
86 | 86 | |
87 | 87 | $pos = 0; |
88 | 88 | $listItems = $category->getListItems(); |
89 | 89 | $expected = array( |
90 | - array( 'default', 'job_csv_prod' ), |
|
91 | - array( 'promotion', 'job_csv_prod' ), |
|
90 | + array('default', 'job_csv_prod'), |
|
91 | + array('promotion', 'job_csv_prod'), |
|
92 | 92 | ); |
93 | 93 | |
94 | - $this->assertEquals( 2, count( $listItems ) ); |
|
94 | + $this->assertEquals(2, count($listItems)); |
|
95 | 95 | |
96 | - foreach( $listItems as $listItem ) |
|
96 | + foreach ($listItems as $listItem) |
|
97 | 97 | { |
98 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
99 | - $this->assertEquals( 'product', $listItem->getDomain() ); |
|
100 | - $this->assertEquals( $expected[$pos][0], $listItem->getType() ); |
|
101 | - $this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getCode() ); |
|
98 | + $this->assertEquals(1, $listItem->getStatus()); |
|
99 | + $this->assertEquals('product', $listItem->getDomain()); |
|
100 | + $this->assertEquals($expected[$pos][0], $listItem->getType()); |
|
101 | + $this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getCode()); |
|
102 | 102 | $pos++; |
103 | 103 | } |
104 | 104 | } |
@@ -120,32 +120,32 @@ discard block |
||
120 | 120 | 3 => "job_csv_test\njob_csv_test2", |
121 | 121 | ); |
122 | 122 | |
123 | - $this->create( 'job_csv_test' ); |
|
124 | - $this->create( 'job_csv_test2' ); |
|
123 | + $this->create('job_csv_test'); |
|
124 | + $this->create('job_csv_test2'); |
|
125 | 125 | |
126 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
127 | - $object->process( self::$product, $data ); |
|
126 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
127 | + $object->process(self::$product, $data); |
|
128 | 128 | |
129 | - $category = $this->get( 'job_csv_test' ); |
|
130 | - $category2 = $this->get( 'job_csv_test2' ); |
|
129 | + $category = $this->get('job_csv_test'); |
|
130 | + $category2 = $this->get('job_csv_test2'); |
|
131 | 131 | |
132 | - $this->delete( $category ); |
|
133 | - $this->delete( $category2 ); |
|
132 | + $this->delete($category); |
|
133 | + $this->delete($category2); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | $pos = 0; |
137 | - $types = array( 'default', 'promotion', 'default', 'promotion' ); |
|
137 | + $types = array('default', 'promotion', 'default', 'promotion'); |
|
138 | 138 | |
139 | - foreach( array( $category->getListItems(), $category2->getListItems() ) as $listItems ) |
|
139 | + foreach (array($category->getListItems(), $category2->getListItems()) as $listItems) |
|
140 | 140 | { |
141 | - $this->assertEquals( 2, count( $listItems ) ); |
|
141 | + $this->assertEquals(2, count($listItems)); |
|
142 | 142 | |
143 | - foreach( $listItems as $listItem ) |
|
143 | + foreach ($listItems as $listItem) |
|
144 | 144 | { |
145 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
146 | - $this->assertEquals( 'product', $listItem->getDomain() ); |
|
147 | - $this->assertEquals( $types[$pos], $listItem->getType() ); |
|
148 | - $this->assertEquals( 'job_csv_prod', $listItem->getRefItem()->getCode() ); |
|
145 | + $this->assertEquals(1, $listItem->getStatus()); |
|
146 | + $this->assertEquals('product', $listItem->getDomain()); |
|
147 | + $this->assertEquals($types[$pos], $listItem->getType()); |
|
148 | + $this->assertEquals('job_csv_prod', $listItem->getRefItem()->getCode()); |
|
149 | 149 | $pos++; |
150 | 150 | } |
151 | 151 | } |
@@ -169,23 +169,23 @@ discard block |
||
169 | 169 | 1 => 'job_csv_test', |
170 | 170 | ); |
171 | 171 | |
172 | - $this->create( 'job_csv_test' ); |
|
172 | + $this->create('job_csv_test'); |
|
173 | 173 | |
174 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
175 | - $object->process( self::$product, $data ); |
|
176 | - $object->process( self::$product, $dataUpdate ); |
|
174 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
175 | + $object->process(self::$product, $data); |
|
176 | + $object->process(self::$product, $dataUpdate); |
|
177 | 177 | |
178 | - $category = $this->get( 'job_csv_test' ); |
|
179 | - $this->delete( $category ); |
|
178 | + $category = $this->get('job_csv_test'); |
|
179 | + $this->delete($category); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | $listItems = $category->getListItems(); |
183 | - $listItem = reset( $listItems ); |
|
183 | + $listItem = reset($listItems); |
|
184 | 184 | |
185 | - $this->assertEquals( 1, count( $listItems ) ); |
|
186 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
185 | + $this->assertEquals(1, count($listItems)); |
|
186 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
187 | 187 | |
188 | - $this->assertEquals( 'job_csv_prod', $listItem->getRefItem()->getCode() ); |
|
188 | + $this->assertEquals('job_csv_prod', $listItem->getRefItem()->getCode()); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -201,21 +201,21 @@ discard block |
||
201 | 201 | 1 => 'job_csv_test', |
202 | 202 | ); |
203 | 203 | |
204 | - $this->create( 'job_csv_test' ); |
|
204 | + $this->create('job_csv_test'); |
|
205 | 205 | |
206 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
207 | - $object->process( self::$product, $data ); |
|
206 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
207 | + $object->process(self::$product, $data); |
|
208 | 208 | |
209 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, [], $this->endpoint ); |
|
210 | - $object->process( self::$product, [] ); |
|
209 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, [], $this->endpoint); |
|
210 | + $object->process(self::$product, []); |
|
211 | 211 | |
212 | - $category = $this->get( 'job_csv_test' ); |
|
213 | - $this->delete( $category ); |
|
212 | + $category = $this->get('job_csv_test'); |
|
213 | + $this->delete($category); |
|
214 | 214 | |
215 | 215 | |
216 | 216 | $listItems = $category->getListItems(); |
217 | 217 | |
218 | - $this->assertEquals( 0, count( $listItems ) ); |
|
218 | + $this->assertEquals(0, count($listItems)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | 3 => 'job_csv_test', |
236 | 236 | ); |
237 | 237 | |
238 | - $this->create( 'job_csv_test' ); |
|
238 | + $this->create('job_csv_test'); |
|
239 | 239 | |
240 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
241 | - $object->process( self::$product, $data ); |
|
240 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
241 | + $object->process(self::$product, $data); |
|
242 | 242 | |
243 | - $category = $this->get( 'job_csv_test' ); |
|
244 | - $this->delete( $category ); |
|
243 | + $category = $this->get('job_csv_test'); |
|
244 | + $this->delete($category); |
|
245 | 245 | |
246 | 246 | |
247 | 247 | $listItems = $category->getListItems(); |
248 | 248 | |
249 | - $this->assertEquals( 1, count( $listItems ) ); |
|
249 | + $this->assertEquals(1, count($listItems)); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -266,71 +266,71 @@ discard block |
||
266 | 266 | 3 => 'job_csv_test', |
267 | 267 | ); |
268 | 268 | |
269 | - $this->context->getConfig()->set( 'controller/common/product/import/csv/processor/catalog/listtypes', array( 'default' ) ); |
|
269 | + $this->context->getConfig()->set('controller/common/product/import/csv/processor/catalog/listtypes', array('default')); |
|
270 | 270 | |
271 | - $this->create( 'job_csv_test' ); |
|
271 | + $this->create('job_csv_test'); |
|
272 | 272 | |
273 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint ); |
|
274 | - $object->process( self::$product, $data ); |
|
273 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint); |
|
274 | + $object->process(self::$product, $data); |
|
275 | 275 | |
276 | - $category = $this->get( 'job_csv_test' ); |
|
277 | - $this->delete( $category ); |
|
276 | + $category = $this->get('job_csv_test'); |
|
277 | + $this->delete($category); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | $listItems = $category->getListItems(); |
281 | - $listItem = reset( $listItems ); |
|
281 | + $listItem = reset($listItems); |
|
282 | 282 | |
283 | - $this->assertEquals( 1, count( $listItems ) ); |
|
284 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
283 | + $this->assertEquals(1, count($listItems)); |
|
284 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
285 | 285 | |
286 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
287 | - $this->assertEquals( 'job_csv_prod', $listItem->getRefItem()->getCode() ); |
|
286 | + $this->assertEquals('default', $listItem->getType()); |
|
287 | + $this->assertEquals('job_csv_prod', $listItem->getRefItem()->getCode()); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | 291 | /** |
292 | 292 | * @param string $code |
293 | 293 | */ |
294 | - protected function create( $code ) |
|
294 | + protected function create($code) |
|
295 | 295 | { |
296 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
296 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
297 | 297 | |
298 | 298 | $item = $manager->createItem(); |
299 | - $item->setCode( $code ); |
|
299 | + $item->setCode($code); |
|
300 | 300 | |
301 | - $manager->insertItem( $item ); |
|
301 | + $manager->insertItem($item); |
|
302 | 302 | |
303 | 303 | return $item; |
304 | 304 | } |
305 | 305 | |
306 | 306 | |
307 | - protected function delete( \Aimeos\MShop\Catalog\Item\Iface $catItem ) |
|
307 | + protected function delete(\Aimeos\MShop\Catalog\Item\Iface $catItem) |
|
308 | 308 | { |
309 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
310 | - $listManager = $manager->getSubManager( 'lists' ); |
|
309 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
310 | + $listManager = $manager->getSubManager('lists'); |
|
311 | 311 | |
312 | - foreach( $catItem->getListItems('product') as $listItem ) { |
|
313 | - $listManager->deleteItem( $listItem->getId() ); |
|
312 | + foreach ($catItem->getListItems('product') as $listItem) { |
|
313 | + $listManager->deleteItem($listItem->getId()); |
|
314 | 314 | } |
315 | 315 | |
316 | - $manager->deleteItem( $catItem->getId() ); |
|
316 | + $manager->deleteItem($catItem->getId()); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
320 | 320 | /** |
321 | 321 | * @param string $code |
322 | 322 | */ |
323 | - protected function get( $code ) |
|
323 | + protected function get($code) |
|
324 | 324 | { |
325 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
325 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
326 | 326 | |
327 | 327 | $search = $manager->createSearch(); |
328 | - $search->setConditions( $search->compare( '==', 'catalog.code', $code ) ); |
|
328 | + $search->setConditions($search->compare('==', 'catalog.code', $code)); |
|
329 | 329 | |
330 | - $result = $manager->searchItems( $search, array('product') ); |
|
330 | + $result = $manager->searchItems($search, array('product')); |
|
331 | 331 | |
332 | - if( ( $item = reset( $result ) ) === false ) { |
|
333 | - throw new \RuntimeException( sprintf( 'No catalog item for code "%1$s"', $code ) ); |
|
332 | + if (($item = reset($result)) === false) { |
|
333 | + throw new \RuntimeException(sprintf('No catalog item for code "%1$s"', $code)); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return $item; |
@@ -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; |