Skip to content

Commit 71c540a

Browse files
committed
MAGETWO-92693: Some improvements on product create|edit page in admin area
1 parent ba9b9f4 commit 71c540a

File tree

1 file changed

+26
-52
lines changed
  • app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier

1 file changed

+26
-52
lines changed

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -386,94 +386,68 @@ public function testModifyData()
386386
]
387387
];
388388

389-
$this->attributeCollectionFactoryMock->expects($this->once())
390-
->method('create')
389+
$this->attributeCollectionFactoryMock->expects($this->once())->method('create')
391390
->willReturn($this->attributeCollectionMock);
392391

393-
$this->attributeCollectionMock->expects($this->any())
394-
->method('getItems')
392+
$this->attributeCollectionMock->expects($this->any())->method('getItems')
395393
->willReturn([
396394
$this->eavAttributeMock
397395
]);
398396

399-
$this->locatorMock->expects($this->any())
400-
->method('getProduct')
397+
$this->locatorMock->expects($this->any())->method('getProduct')
401398
->willReturn($this->productMock);
402399

403-
$this->productMock->expects($this->any())
404-
->method('getId')
400+
$this->productMock->expects($this->any())->method('getId')
405401
->willReturn(1);
406-
$this->productMock->expects($this->once())
407-
->method('getAttributeSetId')
402+
$this->productMock->expects($this->once())->method('getAttributeSetId')
408403
->willReturn(4);
409-
$this->productMock->expects($this->once())
410-
->method('getData')
404+
$this->productMock->expects($this->once())->method('getData')
411405
->with(ProductAttributeInterface::CODE_PRICE)->willReturn('19.9900');
412406

413-
$this->searchCriteriaBuilderMock->expects($this->any())
414-
->method('addFilter')
407+
$this->searchCriteriaBuilderMock->expects($this->any())->method('addFilter')
415408
->willReturnSelf();
416-
$this->searchCriteriaBuilderMock->expects($this->any())
417-
->method('create')
409+
$this->searchCriteriaBuilderMock->expects($this->any())->method('create')
418410
->willReturn($this->searchCriteriaMock);
419-
$this->attributeGroupRepositoryMock->expects($this->any())
420-
->method('getList')
411+
$this->attributeGroupRepositoryMock->expects($this->any())->method('getList')
421412
->willReturn($this->searchCriteriaMock);
422-
$this->searchCriteriaMock->expects($this->once())
423-
->method('getItems')
413+
$this->searchCriteriaMock->expects($this->once())->method('getItems')
424414
->willReturn([$this->attributeGroupMock]);
425-
$this->sortOrderBuilderMock->expects($this->once())
426-
->method('setField')
415+
$this->sortOrderBuilderMock->expects($this->once())->method('setField')
427416
->willReturnSelf();
428-
$this->sortOrderBuilderMock->expects($this->once())
429-
->method('setAscendingDirection')
417+
$this->sortOrderBuilderMock->expects($this->once())->method('setAscendingDirection')
430418
->willReturnSelf();
431419
$dataObjectMock = $this->createMock(\Magento\Framework\Api\AbstractSimpleObject::class);
432-
$this->sortOrderBuilderMock->expects($this->once())
433-
->method('create')
420+
$this->sortOrderBuilderMock->expects($this->once())->method('create')
434421
->willReturn($dataObjectMock);
435422

436-
$this->searchCriteriaBuilderMock->expects($this->any())
437-
->method('addFilter')
423+
$this->searchCriteriaBuilderMock->expects($this->any())->method('addFilter')
438424
->willReturnSelf();
439-
$this->searchCriteriaBuilderMock->expects($this->once())
440-
->method('addSortOrder')
425+
$this->searchCriteriaBuilderMock->expects($this->once())->method('addSortOrder')
441426
->willReturnSelf();
442-
$this->searchCriteriaBuilderMock->expects($this->any())
443-
->method('create')
427+
$this->searchCriteriaBuilderMock->expects($this->any())->method('create')
444428
->willReturn($this->searchCriteriaMock);
445429

446-
$this->attributeRepositoryMock->expects($this->once())
447-
->method('getList')
430+
$this->attributeRepositoryMock->expects($this->once())->method('getList')
448431
->with($this->searchCriteriaMock)
449432
->willReturn($this->searchResultsMock);
450-
$this->eavAttributeMock->expects($this->any())
451-
->method('getAttributeGroupCode')
433+
$this->eavAttributeMock->expects($this->any())->method('getAttributeGroupCode')
452434
->willReturn('product-details');
453-
$this->eavAttributeMock->expects($this->once())
454-
->method('getApplyTo')
435+
$this->eavAttributeMock->expects($this->once())->method('getApplyTo')
455436
->willReturn([]);
456-
$this->eavAttributeMock->expects($this->once())
457-
->method('getFrontendInput')
437+
$this->eavAttributeMock->expects($this->once())->method('getFrontendInput')
458438
->willReturn('price');
459-
$this->eavAttributeMock->expects($this->any())
460-
->method('getAttributeCode')
439+
$this->eavAttributeMock->expects($this->any())->method('getAttributeCode')
461440
->willReturn(ProductAttributeInterface::CODE_PRICE);
462-
$this->searchResultsMock->expects($this->once())
463-
->method('getItems')
441+
$this->searchResultsMock->expects($this->once())->method('getItems')
464442
->willReturn([$this->eavAttributeMock]);
465443

466-
$this->storeMock->expects(($this->once()))
467-
->method('getBaseCurrencyCode')
444+
$this->storeMock->expects(($this->once()))->method('getBaseCurrencyCode')
468445
->willReturn('en_US');
469-
$this->storeManagerMock->expects($this->once())
470-
->method('getStore')
446+
$this->storeManagerMock->expects($this->once())->method('getStore')
471447
->willReturn($this->storeMock);
472-
$this->currencyMock->expects($this->once())
473-
->method('toCurrency')
448+
$this->currencyMock->expects($this->once())->method('toCurrency')
474449
->willReturn('19.99');
475-
$this->currencyLocaleMock->expects($this->once())
476-
->method('getCurrency')
450+
$this->currencyLocaleMock->expects($this->once())->method('getCurrency')
477451
->willReturn($this->currencyMock);
478452

479453
$this->assertEquals($sourceData, $this->eav->modifyData([]));

0 commit comments

Comments
 (0)