@@ -133,7 +133,7 @@ |
||
133 | 133 | * |
134 | 134 | * @param array $list Associative list of key/value pairs |
135 | 135 | * @param string $key Key for the value to retrieve |
136 | - * @param mixed $default Default value if key isn't found |
|
136 | + * @param string $default Default value if key isn't found |
|
137 | 137 | * @param mixed Value for the key in the list of the default value |
138 | 138 | */ |
139 | 139 | protected function getValue( array $list, $key, $default ) |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
33 | 33 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->mapping = $mapping; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @param integer $pos Computed position of the list item in the associated list of items |
49 | 49 | * @return array Given associative list enriched by default values if they were not already set |
50 | 50 | */ |
51 | - protected function addListItemDefaults( array $list, $pos ) |
|
51 | + protected function addListItemDefaults(array $list, $pos) |
|
52 | 52 | { |
53 | - if( !isset( $list['catalog.lists.position'] ) ) { |
|
53 | + if (!isset($list['catalog.lists.position'])) { |
|
54 | 54 | $list['catalog.lists.position'] = $pos; |
55 | 55 | } |
56 | 56 | |
57 | - if( !isset( $list['catalog.lists.status'] ) ) { |
|
57 | + if (!isset($list['catalog.lists.status'])) { |
|
58 | 58 | $list['catalog.lists.status'] = 1; |
59 | 59 | } |
60 | 60 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getObject() |
94 | 94 | { |
95 | - if( $this->object === null ) { |
|
96 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
95 | + if ($this->object === null) { |
|
96 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->object; |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @param mixed $default Default value if key isn't found |
109 | 109 | * @param mixed Value for the key in the list of the default value |
110 | 110 | */ |
111 | - protected function getValue( array $list, $key, $default ) |
|
111 | + protected function getValue(array $list, $key, $default) |
|
112 | 112 | { |
113 | - return ( isset( $list[$key] ) ? $list[$key] : $default ); |
|
113 | + return (isset($list[$key]) ? $list[$key] : $default); |
|
114 | 114 | } |
115 | 115 | } |
@@ -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\Factory::setCache( true ); |
|
21 | + \Aimeos\MShop\Factory::setCache(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\Factory::setCache( false ); |
|
36 | + \Aimeos\MShop\Factory::setCache(false); |
|
37 | 37 | \Aimeos\MShop\Factory::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 |
@@ -16,77 +16,77 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - \Aimeos\MShop\Factory::setCache( true ); |
|
19 | + \Aimeos\MShop\Factory::setCache(true); |
|
20 | 20 | |
21 | 21 | $context = \TestHelperCntl::getContext(); |
22 | 22 | $aimeos = \TestHelperCntl::getAimeos(); |
23 | 23 | |
24 | - $this->object = new TestAbstract( $context, $aimeos ); |
|
24 | + $this->object = new TestAbstract($context, $aimeos); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() |
29 | 29 | { |
30 | - \Aimeos\MShop\Factory::setCache( false ); |
|
30 | + \Aimeos\MShop\Factory::setCache(false); |
|
31 | 31 | \Aimeos\MShop\Factory::clear(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | public function testGetCacheInvalidType() |
36 | 36 | { |
37 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
38 | - $this->object->getCachePublic( '$' ); |
|
37 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
38 | + $this->object->getCachePublic('$'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testGetCacheInvalidClass() |
43 | 43 | { |
44 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
45 | - $this->object->getCachePublic( 'unknown' ); |
|
44 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
45 | + $this->object->getCachePublic('unknown'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testGetProcessors() |
50 | 50 | { |
51 | - $processor = $this->object->getProcessorsPublic( array( 'media' => [] ) ); |
|
51 | + $processor = $this->object->getProcessorsPublic(array('media' => [])); |
|
52 | 52 | |
53 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor ); |
|
53 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testGetProcessorsInvalidType() |
58 | 58 | { |
59 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
60 | - $this->object->getProcessorsPublic( array( '$' => [] ) ); |
|
59 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
60 | + $this->object->getProcessorsPublic(array('$' => [])); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testGetProcessorsInvalidClass() |
65 | 65 | { |
66 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
67 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
66 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
67 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | 71 | public function testGetProcessorsInvalidInterface() |
72 | 72 | { |
73 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
74 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
73 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
74 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testGetTypeId() |
79 | 79 | { |
80 | - $typeid = $this->object->getTypeIdPublic( 'text/type', 'catalog', 'name' ); |
|
80 | + $typeid = $this->object->getTypeIdPublic('text/type', 'catalog', 'name'); |
|
81 | 81 | |
82 | - $this->assertNotEquals( null, $typeid ); |
|
82 | + $this->assertNotEquals(null, $typeid); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
86 | 86 | public function testGetTypeIdUnknown() |
87 | 87 | { |
88 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
89 | - $this->object->getTypeIdPublic( 'text/type', 'catalog', 'unknown' ); |
|
88 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
89 | + $this->object->getTypeIdPublic('text/type', 'catalog', 'unknown'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | class TestAbstract |
95 | 95 | extends \Aimeos\Controller\Common\Catalog\Import\Csv\Base |
96 | 96 | { |
97 | - public function getCachePublic( $type, $name = null ) |
|
97 | + public function getCachePublic($type, $name = null) |
|
98 | 98 | { |
99 | - return $this->getCache( $type, $name ); |
|
99 | + return $this->getCache($type, $name); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | - public function getProcessorsPublic( array $mappings ) |
|
103 | + public function getProcessorsPublic(array $mappings) |
|
104 | 104 | { |
105 | - return $this->getProcessors( $mappings ); |
|
105 | + return $this->getProcessors($mappings); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - public function getTypeIdPublic( $path, $domain, $code ) |
|
109 | + public function getTypeIdPublic($path, $domain, $code) |
|
110 | 110 | { |
111 | - return $this->getTypeId( $path, $domain, $code ); |
|
111 | + return $this->getTypeId($path, $domain, $code); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 |
@@ -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\Catalog\Import\Csv\Processor\Done( $this->context, [] ); |
|
23 | + $this->endpoint = new \Aimeos\Controller\Common\Catalog\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 | |
@@ -51,36 +51,36 @@ discard block |
||
51 | 51 | 5 => 1, |
52 | 52 | ); |
53 | 53 | |
54 | - $catalog = $this->create( 'job_csv_test' ); |
|
54 | + $catalog = $this->create('job_csv_test'); |
|
55 | 55 | |
56 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
57 | - $object->process( $catalog, $data ); |
|
56 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
57 | + $object->process($catalog, $data); |
|
58 | 58 | |
59 | - $catalog = $this->get( 'job_csv_test' ); |
|
60 | - $this->delete( $catalog ); |
|
59 | + $catalog = $this->get('job_csv_test'); |
|
60 | + $this->delete($catalog); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | $listItems = $catalog->getListItems(); |
64 | - $listItem = reset( $listItems ); |
|
64 | + $listItem = reset($listItems); |
|
65 | 65 | |
66 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
67 | - $this->assertEquals( 1, count( $listItems ) ); |
|
66 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
67 | + $this->assertEquals(1, count($listItems)); |
|
68 | 68 | |
69 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
70 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
71 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
72 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
69 | + $this->assertEquals(1, $listItem->getStatus()); |
|
70 | + $this->assertEquals(0, $listItem->getPosition()); |
|
71 | + $this->assertEquals('media', $listItem->getDomain()); |
|
72 | + $this->assertEquals('default', $listItem->getType()); |
|
73 | 73 | |
74 | 74 | $refItem = $listItem->getRefItem(); |
75 | 75 | |
76 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
77 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
78 | - $this->assertEquals( 'catalog', $refItem->getDomain() ); |
|
79 | - $this->assertEquals( 'test image', $refItem->getLabel() ); |
|
80 | - $this->assertEquals( 'image/jpeg', $refItem->getMimetype() ); |
|
81 | - $this->assertEquals( 'path/to/preview', $refItem->getPreview() ); |
|
82 | - $this->assertEquals( 'path/to/file', $refItem->getUrl() ); |
|
83 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
76 | + $this->assertEquals(1, $refItem->getStatus()); |
|
77 | + $this->assertEquals('default', $refItem->getType()); |
|
78 | + $this->assertEquals('catalog', $refItem->getDomain()); |
|
79 | + $this->assertEquals('test image', $refItem->getLabel()); |
|
80 | + $this->assertEquals('image/jpeg', $refItem->getMimetype()); |
|
81 | + $this->assertEquals('path/to/preview', $refItem->getPreview()); |
|
82 | + $this->assertEquals('path/to/file', $refItem->getUrl()); |
|
83 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | 0 => "path/to/0\npath/to/1\npath/to/2\npath/to/3", |
95 | 95 | ); |
96 | 96 | |
97 | - $catalog = $this->create( 'job_csv_test' ); |
|
97 | + $catalog = $this->create('job_csv_test'); |
|
98 | 98 | |
99 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
100 | - $object->process( $catalog, $data ); |
|
99 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
100 | + $object->process($catalog, $data); |
|
101 | 101 | |
102 | - $catalog = $this->get( 'job_csv_test' ); |
|
103 | - $this->delete( $catalog ); |
|
102 | + $catalog = $this->get('job_csv_test'); |
|
103 | + $this->delete($catalog); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | $pos = 0; |
107 | 107 | $listItems = $catalog->getListItems(); |
108 | - $expected = array( 'path/to/0', 'path/to/1', 'path/to/2', 'path/to/3' ); |
|
108 | + $expected = array('path/to/0', 'path/to/1', 'path/to/2', 'path/to/3'); |
|
109 | 109 | |
110 | - $this->assertEquals( 4, count( $listItems ) ); |
|
110 | + $this->assertEquals(4, count($listItems)); |
|
111 | 111 | |
112 | - foreach( $listItems as $listItem ) |
|
112 | + foreach ($listItems as $listItem) |
|
113 | 113 | { |
114 | - $this->assertEquals( $expected[$pos], $listItem->getRefItem()->getUrl() ); |
|
114 | + $this->assertEquals($expected[$pos], $listItem->getRefItem()->getUrl()); |
|
115 | 115 | $pos++; |
116 | 116 | } |
117 | 117 | } |
@@ -133,23 +133,23 @@ discard block |
||
133 | 133 | 3 => 'path/to/3', |
134 | 134 | ); |
135 | 135 | |
136 | - $catalog = $this->create( 'job_csv_test' ); |
|
136 | + $catalog = $this->create('job_csv_test'); |
|
137 | 137 | |
138 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
139 | - $object->process( $catalog, $data ); |
|
138 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
139 | + $object->process($catalog, $data); |
|
140 | 140 | |
141 | - $catalog = $this->get( 'job_csv_test' ); |
|
142 | - $this->delete( $catalog ); |
|
141 | + $catalog = $this->get('job_csv_test'); |
|
142 | + $this->delete($catalog); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | $pos = 0; |
146 | 146 | $listItems = $catalog->getListItems(); |
147 | 147 | |
148 | - $this->assertEquals( 4, count( $listItems ) ); |
|
148 | + $this->assertEquals(4, count($listItems)); |
|
149 | 149 | |
150 | - foreach( $listItems as $listItem ) |
|
150 | + foreach ($listItems as $listItem) |
|
151 | 151 | { |
152 | - $this->assertEquals( $data[$pos], $listItem->getRefItem()->getUrl() ); |
|
152 | + $this->assertEquals($data[$pos], $listItem->getRefItem()->getUrl()); |
|
153 | 153 | $pos++; |
154 | 154 | } |
155 | 155 | } |
@@ -172,27 +172,27 @@ discard block |
||
172 | 172 | 1 => '', |
173 | 173 | ); |
174 | 174 | |
175 | - $catalog = $this->create( 'job_csv_test' ); |
|
175 | + $catalog = $this->create('job_csv_test'); |
|
176 | 176 | |
177 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
178 | - $object->process( $catalog, $data ); |
|
177 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
178 | + $object->process($catalog, $data); |
|
179 | 179 | |
180 | - $catalog = $this->get( 'job_csv_test' ); |
|
180 | + $catalog = $this->get('job_csv_test'); |
|
181 | 181 | |
182 | - $object->process( $catalog, $dataUpdate ); |
|
182 | + $object->process($catalog, $dataUpdate); |
|
183 | 183 | |
184 | - $catalog = $this->get( 'job_csv_test' ); |
|
185 | - $this->delete( $catalog ); |
|
184 | + $catalog = $this->get('job_csv_test'); |
|
185 | + $this->delete($catalog); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | $listItems = $catalog->getListItems(); |
189 | - $listItem = reset( $listItems ); |
|
189 | + $listItem = reset($listItems); |
|
190 | 190 | |
191 | - $this->assertEquals( 1, count( $listItems ) ); |
|
192 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
191 | + $this->assertEquals(1, count($listItems)); |
|
192 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
193 | 193 | |
194 | - $this->assertEquals( 'path/to/new', $listItem->getRefItem()->getUrl() ); |
|
195 | - $this->assertEquals( null, $listItem->getRefItem()->getLanguageId() ); |
|
194 | + $this->assertEquals('path/to/new', $listItem->getRefItem()->getUrl()); |
|
195 | + $this->assertEquals(null, $listItem->getRefItem()->getLanguageId()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -206,23 +206,23 @@ discard block |
||
206 | 206 | 0 => '/path/to/file', |
207 | 207 | ); |
208 | 208 | |
209 | - $catalog = $this->create( 'job_csv_test' ); |
|
209 | + $catalog = $this->create('job_csv_test'); |
|
210 | 210 | |
211 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
212 | - $object->process( $catalog, $data ); |
|
211 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
212 | + $object->process($catalog, $data); |
|
213 | 213 | |
214 | - $catalog = $this->get( 'job_csv_test' ); |
|
214 | + $catalog = $this->get('job_csv_test'); |
|
215 | 215 | |
216 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, [], $this->endpoint ); |
|
217 | - $object->process( $catalog, [] ); |
|
216 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, [], $this->endpoint); |
|
217 | + $object->process($catalog, []); |
|
218 | 218 | |
219 | - $catalog = $this->get( 'job_csv_test' ); |
|
220 | - $this->delete( $catalog ); |
|
219 | + $catalog = $this->get('job_csv_test'); |
|
220 | + $this->delete($catalog); |
|
221 | 221 | |
222 | 222 | |
223 | 223 | $listItems = $catalog->getListItems(); |
224 | 224 | |
225 | - $this->assertEquals( 0, count( $listItems ) ); |
|
225 | + $this->assertEquals(0, count($listItems)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -238,18 +238,18 @@ discard block |
||
238 | 238 | 1 => '', |
239 | 239 | ); |
240 | 240 | |
241 | - $catalog = $this->create( 'job_csv_test' ); |
|
241 | + $catalog = $this->create('job_csv_test'); |
|
242 | 242 | |
243 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
244 | - $object->process( $catalog, $data ); |
|
243 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
244 | + $object->process($catalog, $data); |
|
245 | 245 | |
246 | - $catalog = $this->get( 'job_csv_test' ); |
|
247 | - $this->delete( $catalog ); |
|
246 | + $catalog = $this->get('job_csv_test'); |
|
247 | + $this->delete($catalog); |
|
248 | 248 | |
249 | 249 | |
250 | 250 | $listItems = $catalog->getListItems(); |
251 | 251 | |
252 | - $this->assertEquals( 1, count( $listItems ) ); |
|
252 | + $this->assertEquals(1, count($listItems)); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -269,64 +269,64 @@ discard block |
||
269 | 269 | 3 => 'default', |
270 | 270 | ); |
271 | 271 | |
272 | - $this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/media/listtypes', array( 'default' ) ); |
|
272 | + $this->context->getConfig()->set('controller/common/catalog/import/csv/processor/media/listtypes', array('default')); |
|
273 | 273 | |
274 | - $catalog = $this->create( 'job_csv_test' ); |
|
274 | + $catalog = $this->create('job_csv_test'); |
|
275 | 275 | |
276 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
277 | - $object->process( $catalog, $data ); |
|
276 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
277 | + $object->process($catalog, $data); |
|
278 | 278 | |
279 | - $catalog = $this->get( 'job_csv_test' ); |
|
280 | - $this->delete( $catalog ); |
|
279 | + $catalog = $this->get('job_csv_test'); |
|
280 | + $this->delete($catalog); |
|
281 | 281 | |
282 | 282 | |
283 | 283 | $listItems = $catalog->getListItems(); |
284 | - $listItem = reset( $listItems ); |
|
284 | + $listItem = reset($listItems); |
|
285 | 285 | |
286 | - $this->assertEquals( 1, count( $listItems ) ); |
|
287 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
286 | + $this->assertEquals(1, count($listItems)); |
|
287 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
288 | 288 | |
289 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
290 | - $this->assertEquals( 'path/to/file2', $listItem->getRefItem()->getUrl() ); |
|
289 | + $this->assertEquals('default', $listItem->getType()); |
|
290 | + $this->assertEquals('path/to/file2', $listItem->getRefItem()->getUrl()); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * @param string $code |
296 | 296 | */ |
297 | - protected function create( $code ) |
|
297 | + protected function create($code) |
|
298 | 298 | { |
299 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
299 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
300 | 300 | |
301 | 301 | $item = $manager->createItem(); |
302 | - $item->setCode( $code ); |
|
302 | + $item->setCode($code); |
|
303 | 303 | |
304 | - return $manager->insertItem( $item ); |
|
304 | + return $manager->insertItem($item); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
308 | - protected function delete( \Aimeos\MShop\Catalog\Item\Iface $catalog ) |
|
308 | + protected function delete(\Aimeos\MShop\Catalog\Item\Iface $catalog) |
|
309 | 309 | { |
310 | - $mediaManager = \Aimeos\MShop\Media\Manager\Factory::createManager( $this->context ); |
|
311 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
312 | - $listManager = $manager->getSubManager( 'lists' ); |
|
310 | + $mediaManager = \Aimeos\MShop\Media\Manager\Factory::createManager($this->context); |
|
311 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
312 | + $listManager = $manager->getSubManager('lists'); |
|
313 | 313 | |
314 | - foreach( $catalog->getListItems('media') as $listItem ) |
|
314 | + foreach ($catalog->getListItems('media') as $listItem) |
|
315 | 315 | { |
316 | - $mediaManager->deleteItem( $listItem->getRefItem()->getId() ); |
|
317 | - $listManager->deleteItem( $listItem->getId() ); |
|
316 | + $mediaManager->deleteItem($listItem->getRefItem()->getId()); |
|
317 | + $listManager->deleteItem($listItem->getId()); |
|
318 | 318 | } |
319 | 319 | |
320 | - $manager->deleteItem( $catalog->getId() ); |
|
320 | + $manager->deleteItem($catalog->getId()); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
324 | 324 | /** |
325 | 325 | * @param string $code |
326 | 326 | */ |
327 | - protected function get( $code ) |
|
327 | + protected function get($code) |
|
328 | 328 | { |
329 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
330 | - return $manager->findItem( $code, array('media') ); |
|
329 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
330 | + return $manager->findItem($code, array('media')); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | \ No newline at end of file |
@@ -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\Catalog\Import\Csv\Processor\Done( $this->context, [] ); |
|
23 | + $this->endpoint = new \Aimeos\Controller\Common\Catalog\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 | |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | 4 => 1, |
50 | 50 | ); |
51 | 51 | |
52 | - $catalog = $this->create( 'job_csv_test' ); |
|
52 | + $catalog = $this->create('job_csv_test'); |
|
53 | 53 | |
54 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
55 | - $object->process( $catalog, $data ); |
|
54 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
55 | + $object->process($catalog, $data); |
|
56 | 56 | |
57 | - $catalog = $this->get( 'job_csv_test' ); |
|
58 | - $this->delete( $catalog ); |
|
57 | + $catalog = $this->get('job_csv_test'); |
|
58 | + $this->delete($catalog); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | $listItems = $catalog->getListItems(); |
62 | - $listItem = reset( $listItems ); |
|
62 | + $listItem = reset($listItems); |
|
63 | 63 | |
64 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
65 | - $this->assertEquals( 1, count( $listItems ) ); |
|
64 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
65 | + $this->assertEquals(1, count($listItems)); |
|
66 | 66 | |
67 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
68 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
69 | - $this->assertEquals( 'text', $listItem->getDomain() ); |
|
70 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
67 | + $this->assertEquals(1, $listItem->getStatus()); |
|
68 | + $this->assertEquals(0, $listItem->getPosition()); |
|
69 | + $this->assertEquals('text', $listItem->getDomain()); |
|
70 | + $this->assertEquals('default', $listItem->getType()); |
|
71 | 71 | |
72 | 72 | $refItem = $listItem->getRefItem(); |
73 | 73 | |
74 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
75 | - $this->assertEquals( 'name', $refItem->getType() ); |
|
76 | - $this->assertEquals( 'catalog', $refItem->getDomain() ); |
|
77 | - $this->assertEquals( 'test text', $refItem->getLabel() ); |
|
78 | - $this->assertEquals( 'Job CSV test', $refItem->getContent() ); |
|
79 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
80 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
74 | + $this->assertEquals(1, $refItem->getStatus()); |
|
75 | + $this->assertEquals('name', $refItem->getType()); |
|
76 | + $this->assertEquals('catalog', $refItem->getDomain()); |
|
77 | + $this->assertEquals('test text', $refItem->getLabel()); |
|
78 | + $this->assertEquals('Job CSV test', $refItem->getContent()); |
|
79 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
80 | + $this->assertEquals(1, $refItem->getStatus()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -105,30 +105,30 @@ discard block |
||
105 | 105 | 7 => 'Long: Job CSV test 2', |
106 | 106 | ); |
107 | 107 | |
108 | - $catalog = $this->create( 'job_csv_test' ); |
|
108 | + $catalog = $this->create('job_csv_test'); |
|
109 | 109 | |
110 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
111 | - $object->process( $catalog, $data ); |
|
110 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
111 | + $object->process($catalog, $data); |
|
112 | 112 | |
113 | - $catalog = $this->get( 'job_csv_test' ); |
|
114 | - $this->delete( $catalog ); |
|
113 | + $catalog = $this->get('job_csv_test'); |
|
114 | + $this->delete($catalog); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | $pos = 0; |
118 | 118 | $listItems = $catalog->getListItems(); |
119 | 119 | $expected = array( |
120 | - 0 => array( 'name', 'Job CSV test' ), |
|
121 | - 1 => array( 'short', 'Short: Job CSV test' ), |
|
122 | - 2 => array( 'long', 'Long: Job CSV test' ), |
|
123 | - 3 => array( 'long', 'Long: Job CSV test 2' ), |
|
120 | + 0 => array('name', 'Job CSV test'), |
|
121 | + 1 => array('short', 'Short: Job CSV test'), |
|
122 | + 2 => array('long', 'Long: Job CSV test'), |
|
123 | + 3 => array('long', 'Long: Job CSV test 2'), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $this->assertEquals( 4, count( $listItems ) ); |
|
126 | + $this->assertEquals(4, count($listItems)); |
|
127 | 127 | |
128 | - foreach( $listItems as $listItem ) |
|
128 | + foreach ($listItems as $listItem) |
|
129 | 129 | { |
130 | - $this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() ); |
|
131 | - $this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() ); |
|
130 | + $this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType()); |
|
131 | + $this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent()); |
|
132 | 132 | $pos++; |
133 | 133 | } |
134 | 134 | } |
@@ -151,27 +151,27 @@ discard block |
||
151 | 151 | 1 => 'Short: Job CSV test', |
152 | 152 | ); |
153 | 153 | |
154 | - $catalog = $this->create( 'job_csv_test' ); |
|
154 | + $catalog = $this->create('job_csv_test'); |
|
155 | 155 | |
156 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
157 | - $object->process( $catalog, $data ); |
|
156 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
157 | + $object->process($catalog, $data); |
|
158 | 158 | |
159 | - $catalog = $this->get( 'job_csv_test' ); |
|
159 | + $catalog = $this->get('job_csv_test'); |
|
160 | 160 | |
161 | - $object->process( $catalog, $dataUpdate ); |
|
161 | + $object->process($catalog, $dataUpdate); |
|
162 | 162 | |
163 | - $catalog = $this->get( 'job_csv_test' ); |
|
164 | - $this->delete( $catalog ); |
|
163 | + $catalog = $this->get('job_csv_test'); |
|
164 | + $this->delete($catalog); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | $listItems = $catalog->getListItems(); |
168 | - $listItem = reset( $listItems ); |
|
168 | + $listItem = reset($listItems); |
|
169 | 169 | |
170 | - $this->assertEquals( 1, count( $listItems ) ); |
|
171 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
170 | + $this->assertEquals(1, count($listItems)); |
|
171 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
172 | 172 | |
173 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
174 | - $this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() ); |
|
173 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
174 | + $this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -187,23 +187,23 @@ discard block |
||
187 | 187 | 1 => 'Job CSV test', |
188 | 188 | ); |
189 | 189 | |
190 | - $catalog = $this->create( 'job_csv_test' ); |
|
190 | + $catalog = $this->create('job_csv_test'); |
|
191 | 191 | |
192 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
193 | - $object->process( $catalog, $data ); |
|
192 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
193 | + $object->process($catalog, $data); |
|
194 | 194 | |
195 | - $catalog = $this->get( 'job_csv_test' ); |
|
195 | + $catalog = $this->get('job_csv_test'); |
|
196 | 196 | |
197 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint ); |
|
198 | - $object->process( $catalog, [] ); |
|
197 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint); |
|
198 | + $object->process($catalog, []); |
|
199 | 199 | |
200 | - $catalog = $this->get( 'job_csv_test' ); |
|
201 | - $this->delete( $catalog ); |
|
200 | + $catalog = $this->get('job_csv_test'); |
|
201 | + $this->delete($catalog); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | $listItems = $catalog->getListItems(); |
205 | 205 | |
206 | - $this->assertEquals( 0, count( $listItems ) ); |
|
206 | + $this->assertEquals(0, count($listItems)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -223,18 +223,18 @@ discard block |
||
223 | 223 | 3 => '', |
224 | 224 | ); |
225 | 225 | |
226 | - $catalog = $this->create( 'job_csv_test' ); |
|
226 | + $catalog = $this->create('job_csv_test'); |
|
227 | 227 | |
228 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
229 | - $object->process( $catalog, $data ); |
|
228 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
229 | + $object->process($catalog, $data); |
|
230 | 230 | |
231 | - $catalog = $this->get( 'job_csv_test' ); |
|
232 | - $this->delete( $catalog ); |
|
231 | + $catalog = $this->get('job_csv_test'); |
|
232 | + $this->delete($catalog); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | $listItems = $catalog->getListItems(); |
236 | 236 | |
237 | - $this->assertEquals( 1, count( $listItems ) ); |
|
237 | + $this->assertEquals(1, count($listItems)); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -258,65 +258,65 @@ discard block |
||
258 | 258 | 5 => 'default', |
259 | 259 | ); |
260 | 260 | |
261 | - $this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/text/listtypes', array( 'default' ) ); |
|
261 | + $this->context->getConfig()->set('controller/common/catalog/import/csv/processor/text/listtypes', array('default')); |
|
262 | 262 | |
263 | - $catalog = $this->create( 'job_csv_test' ); |
|
263 | + $catalog = $this->create('job_csv_test'); |
|
264 | 264 | |
265 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
266 | - $object->process( $catalog, $data ); |
|
265 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
266 | + $object->process($catalog, $data); |
|
267 | 267 | |
268 | - $catalog = $this->get( 'job_csv_test' ); |
|
269 | - $this->delete( $catalog ); |
|
268 | + $catalog = $this->get('job_csv_test'); |
|
269 | + $this->delete($catalog); |
|
270 | 270 | |
271 | 271 | |
272 | 272 | $listItems = $catalog->getListItems(); |
273 | - $listItem = reset( $listItems ); |
|
273 | + $listItem = reset($listItems); |
|
274 | 274 | |
275 | - $this->assertEquals( 1, count( $listItems ) ); |
|
276 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
275 | + $this->assertEquals(1, count($listItems)); |
|
276 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
277 | 277 | |
278 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
279 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
280 | - $this->assertEquals( 'test short', $listItem->getRefItem()->getContent() ); |
|
278 | + $this->assertEquals('default', $listItem->getType()); |
|
279 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
280 | + $this->assertEquals('test short', $listItem->getRefItem()->getContent()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
284 | 284 | /** |
285 | 285 | * @param string $code |
286 | 286 | */ |
287 | - protected function create( $code ) |
|
287 | + protected function create($code) |
|
288 | 288 | { |
289 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
289 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
290 | 290 | |
291 | 291 | $item = $manager->createItem(); |
292 | - $item->setCode( $code ); |
|
292 | + $item->setCode($code); |
|
293 | 293 | |
294 | - return $manager->insertItem( $item ); |
|
294 | + return $manager->insertItem($item); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | - protected function delete( \Aimeos\MShop\Catalog\Item\Iface $catalog ) |
|
298 | + protected function delete(\Aimeos\MShop\Catalog\Item\Iface $catalog) |
|
299 | 299 | { |
300 | - $textManager = \Aimeos\MShop\Text\Manager\Factory::createManager( $this->context ); |
|
301 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
302 | - $listManager = $manager->getSubManager( 'lists' ); |
|
300 | + $textManager = \Aimeos\MShop\Text\Manager\Factory::createManager($this->context); |
|
301 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
302 | + $listManager = $manager->getSubManager('lists'); |
|
303 | 303 | |
304 | - foreach( $catalog->getListItems('text') as $listItem ) |
|
304 | + foreach ($catalog->getListItems('text') as $listItem) |
|
305 | 305 | { |
306 | - $textManager->deleteItem( $listItem->getRefItem()->getId() ); |
|
307 | - $listManager->deleteItem( $listItem->getId() ); |
|
306 | + $textManager->deleteItem($listItem->getRefItem()->getId()); |
|
307 | + $listManager->deleteItem($listItem->getId()); |
|
308 | 308 | } |
309 | 309 | |
310 | - $manager->deleteItem( $catalog->getId() ); |
|
310 | + $manager->deleteItem($catalog->getId()); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | 314 | /** |
315 | 315 | * @param string $code |
316 | 316 | */ |
317 | - protected function get( $code ) |
|
317 | + protected function get($code) |
|
318 | 318 | { |
319 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
320 | - return $manager->findItem( $code, ['text'] ); |
|
319 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
320 | + return $manager->findItem($code, ['text']); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | \ No newline at end of file |
@@ -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->object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
23 | + $this->object = 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 | $this->object = null; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | |
36 | 36 | public function testProcess() |
37 | 37 | { |
38 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->createItem(); |
|
38 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->createItem(); |
|
39 | 39 | |
40 | - $result = $this->object->process( $product, array( 'test' ) ); |
|
40 | + $result = $this->object->process($product, array('test')); |
|
41 | 41 | |
42 | - $this->assertEquals( array( 'test' ), $result ); |
|
42 | + $this->assertEquals(array('test'), $result); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -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 | |
@@ -51,36 +51,36 @@ discard block |
||
51 | 51 | 5 => 1, |
52 | 52 | ); |
53 | 53 | |
54 | - $product = $this->create( 'job_csv_test' ); |
|
54 | + $product = $this->create('job_csv_test'); |
|
55 | 55 | |
56 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
57 | - $object->process( $product, $data ); |
|
56 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
57 | + $object->process($product, $data); |
|
58 | 58 | |
59 | - $product = $this->get( 'job_csv_test' ); |
|
60 | - $this->delete( $product ); |
|
59 | + $product = $this->get('job_csv_test'); |
|
60 | + $this->delete($product); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | $listItems = $product->getListItems(); |
64 | - $listItem = reset( $listItems ); |
|
64 | + $listItem = reset($listItems); |
|
65 | 65 | |
66 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
67 | - $this->assertEquals( 1, count( $listItems ) ); |
|
66 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
67 | + $this->assertEquals(1, count($listItems)); |
|
68 | 68 | |
69 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
70 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
71 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
72 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
69 | + $this->assertEquals(1, $listItem->getStatus()); |
|
70 | + $this->assertEquals(0, $listItem->getPosition()); |
|
71 | + $this->assertEquals('media', $listItem->getDomain()); |
|
72 | + $this->assertEquals('default', $listItem->getType()); |
|
73 | 73 | |
74 | 74 | $refItem = $listItem->getRefItem(); |
75 | 75 | |
76 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
77 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
78 | - $this->assertEquals( 'product', $refItem->getDomain() ); |
|
79 | - $this->assertEquals( 'test image', $refItem->getLabel() ); |
|
80 | - $this->assertEquals( 'image/jpeg', $refItem->getMimetype() ); |
|
81 | - $this->assertEquals( 'path/to/preview', $refItem->getPreview() ); |
|
82 | - $this->assertEquals( 'path/to/file', $refItem->getUrl() ); |
|
83 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
76 | + $this->assertEquals(1, $refItem->getStatus()); |
|
77 | + $this->assertEquals('default', $refItem->getType()); |
|
78 | + $this->assertEquals('product', $refItem->getDomain()); |
|
79 | + $this->assertEquals('test image', $refItem->getLabel()); |
|
80 | + $this->assertEquals('image/jpeg', $refItem->getMimetype()); |
|
81 | + $this->assertEquals('path/to/preview', $refItem->getPreview()); |
|
82 | + $this->assertEquals('path/to/file', $refItem->getUrl()); |
|
83 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | 0 => "path/to/0\npath/to/1\npath/to/2\npath/to/3", |
95 | 95 | ); |
96 | 96 | |
97 | - $product = $this->create( 'job_csv_test' ); |
|
97 | + $product = $this->create('job_csv_test'); |
|
98 | 98 | |
99 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
100 | - $object->process( $product, $data ); |
|
99 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
100 | + $object->process($product, $data); |
|
101 | 101 | |
102 | - $product = $this->get( 'job_csv_test' ); |
|
103 | - $this->delete( $product ); |
|
102 | + $product = $this->get('job_csv_test'); |
|
103 | + $this->delete($product); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | $pos = 0; |
107 | 107 | $listItems = $product->getListItems(); |
108 | - $expected = array( 'path/to/0', 'path/to/1', 'path/to/2', 'path/to/3' ); |
|
108 | + $expected = array('path/to/0', 'path/to/1', 'path/to/2', 'path/to/3'); |
|
109 | 109 | |
110 | - $this->assertEquals( 4, count( $listItems ) ); |
|
110 | + $this->assertEquals(4, count($listItems)); |
|
111 | 111 | |
112 | - foreach( $listItems as $listItem ) |
|
112 | + foreach ($listItems as $listItem) |
|
113 | 113 | { |
114 | - $this->assertEquals( $expected[$pos], $listItem->getRefItem()->getUrl() ); |
|
114 | + $this->assertEquals($expected[$pos], $listItem->getRefItem()->getUrl()); |
|
115 | 115 | $pos++; |
116 | 116 | } |
117 | 117 | } |
@@ -133,23 +133,23 @@ discard block |
||
133 | 133 | 3 => 'path/to/3', |
134 | 134 | ); |
135 | 135 | |
136 | - $product = $this->create( 'job_csv_test' ); |
|
136 | + $product = $this->create('job_csv_test'); |
|
137 | 137 | |
138 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
139 | - $object->process( $product, $data ); |
|
138 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
139 | + $object->process($product, $data); |
|
140 | 140 | |
141 | - $product = $this->get( 'job_csv_test' ); |
|
142 | - $this->delete( $product ); |
|
141 | + $product = $this->get('job_csv_test'); |
|
142 | + $this->delete($product); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | $pos = 0; |
146 | 146 | $listItems = $product->getListItems(); |
147 | 147 | |
148 | - $this->assertEquals( 4, count( $listItems ) ); |
|
148 | + $this->assertEquals(4, count($listItems)); |
|
149 | 149 | |
150 | - foreach( $listItems as $listItem ) |
|
150 | + foreach ($listItems as $listItem) |
|
151 | 151 | { |
152 | - $this->assertEquals( $data[$pos], $listItem->getRefItem()->getUrl() ); |
|
152 | + $this->assertEquals($data[$pos], $listItem->getRefItem()->getUrl()); |
|
153 | 153 | $pos++; |
154 | 154 | } |
155 | 155 | } |
@@ -172,27 +172,27 @@ discard block |
||
172 | 172 | 1 => '', |
173 | 173 | ); |
174 | 174 | |
175 | - $product = $this->create( 'job_csv_test' ); |
|
175 | + $product = $this->create('job_csv_test'); |
|
176 | 176 | |
177 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
178 | - $object->process( $product, $data ); |
|
177 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
178 | + $object->process($product, $data); |
|
179 | 179 | |
180 | - $product = $this->get( 'job_csv_test' ); |
|
180 | + $product = $this->get('job_csv_test'); |
|
181 | 181 | |
182 | - $object->process( $product, $dataUpdate ); |
|
182 | + $object->process($product, $dataUpdate); |
|
183 | 183 | |
184 | - $product = $this->get( 'job_csv_test' ); |
|
185 | - $this->delete( $product ); |
|
184 | + $product = $this->get('job_csv_test'); |
|
185 | + $this->delete($product); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | $listItems = $product->getListItems(); |
189 | - $listItem = reset( $listItems ); |
|
189 | + $listItem = reset($listItems); |
|
190 | 190 | |
191 | - $this->assertEquals( 1, count( $listItems ) ); |
|
192 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
191 | + $this->assertEquals(1, count($listItems)); |
|
192 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
193 | 193 | |
194 | - $this->assertEquals( 'path/to/new', $listItem->getRefItem()->getUrl() ); |
|
195 | - $this->assertEquals( null, $listItem->getRefItem()->getLanguageId() ); |
|
194 | + $this->assertEquals('path/to/new', $listItem->getRefItem()->getUrl()); |
|
195 | + $this->assertEquals(null, $listItem->getRefItem()->getLanguageId()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -206,23 +206,23 @@ discard block |
||
206 | 206 | 0 => '/path/to/file', |
207 | 207 | ); |
208 | 208 | |
209 | - $product = $this->create( 'job_csv_test' ); |
|
209 | + $product = $this->create('job_csv_test'); |
|
210 | 210 | |
211 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
212 | - $object->process( $product, $data ); |
|
211 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
212 | + $object->process($product, $data); |
|
213 | 213 | |
214 | - $product = $this->get( 'job_csv_test' ); |
|
214 | + $product = $this->get('job_csv_test'); |
|
215 | 215 | |
216 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, [], $this->endpoint ); |
|
217 | - $object->process( $product, [] ); |
|
216 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, [], $this->endpoint); |
|
217 | + $object->process($product, []); |
|
218 | 218 | |
219 | - $product = $this->get( 'job_csv_test' ); |
|
220 | - $this->delete( $product ); |
|
219 | + $product = $this->get('job_csv_test'); |
|
220 | + $this->delete($product); |
|
221 | 221 | |
222 | 222 | |
223 | 223 | $listItems = $product->getListItems(); |
224 | 224 | |
225 | - $this->assertEquals( 0, count( $listItems ) ); |
|
225 | + $this->assertEquals(0, count($listItems)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -238,18 +238,18 @@ discard block |
||
238 | 238 | 1 => '', |
239 | 239 | ); |
240 | 240 | |
241 | - $product = $this->create( 'job_csv_test' ); |
|
241 | + $product = $this->create('job_csv_test'); |
|
242 | 242 | |
243 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
244 | - $object->process( $product, $data ); |
|
243 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
244 | + $object->process($product, $data); |
|
245 | 245 | |
246 | - $product = $this->get( 'job_csv_test' ); |
|
247 | - $this->delete( $product ); |
|
246 | + $product = $this->get('job_csv_test'); |
|
247 | + $this->delete($product); |
|
248 | 248 | |
249 | 249 | |
250 | 250 | $listItems = $product->getListItems(); |
251 | 251 | |
252 | - $this->assertEquals( 1, count( $listItems ) ); |
|
252 | + $this->assertEquals(1, count($listItems)); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -269,82 +269,82 @@ discard block |
||
269 | 269 | 3 => 'default', |
270 | 270 | ); |
271 | 271 | |
272 | - $this->context->getConfig()->set( 'controller/common/product/import/csv/processor/media/listtypes', array( 'default' ) ); |
|
272 | + $this->context->getConfig()->set('controller/common/product/import/csv/processor/media/listtypes', array('default')); |
|
273 | 273 | |
274 | - $product = $this->create( 'job_csv_test' ); |
|
274 | + $product = $this->create('job_csv_test'); |
|
275 | 275 | |
276 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
277 | - $object->process( $product, $data ); |
|
276 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
277 | + $object->process($product, $data); |
|
278 | 278 | |
279 | - $product = $this->get( 'job_csv_test' ); |
|
280 | - $this->delete( $product ); |
|
279 | + $product = $this->get('job_csv_test'); |
|
280 | + $this->delete($product); |
|
281 | 281 | |
282 | 282 | |
283 | 283 | $listItems = $product->getListItems(); |
284 | - $listItem = reset( $listItems ); |
|
284 | + $listItem = reset($listItems); |
|
285 | 285 | |
286 | - $this->assertEquals( 1, count( $listItems ) ); |
|
287 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
286 | + $this->assertEquals(1, count($listItems)); |
|
287 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
288 | 288 | |
289 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
290 | - $this->assertEquals( 'path/to/file2', $listItem->getRefItem()->getUrl() ); |
|
289 | + $this->assertEquals('default', $listItem->getType()); |
|
290 | + $this->assertEquals('path/to/file2', $listItem->getRefItem()->getUrl()); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * @param string $code |
296 | 296 | */ |
297 | - protected function create( $code ) |
|
297 | + protected function create($code) |
|
298 | 298 | { |
299 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
300 | - $typeManager = $manager->getSubManager( 'type' ); |
|
299 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
300 | + $typeManager = $manager->getSubManager('type'); |
|
301 | 301 | |
302 | 302 | $typeSearch = $typeManager->createSearch(); |
303 | - $typeSearch->setConditions( $typeSearch->compare( '==', 'product.type.code', 'default' ) ); |
|
304 | - $typeResult = $typeManager->searchItems( $typeSearch ); |
|
303 | + $typeSearch->setConditions($typeSearch->compare('==', 'product.type.code', 'default')); |
|
304 | + $typeResult = $typeManager->searchItems($typeSearch); |
|
305 | 305 | |
306 | - if( ( $typeItem = reset( $typeResult ) ) === false ) { |
|
307 | - throw new \RuntimeException( 'No product type "default" found' ); |
|
306 | + if (($typeItem = reset($typeResult)) === false) { |
|
307 | + throw new \RuntimeException('No product type "default" found'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | $item = $manager->createItem(); |
311 | - $item->setTypeid( $typeItem->getId() ); |
|
312 | - $item->setCode( $code ); |
|
311 | + $item->setTypeid($typeItem->getId()); |
|
312 | + $item->setCode($code); |
|
313 | 313 | |
314 | - return $manager->saveItem( $item ); |
|
314 | + return $manager->saveItem($item); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
318 | - protected function delete( \Aimeos\MShop\Product\Item\Iface $product ) |
|
318 | + protected function delete(\Aimeos\MShop\Product\Item\Iface $product) |
|
319 | 319 | { |
320 | - $mediaManager = \Aimeos\MShop\Media\Manager\Factory::createManager( $this->context ); |
|
321 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
322 | - $listManager = $manager->getSubManager( 'lists' ); |
|
320 | + $mediaManager = \Aimeos\MShop\Media\Manager\Factory::createManager($this->context); |
|
321 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
322 | + $listManager = $manager->getSubManager('lists'); |
|
323 | 323 | |
324 | - foreach( $product->getListItems('media') as $listItem ) |
|
324 | + foreach ($product->getListItems('media') as $listItem) |
|
325 | 325 | { |
326 | - $mediaManager->deleteItem( $listItem->getRefItem()->getId() ); |
|
327 | - $listManager->deleteItem( $listItem->getId() ); |
|
326 | + $mediaManager->deleteItem($listItem->getRefItem()->getId()); |
|
327 | + $listManager->deleteItem($listItem->getId()); |
|
328 | 328 | } |
329 | 329 | |
330 | - $manager->deleteItem( $product->getId() ); |
|
330 | + $manager->deleteItem($product->getId()); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | /** |
335 | 335 | * @param string $code |
336 | 336 | */ |
337 | - protected function get( $code ) |
|
337 | + protected function get($code) |
|
338 | 338 | { |
339 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
339 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
340 | 340 | |
341 | 341 | $search = $manager->createSearch(); |
342 | - $search->setConditions( $search->compare( '==', 'product.code', $code ) ); |
|
342 | + $search->setConditions($search->compare('==', 'product.code', $code)); |
|
343 | 343 | |
344 | - $result = $manager->searchItems( $search, array('media') ); |
|
344 | + $result = $manager->searchItems($search, array('media')); |
|
345 | 345 | |
346 | - if( ( $item = reset( $result ) ) === false ) { |
|
347 | - throw new \RuntimeException( sprintf( 'No product item for code "%1$s"', $code ) ); |
|
346 | + if (($item = reset($result)) === false) { |
|
347 | + throw new \RuntimeException(sprintf('No product item for code "%1$s"', $code)); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | 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 | |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | 4 => 1, |
50 | 50 | ); |
51 | 51 | |
52 | - $product = $this->create( 'job_csv_test' ); |
|
52 | + $product = $this->create('job_csv_test'); |
|
53 | 53 | |
54 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
55 | - $object->process( $product, $data ); |
|
54 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
55 | + $object->process($product, $data); |
|
56 | 56 | |
57 | - $product = $this->get( 'job_csv_test' ); |
|
58 | - $this->delete( $product ); |
|
57 | + $product = $this->get('job_csv_test'); |
|
58 | + $this->delete($product); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | $listItems = $product->getListItems(); |
62 | - $listItem = reset( $listItems ); |
|
62 | + $listItem = reset($listItems); |
|
63 | 63 | |
64 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
65 | - $this->assertEquals( 1, count( $listItems ) ); |
|
64 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
65 | + $this->assertEquals(1, count($listItems)); |
|
66 | 66 | |
67 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
68 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
69 | - $this->assertEquals( 'text', $listItem->getDomain() ); |
|
70 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
67 | + $this->assertEquals(1, $listItem->getStatus()); |
|
68 | + $this->assertEquals(0, $listItem->getPosition()); |
|
69 | + $this->assertEquals('text', $listItem->getDomain()); |
|
70 | + $this->assertEquals('default', $listItem->getType()); |
|
71 | 71 | |
72 | 72 | $refItem = $listItem->getRefItem(); |
73 | 73 | |
74 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
75 | - $this->assertEquals( 'name', $refItem->getType() ); |
|
76 | - $this->assertEquals( 'product', $refItem->getDomain() ); |
|
77 | - $this->assertEquals( 'test text', $refItem->getLabel() ); |
|
78 | - $this->assertEquals( 'Job CSV test', $refItem->getContent() ); |
|
79 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
80 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
74 | + $this->assertEquals(1, $refItem->getStatus()); |
|
75 | + $this->assertEquals('name', $refItem->getType()); |
|
76 | + $this->assertEquals('product', $refItem->getDomain()); |
|
77 | + $this->assertEquals('test text', $refItem->getLabel()); |
|
78 | + $this->assertEquals('Job CSV test', $refItem->getContent()); |
|
79 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
80 | + $this->assertEquals(1, $refItem->getStatus()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -105,30 +105,30 @@ discard block |
||
105 | 105 | 7 => 'Long: Job CSV test 2', |
106 | 106 | ); |
107 | 107 | |
108 | - $product = $this->create( 'job_csv_test' ); |
|
108 | + $product = $this->create('job_csv_test'); |
|
109 | 109 | |
110 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
111 | - $object->process( $product, $data ); |
|
110 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
111 | + $object->process($product, $data); |
|
112 | 112 | |
113 | - $product = $this->get( 'job_csv_test' ); |
|
114 | - $this->delete( $product ); |
|
113 | + $product = $this->get('job_csv_test'); |
|
114 | + $this->delete($product); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | $pos = 0; |
118 | 118 | $listItems = $product->getListItems(); |
119 | 119 | $expected = array( |
120 | - 0 => array( 'name', 'Job CSV test' ), |
|
121 | - 1 => array( 'short', 'Short: Job CSV test' ), |
|
122 | - 2 => array( 'long', 'Long: Job CSV test' ), |
|
123 | - 3 => array( 'long', 'Long: Job CSV test 2' ), |
|
120 | + 0 => array('name', 'Job CSV test'), |
|
121 | + 1 => array('short', 'Short: Job CSV test'), |
|
122 | + 2 => array('long', 'Long: Job CSV test'), |
|
123 | + 3 => array('long', 'Long: Job CSV test 2'), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $this->assertEquals( 4, count( $listItems ) ); |
|
126 | + $this->assertEquals(4, count($listItems)); |
|
127 | 127 | |
128 | - foreach( $listItems as $listItem ) |
|
128 | + foreach ($listItems as $listItem) |
|
129 | 129 | { |
130 | - $this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() ); |
|
131 | - $this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() ); |
|
130 | + $this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType()); |
|
131 | + $this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent()); |
|
132 | 132 | $pos++; |
133 | 133 | } |
134 | 134 | } |
@@ -151,27 +151,27 @@ discard block |
||
151 | 151 | 1 => 'Short: Job CSV test', |
152 | 152 | ); |
153 | 153 | |
154 | - $product = $this->create( 'job_csv_test' ); |
|
154 | + $product = $this->create('job_csv_test'); |
|
155 | 155 | |
156 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
157 | - $object->process( $product, $data ); |
|
156 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
157 | + $object->process($product, $data); |
|
158 | 158 | |
159 | - $product = $this->get( 'job_csv_test' ); |
|
159 | + $product = $this->get('job_csv_test'); |
|
160 | 160 | |
161 | - $object->process( $product, $dataUpdate ); |
|
161 | + $object->process($product, $dataUpdate); |
|
162 | 162 | |
163 | - $product = $this->get( 'job_csv_test' ); |
|
164 | - $this->delete( $product ); |
|
163 | + $product = $this->get('job_csv_test'); |
|
164 | + $this->delete($product); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | $listItems = $product->getListItems(); |
168 | - $listItem = reset( $listItems ); |
|
168 | + $listItem = reset($listItems); |
|
169 | 169 | |
170 | - $this->assertEquals( 1, count( $listItems ) ); |
|
171 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
170 | + $this->assertEquals(1, count($listItems)); |
|
171 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
172 | 172 | |
173 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
174 | - $this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() ); |
|
173 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
174 | + $this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -187,23 +187,23 @@ discard block |
||
187 | 187 | 1 => 'Job CSV test', |
188 | 188 | ); |
189 | 189 | |
190 | - $product = $this->create( 'job_csv_test' ); |
|
190 | + $product = $this->create('job_csv_test'); |
|
191 | 191 | |
192 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
193 | - $object->process( $product, $data ); |
|
192 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
193 | + $object->process($product, $data); |
|
194 | 194 | |
195 | - $product = $this->get( 'job_csv_test' ); |
|
195 | + $product = $this->get('job_csv_test'); |
|
196 | 196 | |
197 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint ); |
|
198 | - $object->process( $product, [] ); |
|
197 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint); |
|
198 | + $object->process($product, []); |
|
199 | 199 | |
200 | - $product = $this->get( 'job_csv_test' ); |
|
201 | - $this->delete( $product ); |
|
200 | + $product = $this->get('job_csv_test'); |
|
201 | + $this->delete($product); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | $listItems = $product->getListItems(); |
205 | 205 | |
206 | - $this->assertEquals( 0, count( $listItems ) ); |
|
206 | + $this->assertEquals(0, count($listItems)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -223,18 +223,18 @@ discard block |
||
223 | 223 | 3 => '', |
224 | 224 | ); |
225 | 225 | |
226 | - $product = $this->create( 'job_csv_test' ); |
|
226 | + $product = $this->create('job_csv_test'); |
|
227 | 227 | |
228 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
229 | - $object->process( $product, $data ); |
|
228 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
229 | + $object->process($product, $data); |
|
230 | 230 | |
231 | - $product = $this->get( 'job_csv_test' ); |
|
232 | - $this->delete( $product ); |
|
231 | + $product = $this->get('job_csv_test'); |
|
232 | + $this->delete($product); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | $listItems = $product->getListItems(); |
236 | 236 | |
237 | - $this->assertEquals( 1, count( $listItems ) ); |
|
237 | + $this->assertEquals(1, count($listItems)); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -258,83 +258,83 @@ discard block |
||
258 | 258 | 5 => 'default', |
259 | 259 | ); |
260 | 260 | |
261 | - $this->context->getConfig()->set( 'controller/common/product/import/csv/processor/text/listtypes', array( 'default' ) ); |
|
261 | + $this->context->getConfig()->set('controller/common/product/import/csv/processor/text/listtypes', array('default')); |
|
262 | 262 | |
263 | - $product = $this->create( 'job_csv_test' ); |
|
263 | + $product = $this->create('job_csv_test'); |
|
264 | 264 | |
265 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
266 | - $object->process( $product, $data ); |
|
265 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
266 | + $object->process($product, $data); |
|
267 | 267 | |
268 | - $product = $this->get( 'job_csv_test' ); |
|
269 | - $this->delete( $product ); |
|
268 | + $product = $this->get('job_csv_test'); |
|
269 | + $this->delete($product); |
|
270 | 270 | |
271 | 271 | |
272 | 272 | $listItems = $product->getListItems(); |
273 | - $listItem = reset( $listItems ); |
|
273 | + $listItem = reset($listItems); |
|
274 | 274 | |
275 | - $this->assertEquals( 1, count( $listItems ) ); |
|
276 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
275 | + $this->assertEquals(1, count($listItems)); |
|
276 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
277 | 277 | |
278 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
279 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
280 | - $this->assertEquals( 'test short', $listItem->getRefItem()->getContent() ); |
|
278 | + $this->assertEquals('default', $listItem->getType()); |
|
279 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
280 | + $this->assertEquals('test short', $listItem->getRefItem()->getContent()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
284 | 284 | /** |
285 | 285 | * @param string $code |
286 | 286 | */ |
287 | - protected function create( $code ) |
|
287 | + protected function create($code) |
|
288 | 288 | { |
289 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
290 | - $typeManager = $manager->getSubManager( 'type' ); |
|
289 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
290 | + $typeManager = $manager->getSubManager('type'); |
|
291 | 291 | |
292 | 292 | $typeSearch = $typeManager->createSearch(); |
293 | - $typeSearch->setConditions( $typeSearch->compare( '==', 'product.type.code', 'default' ) ); |
|
294 | - $typeResult = $typeManager->searchItems( $typeSearch ); |
|
293 | + $typeSearch->setConditions($typeSearch->compare('==', 'product.type.code', 'default')); |
|
294 | + $typeResult = $typeManager->searchItems($typeSearch); |
|
295 | 295 | |
296 | - if( ( $typeItem = reset( $typeResult ) ) === false ) { |
|
297 | - throw new \RuntimeException( 'No product type "default" found' ); |
|
296 | + if (($typeItem = reset($typeResult)) === false) { |
|
297 | + throw new \RuntimeException('No product type "default" found'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $item = $manager->createItem(); |
301 | - $item->setTypeid( $typeItem->getId() ); |
|
302 | - $item->setCode( $code ); |
|
301 | + $item->setTypeid($typeItem->getId()); |
|
302 | + $item->setCode($code); |
|
303 | 303 | |
304 | - return $manager->saveItem( $item ); |
|
304 | + return $manager->saveItem($item); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
308 | - protected function delete( \Aimeos\MShop\Product\Item\Iface $product ) |
|
308 | + protected function delete(\Aimeos\MShop\Product\Item\Iface $product) |
|
309 | 309 | { |
310 | - $textManager = \Aimeos\MShop\Text\Manager\Factory::createManager( $this->context ); |
|
311 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
312 | - $listManager = $manager->getSubManager( 'lists' ); |
|
310 | + $textManager = \Aimeos\MShop\Text\Manager\Factory::createManager($this->context); |
|
311 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
312 | + $listManager = $manager->getSubManager('lists'); |
|
313 | 313 | |
314 | - foreach( $product->getListItems('text') as $listItem ) |
|
314 | + foreach ($product->getListItems('text') as $listItem) |
|
315 | 315 | { |
316 | - $textManager->deleteItem( $listItem->getRefItem()->getId() ); |
|
317 | - $listManager->deleteItem( $listItem->getId() ); |
|
316 | + $textManager->deleteItem($listItem->getRefItem()->getId()); |
|
317 | + $listManager->deleteItem($listItem->getId()); |
|
318 | 318 | } |
319 | 319 | |
320 | - $manager->deleteItem( $product->getId() ); |
|
320 | + $manager->deleteItem($product->getId()); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
324 | 324 | /** |
325 | 325 | * @param string $code |
326 | 326 | */ |
327 | - protected function get( $code ) |
|
327 | + protected function get($code) |
|
328 | 328 | { |
329 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
329 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
330 | 330 | |
331 | 331 | $search = $manager->createSearch(); |
332 | - $search->setConditions( $search->compare( '==', 'product.code', $code ) ); |
|
332 | + $search->setConditions($search->compare('==', 'product.code', $code)); |
|
333 | 333 | |
334 | - $result = $manager->searchItems( $search, array('text') ); |
|
334 | + $result = $manager->searchItems($search, array('text')); |
|
335 | 335 | |
336 | - if( ( $item = reset( $result ) ) === false ) { |
|
337 | - throw new \RuntimeException( sprintf( 'No product item for code "%1$s"', $code ) ); |
|
336 | + if (($item = reset($result)) === false) { |
|
337 | + throw new \RuntimeException(sprintf('No product item for code "%1$s"', $code)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | 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 | |
@@ -57,38 +57,38 @@ discard block |
||
57 | 57 | 8 => 1, |
58 | 58 | ); |
59 | 59 | |
60 | - $product = $this->create( 'job_csv_test' ); |
|
60 | + $product = $this->create('job_csv_test'); |
|
61 | 61 | |
62 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
63 | - $object->process( $product, $data ); |
|
62 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
63 | + $object->process($product, $data); |
|
64 | 64 | |
65 | - $product = $this->get( 'job_csv_test' ); |
|
66 | - $this->delete( $product ); |
|
65 | + $product = $this->get('job_csv_test'); |
|
66 | + $this->delete($product); |
|
67 | 67 | |
68 | 68 | |
69 | 69 | $listItems = $product->getListItems(); |
70 | - $listItem = reset( $listItems ); |
|
70 | + $listItem = reset($listItems); |
|
71 | 71 | |
72 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
73 | - $this->assertEquals( 1, count( $listItems ) ); |
|
72 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
73 | + $this->assertEquals(1, count($listItems)); |
|
74 | 74 | |
75 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
76 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
77 | - $this->assertEquals( 'price', $listItem->getDomain() ); |
|
78 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
75 | + $this->assertEquals(1, $listItem->getStatus()); |
|
76 | + $this->assertEquals(0, $listItem->getPosition()); |
|
77 | + $this->assertEquals('price', $listItem->getDomain()); |
|
78 | + $this->assertEquals('default', $listItem->getType()); |
|
79 | 79 | |
80 | 80 | $refItem = $listItem->getRefItem(); |
81 | 81 | |
82 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
83 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
84 | - $this->assertEquals( 'product', $refItem->getDomain() ); |
|
85 | - $this->assertEquals( 'EUR 1.00', $refItem->getLabel() ); |
|
86 | - $this->assertEquals( 5, $refItem->getQuantity() ); |
|
87 | - $this->assertEquals( '1.00', $refItem->getValue() ); |
|
88 | - $this->assertEquals( '0.20', $refItem->getCosts() ); |
|
89 | - $this->assertEquals( '0.10', $refItem->getRebate() ); |
|
90 | - $this->assertEquals( '20.00', $refItem->getTaxrate() ); |
|
91 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
82 | + $this->assertEquals(1, $refItem->getStatus()); |
|
83 | + $this->assertEquals('default', $refItem->getType()); |
|
84 | + $this->assertEquals('product', $refItem->getDomain()); |
|
85 | + $this->assertEquals('EUR 1.00', $refItem->getLabel()); |
|
86 | + $this->assertEquals(5, $refItem->getQuantity()); |
|
87 | + $this->assertEquals('1.00', $refItem->getValue()); |
|
88 | + $this->assertEquals('0.20', $refItem->getCosts()); |
|
89 | + $this->assertEquals('0.10', $refItem->getRebate()); |
|
90 | + $this->assertEquals('20.00', $refItem->getTaxrate()); |
|
91 | + $this->assertEquals(1, $refItem->getStatus()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | 3 => '4.00', |
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\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
114 | - $object->process( $product, $data ); |
|
113 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
114 | + $object->process($product, $data); |
|
115 | 115 | |
116 | - $product = $this->get( 'job_csv_test' ); |
|
117 | - $this->delete( $product ); |
|
116 | + $product = $this->get('job_csv_test'); |
|
117 | + $this->delete($product); |
|
118 | 118 | |
119 | 119 | |
120 | 120 | $pos = 0; |
121 | 121 | $listItems = $product->getListItems(); |
122 | 122 | |
123 | - $this->assertEquals( 4, count( $listItems ) ); |
|
123 | + $this->assertEquals(4, count($listItems)); |
|
124 | 124 | |
125 | - foreach( $listItems as $listItem ) |
|
125 | + foreach ($listItems as $listItem) |
|
126 | 126 | { |
127 | - $this->assertEquals( $data[$pos], $listItem->getRefItem()->getValue() ); |
|
127 | + $this->assertEquals($data[$pos], $listItem->getRefItem()->getValue()); |
|
128 | 128 | $pos++; |
129 | 129 | } |
130 | 130 | } |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | 0 => '2.00', |
145 | 145 | ); |
146 | 146 | |
147 | - $product = $this->create( 'job_csv_test' ); |
|
147 | + $product = $this->create('job_csv_test'); |
|
148 | 148 | |
149 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
150 | - $object->process( $product, $data ); |
|
149 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
150 | + $object->process($product, $data); |
|
151 | 151 | |
152 | - $product = $this->get( 'job_csv_test' ); |
|
152 | + $product = $this->get('job_csv_test'); |
|
153 | 153 | |
154 | - $object->process( $product, $dataUpdate ); |
|
154 | + $object->process($product, $dataUpdate); |
|
155 | 155 | |
156 | - $product = $this->get( 'job_csv_test' ); |
|
157 | - $this->delete( $product ); |
|
156 | + $product = $this->get('job_csv_test'); |
|
157 | + $this->delete($product); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | $listItems = $product->getListItems(); |
161 | - $listItem = reset( $listItems ); |
|
161 | + $listItem = reset($listItems); |
|
162 | 162 | |
163 | - $this->assertEquals( 1, count( $listItems ) ); |
|
164 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
163 | + $this->assertEquals(1, count($listItems)); |
|
164 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
165 | 165 | |
166 | - $this->assertEquals( '2.00', $listItem->getRefItem()->getValue() ); |
|
166 | + $this->assertEquals('2.00', $listItem->getRefItem()->getValue()); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -177,23 +177,23 @@ discard block |
||
177 | 177 | 0 => '1.00', |
178 | 178 | ); |
179 | 179 | |
180 | - $product = $this->create( 'job_csv_test' ); |
|
180 | + $product = $this->create('job_csv_test'); |
|
181 | 181 | |
182 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
183 | - $object->process( $product, $data ); |
|
182 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
183 | + $object->process($product, $data); |
|
184 | 184 | |
185 | - $product = $this->get( 'job_csv_test' ); |
|
185 | + $product = $this->get('job_csv_test'); |
|
186 | 186 | |
187 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, [], $this->endpoint ); |
|
188 | - $object->process( $product, [] ); |
|
187 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, [], $this->endpoint); |
|
188 | + $object->process($product, []); |
|
189 | 189 | |
190 | - $product = $this->get( 'job_csv_test' ); |
|
191 | - $this->delete( $product ); |
|
190 | + $product = $this->get('job_csv_test'); |
|
191 | + $this->delete($product); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | $listItems = $product->getListItems(); |
195 | 195 | |
196 | - $this->assertEquals( 0, count( $listItems ) ); |
|
196 | + $this->assertEquals(0, count($listItems)); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | 1 => '', |
210 | 210 | ); |
211 | 211 | |
212 | - $product = $this->create( 'job_csv_test' ); |
|
212 | + $product = $this->create('job_csv_test'); |
|
213 | 213 | |
214 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
215 | - $object->process( $product, $data ); |
|
214 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
215 | + $object->process($product, $data); |
|
216 | 216 | |
217 | - $product = $this->get( 'job_csv_test' ); |
|
218 | - $this->delete( $product ); |
|
217 | + $product = $this->get('job_csv_test'); |
|
218 | + $this->delete($product); |
|
219 | 219 | |
220 | 220 | |
221 | 221 | $listItems = $product->getListItems(); |
222 | 222 | |
223 | - $this->assertEquals( 1, count( $listItems ) ); |
|
223 | + $this->assertEquals(1, count($listItems)); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -240,82 +240,82 @@ discard block |
||
240 | 240 | 3 => 'default', |
241 | 241 | ); |
242 | 242 | |
243 | - $this->context->getConfig()->set( 'controller/common/product/import/csv/processor/price/listtypes', array( 'default' ) ); |
|
243 | + $this->context->getConfig()->set('controller/common/product/import/csv/processor/price/listtypes', array('default')); |
|
244 | 244 | |
245 | - $product = $this->create( 'job_csv_test' ); |
|
245 | + $product = $this->create('job_csv_test'); |
|
246 | 246 | |
247 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint ); |
|
248 | - $object->process( $product, $data ); |
|
247 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint); |
|
248 | + $object->process($product, $data); |
|
249 | 249 | |
250 | - $product = $this->get( 'job_csv_test' ); |
|
251 | - $this->delete( $product ); |
|
250 | + $product = $this->get('job_csv_test'); |
|
251 | + $this->delete($product); |
|
252 | 252 | |
253 | 253 | |
254 | 254 | $listItems = $product->getListItems(); |
255 | - $listItem = reset( $listItems ); |
|
255 | + $listItem = reset($listItems); |
|
256 | 256 | |
257 | - $this->assertEquals( 1, count( $listItems ) ); |
|
258 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
257 | + $this->assertEquals(1, count($listItems)); |
|
258 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
259 | 259 | |
260 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
261 | - $this->assertEquals( '2.00', $listItem->getRefItem()->getValue() ); |
|
260 | + $this->assertEquals('default', $listItem->getType()); |
|
261 | + $this->assertEquals('2.00', $listItem->getRefItem()->getValue()); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | 265 | /** |
266 | 266 | * @param string $code |
267 | 267 | */ |
268 | - protected function create( $code ) |
|
268 | + protected function create($code) |
|
269 | 269 | { |
270 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
271 | - $typeManager = $manager->getSubManager( 'type' ); |
|
270 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
271 | + $typeManager = $manager->getSubManager('type'); |
|
272 | 272 | |
273 | 273 | $typeSearch = $typeManager->createSearch(); |
274 | - $typeSearch->setConditions( $typeSearch->compare( '==', 'product.type.code', 'default' ) ); |
|
275 | - $typeResult = $typeManager->searchItems( $typeSearch ); |
|
274 | + $typeSearch->setConditions($typeSearch->compare('==', 'product.type.code', 'default')); |
|
275 | + $typeResult = $typeManager->searchItems($typeSearch); |
|
276 | 276 | |
277 | - if( ( $typeItem = reset( $typeResult ) ) === false ) { |
|
278 | - throw new \RuntimeException( 'No product type "default" found' ); |
|
277 | + if (($typeItem = reset($typeResult)) === false) { |
|
278 | + throw new \RuntimeException('No product type "default" found'); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | $item = $manager->createItem(); |
282 | - $item->setTypeid( $typeItem->getId() ); |
|
283 | - $item->setCode( $code ); |
|
282 | + $item->setTypeid($typeItem->getId()); |
|
283 | + $item->setCode($code); |
|
284 | 284 | |
285 | - return $manager->saveItem( $item ); |
|
285 | + return $manager->saveItem($item); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
289 | - protected function delete( \Aimeos\MShop\Product\Item\Iface $product ) |
|
289 | + protected function delete(\Aimeos\MShop\Product\Item\Iface $product) |
|
290 | 290 | { |
291 | - $priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager( $this->context ); |
|
292 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
293 | - $listManager = $manager->getSubManager( 'lists' ); |
|
291 | + $priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager($this->context); |
|
292 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
293 | + $listManager = $manager->getSubManager('lists'); |
|
294 | 294 | |
295 | - foreach( $product->getListItems('price') as $listItem ) |
|
295 | + foreach ($product->getListItems('price') as $listItem) |
|
296 | 296 | { |
297 | - $priceManager->deleteItem( $listItem->getRefItem()->getId() ); |
|
298 | - $listManager->deleteItem( $listItem->getId() ); |
|
297 | + $priceManager->deleteItem($listItem->getRefItem()->getId()); |
|
298 | + $listManager->deleteItem($listItem->getId()); |
|
299 | 299 | } |
300 | 300 | |
301 | - $manager->deleteItem( $product->getId() ); |
|
301 | + $manager->deleteItem($product->getId()); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
305 | 305 | /** |
306 | 306 | * @param string $code |
307 | 307 | */ |
308 | - protected function get( $code ) |
|
308 | + protected function get($code) |
|
309 | 309 | { |
310 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
310 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
311 | 311 | |
312 | 312 | $search = $manager->createSearch(); |
313 | - $search->setConditions( $search->compare( '==', 'product.code', $code ) ); |
|
313 | + $search->setConditions($search->compare('==', 'product.code', $code)); |
|
314 | 314 | |
315 | - $result = $manager->searchItems( $search, array('price') ); |
|
315 | + $result = $manager->searchItems($search, array('price')); |
|
316 | 316 | |
317 | - if( ( $item = reset( $result ) ) === false ) { |
|
318 | - throw new \RuntimeException( sprintf( 'No product item for code "%1$s"', $code ) ); |
|
317 | + if (($item = reset($result)) === false) { |
|
318 | + throw new \RuntimeException(sprintf('No product item for code "%1$s"', $code)); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | return $item; |