@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop::cache( true ); |
|
20 | + \Aimeos\MShop::cache(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::cache( false ); |
|
29 | + \Aimeos\MShop::cache(false); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -42,21 +42,21 @@ discard block |
||
42 | 42 | 1 => '2000-01-01 00:00:00', |
43 | 43 | ); |
44 | 44 | |
45 | - $product = $this->create( 'job_csv_test' ); |
|
45 | + $product = $this->create('job_csv_test'); |
|
46 | 46 | |
47 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
48 | - $object->process( $product, $data ); |
|
47 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
48 | + $object->process($product, $data); |
|
49 | 49 | |
50 | - $items = $this->getStockItems( $product->getCode() ); |
|
51 | - $this->delete( $product ); |
|
50 | + $items = $this->getStockItems($product->getCode()); |
|
51 | + $this->delete($product); |
|
52 | 52 | |
53 | 53 | |
54 | - $this->assertEquals( 1, count( $items ) ); |
|
54 | + $this->assertEquals(1, count($items)); |
|
55 | 55 | |
56 | - foreach( $items as $item ) |
|
56 | + foreach ($items as $item) |
|
57 | 57 | { |
58 | - $this->assertEquals( 100, $item->getStocklevel() ); |
|
59 | - $this->assertEquals( '2000-01-01 00:00:00', $item->getDateBack() ); |
|
58 | + $this->assertEquals(100, $item->getStocklevel()); |
|
59 | + $this->assertEquals('2000-01-01 00:00:00', $item->getDateBack()); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | 3 => '200', |
78 | 78 | ); |
79 | 79 | |
80 | - $product = $this->create( 'job_csv_test' ); |
|
80 | + $product = $this->create('job_csv_test'); |
|
81 | 81 | |
82 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
83 | - $object->process( $product, $data ); |
|
82 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
83 | + $object->process($product, $data); |
|
84 | 84 | |
85 | - $items = $this->getStockItems( $product->getCode() ); |
|
86 | - $this->delete( $product ); |
|
85 | + $items = $this->getStockItems($product->getCode()); |
|
86 | + $this->delete($product); |
|
87 | 87 | |
88 | 88 | |
89 | - $this->assertEquals( 2, count( $items ) ); |
|
89 | + $this->assertEquals(2, count($items)); |
|
90 | 90 | |
91 | - foreach( $items as $item ) { |
|
92 | - $this->assertEquals( 200, $item->getStocklevel() ); |
|
91 | + foreach ($items as $item) { |
|
92 | + $this->assertEquals(200, $item->getStocklevel()); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -108,21 +108,21 @@ discard block |
||
108 | 108 | 0 => '20', |
109 | 109 | ); |
110 | 110 | |
111 | - $product = $this->create( 'job_csv_test' ); |
|
111 | + $product = $this->create('job_csv_test'); |
|
112 | 112 | |
113 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
113 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
114 | 114 | |
115 | - $object->process( $product, $data ); |
|
116 | - $object->process( $product, $dataUpdate ); |
|
115 | + $object->process($product, $data); |
|
116 | + $object->process($product, $dataUpdate); |
|
117 | 117 | |
118 | - $items = $this->getStockItems( $product->getCode() ); |
|
119 | - $this->delete( $product ); |
|
118 | + $items = $this->getStockItems($product->getCode()); |
|
119 | + $this->delete($product); |
|
120 | 120 | |
121 | 121 | |
122 | - $item = reset( $items ); |
|
122 | + $item = reset($items); |
|
123 | 123 | |
124 | - $this->assertEquals( 1, count( $items ) ); |
|
125 | - $this->assertEquals( 20, $item->getStocklevel() ); |
|
124 | + $this->assertEquals(1, count($items)); |
|
125 | + $this->assertEquals(20, $item->getStocklevel()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | 0 => 50, |
137 | 137 | ); |
138 | 138 | |
139 | - $product = $this->create( 'job_csv_test' ); |
|
139 | + $product = $this->create('job_csv_test'); |
|
140 | 140 | |
141 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
142 | - $object->process( $product, $data ); |
|
141 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
142 | + $object->process($product, $data); |
|
143 | 143 | |
144 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, [], $this->endpoint ); |
|
145 | - $object->process( $product, [] ); |
|
144 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, [], $this->endpoint); |
|
145 | + $object->process($product, []); |
|
146 | 146 | |
147 | - $items = $this->getStockItems( $product->getCode() ); |
|
148 | - $this->delete( $product ); |
|
147 | + $items = $this->getStockItems($product->getCode()); |
|
148 | + $this->delete($product); |
|
149 | 149 | |
150 | 150 | |
151 | - $this->assertEquals( 0, count( $items ) ); |
|
151 | + $this->assertEquals(0, count($items)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | 2 => '', |
167 | 167 | ); |
168 | 168 | |
169 | - $product = $this->create( 'job_csv_test' ); |
|
169 | + $product = $this->create('job_csv_test'); |
|
170 | 170 | |
171 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint ); |
|
172 | - $object->process( $product, $data ); |
|
171 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint); |
|
172 | + $object->process($product, $data); |
|
173 | 173 | |
174 | - $items = $this->getStockItems( $product->getCode() ); |
|
175 | - $this->delete( $product ); |
|
174 | + $items = $this->getStockItems($product->getCode()); |
|
175 | + $this->delete($product); |
|
176 | 176 | |
177 | - $this->assertEquals( 1, count( $items ) ); |
|
177 | + $this->assertEquals(1, count($items)); |
|
178 | 178 | |
179 | - foreach( $items as $item ) |
|
179 | + foreach ($items as $item) |
|
180 | 180 | { |
181 | - $this->assertEquals( null, $item->getStocklevel() ); |
|
182 | - $this->assertEquals( null, $item->getDateBack() ); |
|
181 | + $this->assertEquals(null, $item->getStocklevel()); |
|
182 | + $this->assertEquals(null, $item->getDateBack()); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -187,37 +187,37 @@ discard block |
||
187 | 187 | /** |
188 | 188 | * @param string $code |
189 | 189 | */ |
190 | - protected function create( $code ) |
|
190 | + protected function create($code) |
|
191 | 191 | { |
192 | - $manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context ); |
|
192 | + $manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context); |
|
193 | 193 | |
194 | 194 | $item = $manager->createItem(); |
195 | - $item->setType( 'default' ); |
|
196 | - $item->setCode( $code ); |
|
195 | + $item->setType('default'); |
|
196 | + $item->setCode($code); |
|
197 | 197 | |
198 | - return $manager->saveItem( $item ); |
|
198 | + return $manager->saveItem($item); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - protected function delete( \Aimeos\MShop\Product\Item\Iface $product ) |
|
202 | + protected function delete(\Aimeos\MShop\Product\Item\Iface $product) |
|
203 | 203 | { |
204 | - $manager = \Aimeos\MShop\Stock\Manager\Factory::create( $this->context ); |
|
204 | + $manager = \Aimeos\MShop\Stock\Manager\Factory::create($this->context); |
|
205 | 205 | $search = $manager->createSearch(); |
206 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $product->getCode() ) ); |
|
207 | - $manager->deleteItems( array_keys( $manager->searchItems( $search ) ) ); |
|
206 | + $search->setConditions($search->compare('==', 'stock.productcode', $product->getCode())); |
|
207 | + $manager->deleteItems(array_keys($manager->searchItems($search))); |
|
208 | 208 | |
209 | - $manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context ); |
|
210 | - $manager->deleteItem( $product->getId() ); |
|
209 | + $manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context); |
|
210 | + $manager->deleteItem($product->getId()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
214 | - protected function getStockItems( $code ) |
|
214 | + protected function getStockItems($code) |
|
215 | 215 | { |
216 | - $manager = \Aimeos\MShop::create( $this->context, 'stock' ); |
|
216 | + $manager = \Aimeos\MShop::create($this->context, 'stock'); |
|
217 | 217 | |
218 | 218 | $search = $manager->createSearch(); |
219 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $code ) ); |
|
219 | + $search->setConditions($search->compare('==', 'stock.productcode', $code)); |
|
220 | 220 | |
221 | - return $manager->searchItems( $search ); |
|
221 | + return $manager->searchItems($search); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | \ No newline at end of file |