Completed
Push — master ( 38fd1a...92fc18 )
by Tim
02:53 queued 16s
created
tests/unit/Observers/CatalogAttributeObserverTest.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 
94 94
         // mock the attribute bunch processor
95 95
         $this->mockBunchProcessor = $this->getMockBuilder('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface')
96
-                                         ->setMethods(get_class_methods('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface'))
97
-                                         ->getMock();
96
+                                            ->setMethods(get_class_methods('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface'))
97
+                                            ->getMock();
98 98
 
99 99
         // the observer instance we want to test
100 100
         $this->observer = new CatalogAttributeObserver($this->mockBunchProcessor);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                         array(ColumnKeys::IS_FILTERABLE_IN_GRID),
149 149
                         array(ColumnKeys::SEARCH_WEIGHT),
150 150
                         array(ColumnKeys::ADDITIONAL_DATA)
151
-                     )
151
+                        )
152 152
                     ->willReturnOnConsecutiveCalls(
153 153
                         true,
154 154
                         false,
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
 
191 191
         // mock the method that persists the entity
192 192
         $this->mockBunchProcessor->expects($this->once())
193
-                                 ->method('persistCatalogAttribute')
194
-                                 ->with(
195
-                                     array_merge(
196
-                                         array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
197
-                                         $this->rawEntity,
198
-                                         array(EntityStatus::MEMBER_NAME => EntityStatus::STATUS_CREATE)
199
-                                     )
200
-                                 )
201
-                                 ->willReturn(null);
193
+                                    ->method('persistCatalogAttribute')
194
+                                    ->with(
195
+                                        array_merge(
196
+                                            array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
197
+                                            $this->rawEntity,
198
+                                            array(EntityStatus::MEMBER_NAME => EntityStatus::STATUS_CREATE)
199
+                                        )
200
+                                    )
201
+                                    ->willReturn(null);
202 202
         $this->mockBunchProcessor->expects($this->once())
203
-                                 ->method('loadRawEntity')
204
-                                 ->willReturn(
205
-                                     array_merge(
206
-                                         array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
207
-                                         $this->rawEntity
208
-                                     )
209
-                                 );
203
+                                    ->method('loadRawEntity')
204
+                                    ->willReturn(
205
+                                        array_merge(
206
+                                            array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
207
+                                            $this->rawEntity
208
+                                        )
209
+                                    );
210 210
 
211 211
         // invoke the handle method
212 212
         $this->assertSame($row, $this->observer->handle($mockSubject));
Please login to merge, or discard this patch.
tests/unit/Observers/CatalogAttributeUpdateObserverTest.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 
104 104
         // mock the attribute bunch processor
105 105
         $this->mockBunchProcessor = $this->getMockBuilder(AttributeBunchProcessorInterface::class)
106
-                                         ->setMethods(get_class_methods(AttributeBunchProcessorInterface::class))
107
-                                         ->getMock();
106
+                                            ->setMethods(get_class_methods(AttributeBunchProcessorInterface::class))
107
+                                            ->getMock();
108 108
 
109 109
         $this->mockEntityMerger = $this->getMockBuilder(EntityMergerInterface::class)
110
-                                       ->setMethods(get_class_methods(EntityMergerInterface::class))
111
-                                       ->getMock();
110
+                                        ->setMethods(get_class_methods(EntityMergerInterface::class))
111
+                                        ->getMock();
112 112
 
113 113
         // the observer instance we want to test
114 114
         $this->observer = new CatalogAttributeUpdateObserver($this->mockBunchProcessor, $this->mockEntityMerger);
@@ -190,36 +190,36 @@  discard block
 block discarded – undo
190 190
 
191 191
         // mock the method that loads the existing entity
192 192
         $this->mockBunchProcessor->expects($this->once())
193
-                                 ->method('loadCatalogAttribute')
194
-                                 ->with($lastAttributeId)
195
-                                 ->willReturn($existingEntity);
193
+                                    ->method('loadCatalogAttribute')
194
+                                    ->with($lastAttributeId)
195
+                                    ->willReturn($existingEntity);
196 196
         // mock the method that persists the entity
197 197
         $this->mockBunchProcessor->expects($this->once())
198
-                                 ->method('persistCatalogAttribute')
199
-                                 ->with($expectedEntity)
200
-                                 ->willReturn(null);
198
+                                    ->method('persistCatalogAttribute')
199
+                                    ->with($expectedEntity)
200
+                                    ->willReturn(null);
201 201
         // mock the method that loads the raw entity
202 202
         $this->mockBunchProcessor->expects($this->once())
203
-                                 ->method('loadRawEntity')
204
-                                 ->willReturn(
205
-                                     array_merge(
206
-                                         array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
207
-                                         $this->rawEntity
208
-                                     )
209
-                                 );
203
+                                    ->method('loadRawEntity')
204
+                                    ->willReturn(
205
+                                        array_merge(
206
+                                            array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
207
+                                            $this->rawEntity
208
+                                        )
209
+                                    );
210 210
 
211 211
         // mock the entity merger method
212 212
         $this->mockEntityMerger->expects($this->any())
213
-             ->method('merge')
214
-             ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
215
-                 foreach (array_keys($attr) as $key) {
216
-                     if (isset($headers[$key])) {
217
-                         continue;
218
-                     }
219
-                     unset($attr[$key]);
220
-                 }
221
-                 return $attr;
222
-             });
213
+                ->method('merge')
214
+                ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
215
+                    foreach (array_keys($attr) as $key) {
216
+                        if (isset($headers[$key])) {
217
+                            continue;
218
+                        }
219
+                        unset($attr[$key]);
220
+                    }
221
+                    return $attr;
222
+                });
223 223
 
224 224
         // invoke the handle method
225 225
         $this->assertSame($row, $this->observer->handle($mockSubject));
@@ -403,36 +403,36 @@  discard block
 block discarded – undo
403 403
 
404 404
         // mock the method that loads the existing entity
405 405
         $this->mockBunchProcessor->expects($this->once())
406
-                                 ->method('loadCatalogAttribute')
407
-                                 ->with($lastAttributeId)
408
-                                 ->willReturn($existingEntity);
406
+                                    ->method('loadCatalogAttribute')
407
+                                    ->with($lastAttributeId)
408
+                                    ->willReturn($existingEntity);
409 409
         // mock the method that persists the entity
410 410
         $this->mockBunchProcessor->expects($this->once())
411
-                                 ->method('persistCatalogAttribute')
412
-                                 ->with($expectedEntity)
413
-                                 ->willReturn(null);
411
+                                    ->method('persistCatalogAttribute')
412
+                                    ->with($expectedEntity)
413
+                                    ->willReturn(null);
414 414
         // mock the method that loads the raw entity
415 415
         $this->mockBunchProcessor->expects($this->once())
416
-                                 ->method('loadRawEntity')
417
-                                 ->willReturn(
418
-                                     array_merge(
419
-                                         array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
420
-                                         $this->rawEntity
421
-                                     )
422
-                                 );
416
+                                    ->method('loadRawEntity')
417
+                                    ->willReturn(
418
+                                        array_merge(
419
+                                            array(MemberNames::ATTRIBUTE_ID => $lastAttributeId),
420
+                                            $this->rawEntity
421
+                                        )
422
+                                    );
423 423
 
424 424
         // mock the entity merger method
425 425
         $this->mockEntityMerger->expects($this->any())
426
-             ->method('merge')
427
-             ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
428
-                 foreach (array_keys($attr) as $key) {
429
-                     if (isset($headers[$key])) {
430
-                         continue;
431
-                     }
432
-                     unset($attr[$key]);
433
-                 }
434
-                 return $attr;
435
-             });
426
+                ->method('merge')
427
+                ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
428
+                    foreach (array_keys($attr) as $key) {
429
+                        if (isset($headers[$key])) {
430
+                            continue;
431
+                        }
432
+                        unset($attr[$key]);
433
+                    }
434
+                    return $attr;
435
+                });
436 436
         // invoke the handle method
437 437
         $this->assertSame($row, $this->observer->handle($mockSubject));
438 438
     }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
                     ->willReturn($row);
138 138
         $mockSubject->expects($this->any())
139 139
                     ->method('hasHeader')
140
-                    ->willReturnCallback(function ($key) use ($headers) {
140
+                    ->willReturnCallback(function($key) use ($headers) {
141 141
                         return array_key_exists($key, $headers);
142 142
                     });
143 143
         $mockSubject->expects($this->any())
144 144
                     ->method('getHeader')
145
-                    ->willReturnCallback(function ($key) use ($headers) {
145
+                    ->willReturnCallback(function($key) use ($headers) {
146 146
                         if (array_key_exists($key, $headers)) {
147 147
                             return $headers[$key];
148 148
                         }
149
-                        throw new \InvalidArgumentException(sprintf('Header %s is not available', $key));;
149
+                        throw new \InvalidArgumentException(sprintf('Header %s is not available', $key)); ;
150 150
                     });
151 151
         $mockSubject->expects($this->once())
152 152
                     ->method('hasBeenProcessed')
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         // mock the entity merger method
212 212
         $this->mockEntityMerger->expects($this->any())
213 213
              ->method('merge')
214
-             ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
214
+             ->willReturnCallback(function($observer, $entity, $attr) use ($headers) {
215 215
                  foreach (array_keys($attr) as $key) {
216 216
                      if (isset($headers[$key])) {
217 217
                          continue;
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
                     ->willReturn($lastAttributeId = 1001);
332 332
         $mockSubject->expects($this->any())
333 333
                     ->method('hasHeader')
334
-                    ->willReturnCallback(function ($key) use ($headers) {
334
+                    ->willReturnCallback(function($key) use ($headers) {
335 335
                         return array_key_exists($key, $headers);
336 336
                     });
337 337
         $mockSubject->expects($this->any())
338 338
                     ->method('getHeader')
339
-                    ->willReturnCallback(function ($key) use ($headers) {
339
+                    ->willReturnCallback(function($key) use ($headers) {
340 340
                         if (array_key_exists($key, $headers)) {
341 341
                             return $headers[$key];
342 342
                         }
343
-                        throw new \InvalidArgumentException(sprintf('Header %s is not available', $key));;
343
+                        throw new \InvalidArgumentException(sprintf('Header %s is not available', $key)); ;
344 344
                     });
345 345
 
346 346
         // initialize the existing entity
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         // mock the entity merger method
425 425
         $this->mockEntityMerger->expects($this->any())
426 426
              ->method('merge')
427
-             ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) {
427
+             ->willReturnCallback(function($observer, $entity, $attr) use ($headers) {
428 428
                  foreach (array_keys($attr) as $key) {
429 429
                      if (isset($headers[$key])) {
430 430
                          continue;
Please login to merge, or discard this patch.