@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | { |
61 | 61 | // optimize autoloader with custom path |
62 | 62 | $this->taskComposerInstall() |
63 | - ->preferDist() |
|
64 | - ->optimizeAutoloader() |
|
65 | - ->run(); |
|
63 | + ->preferDist() |
|
64 | + ->optimizeAutoloader() |
|
65 | + ->run(); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | { |
75 | 75 | // optimize autoloader with custom path |
76 | 76 | $this->taskComposerUpdate() |
77 | - ->preferDist() |
|
78 | - ->optimizeAutoloader() |
|
79 | - ->run(); |
|
77 | + ->preferDist() |
|
78 | + ->optimizeAutoloader() |
|
79 | + ->run(); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | public function prepare() |
98 | 98 | { |
99 | 99 | $this->taskFileSystemStack() |
100 | - ->mkdir($this->properties['dist.dir']) |
|
101 | - ->mkdir($this->properties['target.dir']) |
|
102 | - ->mkdir(sprintf('%s/reports', $this->properties['target.dir'])) |
|
103 | - ->run(); |
|
100 | + ->mkdir($this->properties['dist.dir']) |
|
101 | + ->mkdir($this->properties['target.dir']) |
|
102 | + ->mkdir(sprintf('%s/reports', $this->properties['target.dir'])) |
|
103 | + ->run(); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | |
171 | 171 | // run PHPUnit |
172 | 172 | $this->taskPHPUnit(sprintf('%s/bin/phpunit', $this->properties['vendor.dir'])) |
173 | - ->configFile('phpunit.xml') |
|
174 | - ->run(); |
|
173 | + ->configFile('phpunit.xml') |
|
174 | + ->run(); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -116,7 +116,7 @@ |
||
116 | 116 | /** |
117 | 117 | * Return's the product bunch processor instance. |
118 | 118 | * |
119 | - * @return \TechDivision\Import\Product\Services\ProductBunchProcessorInterface The product bunch processor instance |
|
119 | + * @return ProductUrlRewriteProcessorInterface The product bunch processor instance |
|
120 | 120 | */ |
121 | 121 | protected function getProductUrlRewriteProcessor() |
122 | 122 | { |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | if ($this->storeViewHasBeenProcessed($sku, $storeViewCode)) { |
173 | 173 | // log a message |
174 | 174 | $this->getSubject() |
175 | - ->getSystemLogger() |
|
176 | - ->debug( |
|
177 | - sprintf( |
|
178 | - 'URL rewrites for SKU "%s" + store view code "%s" has already been processed', |
|
179 | - $sku, |
|
180 | - $storeViewCode |
|
181 | - ) |
|
182 | - ); |
|
175 | + ->getSystemLogger() |
|
176 | + ->debug( |
|
177 | + sprintf( |
|
178 | + 'URL rewrites for SKU "%s" + store view code "%s" has already been processed', |
|
179 | + $sku, |
|
180 | + $storeViewCode |
|
181 | + ) |
|
182 | + ); |
|
183 | 183 | |
184 | 184 | // return without creating any rewrites |
185 | 185 | return; |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | if ($storeViewCode === StoreViewCodes::ADMIN) { |
190 | 190 | // log a message and return |
191 | 191 | $this->getSubject() |
192 | - ->getSystemLogger() |
|
193 | - ->debug( |
|
194 | - sprintf( |
|
195 | - 'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"', |
|
196 | - $storeViewCode, |
|
197 | - $sku |
|
198 | - ) |
|
199 | - ); |
|
192 | + ->getSystemLogger() |
|
193 | + ->debug( |
|
194 | + sprintf( |
|
195 | + 'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"', |
|
196 | + $storeViewCode, |
|
197 | + $sku |
|
198 | + ) |
|
199 | + ); |
|
200 | 200 | |
201 | 201 | // return without creating any rewrites |
202 | 202 | return; |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | if (!$this->getSubject()->storeIsActive($storeViewCode)) { |
207 | 207 | // log a message and return |
208 | 208 | $this->getSubject() |
209 | - ->getSystemLogger() |
|
210 | - ->debug( |
|
211 | - sprintf( |
|
212 | - 'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"', |
|
213 | - $storeViewCode, |
|
214 | - $sku |
|
215 | - ) |
|
216 | - ); |
|
209 | + ->getSystemLogger() |
|
210 | + ->debug( |
|
211 | + sprintf( |
|
212 | + 'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"', |
|
213 | + $storeViewCode, |
|
214 | + $sku |
|
215 | + ) |
|
216 | + ); |
|
217 | 217 | |
218 | 218 | // return without creating any rewrites |
219 | 219 | return; |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | if (!$this->isVisible()) { |
230 | 230 | // log a message |
231 | 231 | $this->getSubject() |
232 | - ->getSystemLogger() |
|
233 | - ->debug( |
|
234 | - sprintf( |
|
235 | - 'Product with SKU "%s" is not visible, so no URL rewrites will be created', |
|
236 | - $sku |
|
237 | - ) |
|
238 | - ); |
|
232 | + ->getSystemLogger() |
|
233 | + ->debug( |
|
234 | + sprintf( |
|
235 | + 'Product with SKU "%s" is not visible, so no URL rewrites will be created', |
|
236 | + $sku |
|
237 | + ) |
|
238 | + ); |
|
239 | 239 | |
240 | 240 | // return without creating any rewrites |
241 | 241 | return; |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | // query whether or not debug mode has been enabled |
268 | 268 | if ($this->getSubject()->isDebugMode()) { |
269 | 269 | $this->getSubject() |
270 | - ->getSystemLogger() |
|
271 | - ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage())); |
|
270 | + ->getSystemLogger() |
|
271 | + ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage())); |
|
272 | 272 | } else { |
273 | 273 | throw $e; |
274 | 274 | } |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | // query whether or not debug mode has been enabled |
335 | 335 | if ($this->getSubject()->isDebugMode()) { |
336 | 336 | $this->getSubject() |
337 | - ->getSystemLogger() |
|
338 | - ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage())); |
|
337 | + ->getSystemLogger() |
|
338 | + ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage())); |
|
339 | 339 | } else { |
340 | 340 | throw $e; |
341 | 341 | } |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | $this->productCategoryIds[] = $categoryId; |
385 | 385 | } else { |
386 | 386 | $this->getSubject() |
387 | - ->getSystemLogger() |
|
388 | - ->debug(sprintf('Don\'t create URL rewrite for category "%s" because of missing anchor flag', $category[MemberNames::PATH])); |
|
387 | + ->getSystemLogger() |
|
388 | + ->debug(sprintf('Don\'t create URL rewrite for category "%s" because of missing anchor flag', $category[MemberNames::PATH])); |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | |
66 | 66 | // initialize a mock processor instance |
67 | 67 | $this->mockProductUrlRewriteProcessor = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface') |
68 | - ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')) |
|
69 | - ->getMock(); |
|
68 | + ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')) |
|
69 | + ->getMock(); |
|
70 | 70 | |
71 | 71 | // initialize the observer |
72 | 72 | $this->observer = new UrlRewriteObserver($this->mockProductUrlRewriteProcessor); |
@@ -250,28 +250,28 @@ discard block |
||
250 | 250 | |
251 | 251 | // initialize the categories |
252 | 252 | $categories = array( |
253 | - $path1 = 'Default Category' => array(MemberNames::ENTITY_ID => 2, MemberNames::PARENT_ID => 1, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => null, MemberNames::PATH => $path1), |
|
254 | - $path2 = 'Default Category/Men' => array(MemberNames::ENTITY_ID => 3, MemberNames::PARENT_ID => 2, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men', MemberNames::PATH => $path2), |
|
255 | - $path3 = 'Default Category/Men/Tops' => array(MemberNames::ENTITY_ID => 4, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men', MemberNames::PATH => $path3), |
|
256 | - $path4 = 'Default Category/Men/Tops/Hoodies & Sweatshirts' => array(MemberNames::ENTITY_ID => 5, MemberNames::PARENT_ID => 4, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men/hoodies-and-sweatshirts-men', MemberNames::PATH => $path4), |
|
257 | - $path5 = 'Default Category/Collections' => array(MemberNames::ENTITY_ID => 6, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections', MemberNames::PATH => $path5), |
|
258 | - $path6 = 'Default Category/Collections/Eco Friendly' => array(MemberNames::ENTITY_ID => 7, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/eco-friendly', MemberNames::PATH => $path6), |
|
253 | + $path1 = 'Default Category' => array(MemberNames::ENTITY_ID => 2, MemberNames::PARENT_ID => 1, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => null, MemberNames::PATH => $path1), |
|
254 | + $path2 = 'Default Category/Men' => array(MemberNames::ENTITY_ID => 3, MemberNames::PARENT_ID => 2, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men', MemberNames::PATH => $path2), |
|
255 | + $path3 = 'Default Category/Men/Tops' => array(MemberNames::ENTITY_ID => 4, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men', MemberNames::PATH => $path3), |
|
256 | + $path4 = 'Default Category/Men/Tops/Hoodies & Sweatshirts' => array(MemberNames::ENTITY_ID => 5, MemberNames::PARENT_ID => 4, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men/hoodies-and-sweatshirts-men', MemberNames::PATH => $path4), |
|
257 | + $path5 = 'Default Category/Collections' => array(MemberNames::ENTITY_ID => 6, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections', MemberNames::PATH => $path5), |
|
258 | + $path6 = 'Default Category/Collections/Eco Friendly' => array(MemberNames::ENTITY_ID => 7, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/eco-friendly', MemberNames::PATH => $path6), |
|
259 | 259 | ); |
260 | 260 | |
261 | 261 | // create a mock configuration |
262 | 262 | $mockSubjectConfiguration = $this->getMockBuilder('TechDivision\Import\Configuration\SubjectConfigurationInterface') |
263 | - ->setMethods(get_class_methods('TechDivision\Import\Configuration\SubjectConfigurationInterface')) |
|
264 | - ->getMock(); |
|
263 | + ->setMethods(get_class_methods('TechDivision\Import\Configuration\SubjectConfigurationInterface')) |
|
264 | + ->getMock(); |
|
265 | 265 | |
266 | 266 | // mock the methods |
267 | 267 | $mockSubjectConfiguration->expects($this->once()) |
268 | - ->method('getDelimiter') |
|
269 | - ->willReturn(','); |
|
268 | + ->method('getDelimiter') |
|
269 | + ->willReturn(','); |
|
270 | 270 | |
271 | 271 | // mock the system logger |
272 | 272 | $mockSystemLogger = $this->getMockBuilder('Psr\Log\LoggerInterface') |
273 | - ->setMethods(get_class_methods('Psr\Log\LoggerInterface')) |
|
274 | - ->getMock(); |
|
273 | + ->setMethods(get_class_methods('Psr\Log\LoggerInterface')) |
|
274 | + ->getMock(); |
|
275 | 275 | |
276 | 276 | // create a mock subject |
277 | 277 | $mockSubject = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Subjects\UrlRewriteSubject') |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | |
66 | 66 | // initialize a mock processor instance |
67 | 67 | $this->mockProductUrlRewriteProcessor = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface') |
68 | - ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')) |
|
69 | - ->getMock(); |
|
68 | + ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')) |
|
69 | + ->getMock(); |
|
70 | 70 | |
71 | 71 | // initialize the observer |
72 | 72 | $this->observer = new UrlRewriteUpdateObserver($this->mockProductUrlRewriteProcessor); |
@@ -103,30 +103,30 @@ discard block |
||
103 | 103 | |
104 | 104 | // initialize the categories |
105 | 105 | $categories = array( |
106 | - $path1 = 'Default Category' => array(MemberNames::ENTITY_ID => 2, MemberNames::PARENT_ID => 1, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => null, MemberNames::PATH => $path1), |
|
107 | - $path2 = 'Default Category/Men' => array(MemberNames::ENTITY_ID => 3, MemberNames::PARENT_ID => 2, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men', MemberNames::PATH => $path2), |
|
108 | - $path3 = 'Default Category/Men/Tops' => array(MemberNames::ENTITY_ID => 4, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men', MemberNames::PATH => $path3), |
|
109 | - $path4 = 'Default Category/Men/Tops/Hoodies & Sweatshirts' => array(MemberNames::ENTITY_ID => 5, MemberNames::PARENT_ID => 4, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men/hoodies-and-sweatshirts-men', MemberNames::PATH => $path4), |
|
110 | - $path5 = 'Default Category/Collections' => array(MemberNames::ENTITY_ID => 6, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections', MemberNames::PATH => $path5), |
|
111 | - $path6 = 'Default Category/Collections/Eco Friendly' => array(MemberNames::ENTITY_ID => 7, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/eco-friendly', MemberNames::PATH => $path6), |
|
112 | - $path7 = 'Default Category/Collections/Old' => array(MemberNames::ENTITY_ID => 8, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/old', MemberNames::PATH => $path7), |
|
113 | - $path8 = 'Default Category/Men/Old' => array(MemberNames::ENTITY_ID => 9, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/old', MemberNames::PATH => $path8), |
|
106 | + $path1 = 'Default Category' => array(MemberNames::ENTITY_ID => 2, MemberNames::PARENT_ID => 1, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => null, MemberNames::PATH => $path1), |
|
107 | + $path2 = 'Default Category/Men' => array(MemberNames::ENTITY_ID => 3, MemberNames::PARENT_ID => 2, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men', MemberNames::PATH => $path2), |
|
108 | + $path3 = 'Default Category/Men/Tops' => array(MemberNames::ENTITY_ID => 4, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men', MemberNames::PATH => $path3), |
|
109 | + $path4 = 'Default Category/Men/Tops/Hoodies & Sweatshirts' => array(MemberNames::ENTITY_ID => 5, MemberNames::PARENT_ID => 4, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/tops-men/hoodies-and-sweatshirts-men', MemberNames::PATH => $path4), |
|
110 | + $path5 = 'Default Category/Collections' => array(MemberNames::ENTITY_ID => 6, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections', MemberNames::PATH => $path5), |
|
111 | + $path6 = 'Default Category/Collections/Eco Friendly' => array(MemberNames::ENTITY_ID => 7, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/eco-friendly', MemberNames::PATH => $path6), |
|
112 | + $path7 = 'Default Category/Collections/Old' => array(MemberNames::ENTITY_ID => 8, MemberNames::PARENT_ID => 6, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'collections/old', MemberNames::PATH => $path7), |
|
113 | + $path8 = 'Default Category/Men/Old' => array(MemberNames::ENTITY_ID => 9, MemberNames::PARENT_ID => 3, MemberNames::IS_ANCHOR => null, MemberNames::URL_PATH => 'men/old', MemberNames::PATH => $path8), |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | // create a mock configuration |
117 | 117 | $mockSubjectConfiguration = $this->getMockBuilder('TechDivision\Import\Configuration\SubjectConfigurationInterface') |
118 | - ->setMethods(get_class_methods('TechDivision\Import\Configuration\SubjectConfigurationInterface')) |
|
119 | - ->getMock(); |
|
118 | + ->setMethods(get_class_methods('TechDivision\Import\Configuration\SubjectConfigurationInterface')) |
|
119 | + ->getMock(); |
|
120 | 120 | |
121 | 121 | // mock the methods |
122 | 122 | $mockSubjectConfiguration->expects($this->once()) |
123 | - ->method('getDelimiter') |
|
124 | - ->willReturn(','); |
|
123 | + ->method('getDelimiter') |
|
124 | + ->willReturn(','); |
|
125 | 125 | |
126 | 126 | // mock the system logger |
127 | 127 | $mockSystemLogger = $this->getMockBuilder('Psr\Log\LoggerInterface') |
128 | - ->setMethods(get_class_methods('Psr\Log\LoggerInterface')) |
|
129 | - ->getMock(); |
|
128 | + ->setMethods(get_class_methods('Psr\Log\LoggerInterface')) |
|
129 | + ->getMock(); |
|
130 | 130 | |
131 | 131 | // the found URL rewrites |
132 | 132 | $urlRewrites = array( |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ->method('getUrlRewritesByEntityTypeAndEntityIdAndStoreId') |
313 | 313 | ->with(UrlRewriteObserver::ENTITY_TYPE, $entityId, $storeId) |
314 | 314 | ->willReturn($urlRewrites); |
315 | - $this->mockProductUrlRewriteProcessor->expects($this->exactly(6)) |
|
315 | + $this->mockProductUrlRewriteProcessor->expects($this->exactly(6)) |
|
316 | 316 | ->method('persistUrlRewrite') |
317 | 317 | ->withConsecutive( |
318 | 318 | array( |
@@ -151,7 +151,7 @@ |
||
151 | 151 | * Commits a transaction, returning the database connection to autocommit mode until the next call to |
152 | 152 | * ProductProcessor::beginTransaction() starts a new transaction. |
153 | 153 | * |
154 | - * @return boolean Returns TRUE on success or FALSE on failure |
|
154 | + * @return boolean|null Returns TRUE on success or FALSE on failure |
|
155 | 155 | * @link http://php.net/manual/en/pdo.commit.php |
156 | 156 | */ |
157 | 157 | public function commit() |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | // finally log a warning that the old category is not available ony more |
99 | 99 | $this->getSubject() |
100 | - ->getSystemLogger() |
|
101 | - ->warning(sprintf('Category with ID %d is not longer available', $metadata[UrlRewriteObserver::CATEGORY_ID])); |
|
100 | + ->getSystemLogger() |
|
101 | + ->warning(sprintf('Category with ID %d is not longer available', $metadata[UrlRewriteObserver::CATEGORY_ID])); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | |
122 | 122 | // log a message, that old URL rewrites have been cleaned-up |
123 | 123 | $this->getSubject() |
124 | - ->getSystemLogger() |
|
125 | - ->warning( |
|
126 | - sprintf( |
|
127 | - 'Cleaned-up %d URL rewrite "%s" for product with SKU "%s"', |
|
128 | - $existingUrlRewrite[MemberNames::REQUEST_PATH], |
|
129 | - $this->getValue(ColumnKeys::SKU) |
|
130 | - ) |
|
131 | - ); |
|
124 | + ->getSystemLogger() |
|
125 | + ->warning( |
|
126 | + sprintf( |
|
127 | + 'Cleaned-up %d URL rewrite "%s" for product with SKU "%s"', |
|
128 | + $existingUrlRewrite[MemberNames::REQUEST_PATH], |
|
129 | + $this->getValue(ColumnKeys::SKU) |
|
130 | + ) |
|
131 | + ); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |