Completed
Push — 24.x ( 29905b...c80b29 )
by Tim
01:33
created
tests/unit/Observers/UrlRewriteObserverTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         $mockSubject->expects($this->any())
457 457
                     ->method('getCategory')
458 458
                     ->will(
459
-                        $this->returnCallback(function ($categoryId, $storeViewCode) use ($categories) {
459
+                        $this->returnCallback(function($categoryId, $storeViewCode) use ($categories) {
460 460
                             foreach ($categories as $category) {
461 461
                                 if ((int) $category[MemberNames::ENTITY_ID] === (int) $categoryId) {
462 462
                                     return $category;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
         $mockSubject->expects($this->any())
484 484
                     ->method('getCoreConfigData')
485 485
                     ->will(
486
-                        $this->returnCallback(function ($arg1, $arg2) {
486
+                        $this->returnCallback(function($arg1, $arg2) {
487 487
                             return $arg2;
488 488
                         })
489 489
                     );
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 
70 70
         // initialize a mock processor instance
71 71
         $this->mockProductUrlRewriteProcessor = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')
72
-                                                     ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface'))
73
-                                                     ->getMock();
72
+                                                        ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface'))
73
+                                                        ->getMock();
74 74
 
75 75
         // initialize the observer
76 76
         $this->observer = new UrlRewriteObserver($this->mockProductUrlRewriteProcessor);
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 
371 371
         // mock the system logger
372 372
         $mockSystemLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')
373
-                                 ->setMethods(get_class_methods('Psr\Log\LoggerInterface'))
374
-                                 ->getMock();
373
+                                    ->setMethods(get_class_methods('Psr\Log\LoggerInterface'))
374
+                                    ->getMock();
375 375
 
376 376
         // create a mock subject
377 377
         $mockSubject = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Subjects\UrlRewriteSubject')
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                             return $arg2;
481 481
                         })
482 482
                     );
483
-       $mockSubject->expects(($this->any()))
483
+        $mockSubject->expects(($this->any()))
484 484
                     ->method('getImportAdapter')
485 485
                     ->willReturn($mockImportAdapter);
486 486
 
Please login to merge, or discard this patch.
src/Observers/UrlRewriteObserver.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
         if ($storeViewCode === StoreViewCodes::ADMIN) {
229 229
             // log a message and return
230 230
             $this->getSubject()
231
-                 ->getSystemLogger()
232
-                 ->debug(
233
-                     sprintf(
234
-                         'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"',
235
-                         $storeViewCode,
236
-                         $sku
237
-                     )
238
-                 );
231
+                    ->getSystemLogger()
232
+                    ->debug(
233
+                        sprintf(
234
+                            'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"',
235
+                            $storeViewCode,
236
+                            $sku
237
+                        )
238
+                    );
239 239
 
240 240
             // return without creating any rewrites
241 241
             return $this->getRow();
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
         if (!$this->getSubject()->storeIsActive($storeViewCode)) {
246 246
             // log a message and return
247 247
             $this->getSubject()
248
-                 ->getSystemLogger()
249
-                 ->debug(
250
-                     sprintf(
251
-                         'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"',
252
-                         $storeViewCode,
253
-                         $sku
254
-                     )
255
-                 );
248
+                    ->getSystemLogger()
249
+                    ->debug(
250
+                        sprintf(
251
+                            'Store with code "%s" is not active, no URL rewrites will be created for product with SKU "%s"',
252
+                            $storeViewCode,
253
+                            $sku
254
+                        )
255
+                    );
256 256
 
257 257
             // return without creating any rewrites
258 258
             return $this->getRow();
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
                     // query whether or not debug mode has been enabled
312 312
                     if ($this->getSubject()->isDebugMode()) {
313 313
                         $this->getSubject()
314
-                             ->getSystemLogger()
315
-                             ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
314
+                                ->getSystemLogger()
315
+                                ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
316 316
                     } else {
317 317
                         throw $e;
318 318
                     }
@@ -361,18 +361,18 @@  discard block
 block discarded – undo
361 361
         // do NOT create new URL rewrites, if the product is NOT visible (any more), BUT
362 362
         // handle existing URL rewrites, e. g. to remove and clean up the URL rewrites
363 363
         if (!$this->isVisible()) {
364
-             // log a message
365
-             $this->getSubject()
366
-                 ->getSystemLogger()
367
-                 ->debug(
368
-                     sprintf(
369
-                         'Product with SKU "%s" is not visible, so no URL rewrites will be created',
370
-                         $this->getValue(ColumnKeys::SKU)
371
-                     )
372
-                 );
373
-
374
-             // return without creating any rewrites
375
-             return;
364
+                // log a message
365
+                $this->getSubject()
366
+                    ->getSystemLogger()
367
+                    ->debug(
368
+                        sprintf(
369
+                            'Product with SKU "%s" is not visible, so no URL rewrites will be created',
370
+                            $this->getValue(ColumnKeys::SKU)
371
+                        )
372
+                    );
373
+
374
+                // return without creating any rewrites
375
+                return;
376 376
         }
377 377
 
378 378
         // load the root category of the default store view (as we're in the
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
                 // query whether or not debug mode has been enabled
401 401
                 if ($this->getSubject()->isDebugMode()) {
402 402
                     $this->getSubject()
403
-                         ->getSystemLogger()
404
-                         ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
403
+                            ->getSystemLogger()
404
+                            ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
405 405
                 } else {
406 406
                     throw $e;
407 407
                 }
Please login to merge, or discard this patch.
tests/unit/Observers/UrlRewriteUpdateObserverTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         $mockSubject->expects($this->any())
457 457
                     ->method('getCategory')
458 458
                     ->will(
459
-                        $this->returnCallback(function ($categoryId, $storeViewCode) use ($categories) {
459
+                        $this->returnCallback(function($categoryId, $storeViewCode) use ($categories) {
460 460
                             foreach ($categories as $category) {
461 461
                                 if ((int) $category[MemberNames::ENTITY_ID] === (int) $categoryId) {
462 462
                                     return $category;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
         $mockSubject->expects($this->any())
484 484
                     ->method('getCoreConfigData')
485 485
                     ->will(
486
-                        $this->returnCallback(function ($arg1, $arg2) {
486
+                        $this->returnCallback(function($arg1, $arg2) {
487 487
                             return $arg2;
488 488
                         })
489 489
                     );
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
         // initialize a mock processor instance
68 68
         $this->mockProductUrlRewriteProcessor = $this->getMockBuilder('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface')
69
-                                                     ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface'))
70
-                                                     ->getMock();
69
+                                                        ->setMethods(get_class_methods('TechDivision\Import\Product\UrlRewrite\Services\ProductUrlRewriteProcessorInterface'))
70
+                                                        ->getMock();
71 71
 
72 72
         // initialize the observer
73 73
         $this->observer = new UrlRewriteUpdateObserver($this->mockProductUrlRewriteProcessor);
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 
134 134
         // mock the system logger
135 135
         $mockSystemLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')
136
-                                 ->setMethods(get_class_methods('Psr\Log\LoggerInterface'))
137
-                                 ->getMock();
136
+                                    ->setMethods(get_class_methods('Psr\Log\LoggerInterface'))
137
+                                    ->getMock();
138 138
 
139 139
         // the found URL rewrites
140 140
         $urlRewrites = array(
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                     ->method('getUrlRewritesByEntityTypeAndEntityIdAndStoreId')
297 297
                     ->with(UrlRewriteObserver::ENTITY_TYPE, $entityId, $storeId)
298 298
                     ->willReturn($urlRewrites);
299
-       $this->mockProductUrlRewriteProcessor->expects($this->exactly(6))
299
+        $this->mockProductUrlRewriteProcessor->expects($this->exactly(6))
300 300
                     ->method('persistUrlRewrite')
301 301
                     ->withConsecutive(
302 302
                         array(
Please login to merge, or discard this patch.