@@ -93,8 +93,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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)); |
@@ -103,12 +103,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |