예제 #1
0
 /**
  * @dataProvider isValidAddMessagesCallDataProvider
  *
  * @param array $value
  * @param bool  $hasEmptyColumns
  * @param array $customerGroups
  * @param array $expectedMessages
  */
 public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages)
 {
     $this->tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true);
     $this->tierPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns);
     $this->setPropertyValue($this->tierPrice, 'customerGroups', $customerGroups);
     $this->tierPrice->expects($this->once())->method('_addMessages')->with($expectedMessages);
     $this->tierPrice->isValid($value);
 }
예제 #2
0
 /**
  * @dataProvider isValidAddMessagesCallDataProvider
  *
  * @param array $value
  * @param bool  $hasEmptyColumns
  * @param array $customerGroups
  * @param array $expectedMessages
  */
 public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages)
 {
     $priceContextMock = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product', [], ['\\Magento\\Framework\\Json\\Helper\\Data', '\\Magento\\ImportExport\\Helper\\Data', '\\Magento\\ImportExport\\Model\\ResourceModel\\Import\\Data', '\\Magento\\Eav\\Model\\Config', '\\Magento\\Framework\\App\\ResourceConnection', '\\Magento\\ImportExport\\Model\\ResourceModel\\Helper', '\\Magento\\Framework\\Stdlib\\StringUtils', 'ProcessingErrorAggregatorInterface'], '', false);
     $this->tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true);
     $this->tierPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns);
     $this->setPropertyValue($this->tierPrice, 'customerGroups', $customerGroups);
     $searchCriteria = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria);
     $groupSearchResult = $this->getMockForAbstractClass('\\Magento\\Customer\\Api\\Data\\GroupSearchResultsInterface', [], '', false);
     $this->groupRepository->expects($this->any())->method('getList')->with($searchCriteria)->willReturn($groupSearchResult);
     $groupTest = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\GroupInterface')->disableOriginalConstructor()->setMethods(['getCode', 'getId'])->getMockForAbstractClass();
     $groupTest->expects($this->once())->method('getCode');
     $groupTest->expects($this->any())->method('getId');
     $groups = [$groupTest];
     $groupSearchResult->expects($this->any())->method('getItems')->willReturn($groups);
     $this->tierPrice->init($priceContextMock);
     $this->tierPrice->isValid($value);
 }