public function testPrepareDataSource()
 {
     $dataSource = ['data' => ['items' => [[AttributeSetText::NAME => self::ATTRIBUTE_SET_ID]]]];
     $expectedDataSource = ['data' => ['items' => [[AttributeSetText::NAME => self::ATTRIBUTE_SET_ID, '' => self::ATTRIBUTE_SET_NAME]]]];
     $this->attributeSetMock->expects($this->once())->method('getAttributeSetName')->willReturn(self::ATTRIBUTE_SET_NAME);
     $this->attributeSetRepositoryMock->expects($this->once())->method('get')->with(self::ATTRIBUTE_SET_ID)->willReturn($this->attributeSetMock);
     $this->assertEquals($expectedDataSource, $this->getModel()->prepareDataSource($dataSource));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 protected function createModel()
 {
     $this->currencyMock = $this->getMockBuilder(CurrencyInterface::class)->setMethods(['getCurrency', 'toCurrency'])->getMockForAbstractClass();
     $this->currencyMock->expects($this->any())->method('getCurrency')->willReturn($this->currencyMock);
     $this->imageHelperMock = $this->getMockBuilder(ImageHelper::class)->setMethods(['init', 'getUrl'])->disableOriginalConstructor()->getMock();
     $this->imageHelperMock->expects($this->any())->method('init')->willReturn($this->imageHelperMock);
     $this->attributeSetRepositoryMock = $this->getMockBuilder(AttributeSetRepositoryInterface::class)->setMethods(['get'])->getMockForAbstractClass();
     $attributeSetMock = $this->getMockBuilder(AttributeSetInterface::class)->setMethods(['getAttributeSetName'])->getMockForAbstractClass();
     $this->attributeSetRepositoryMock->expects($this->any())->method('get')->willReturn($attributeSetMock);
     return $this->objectManager->getObject(Grouped::class, ['locator' => $this->locatorMock, 'productLinkRepository' => $this->linkRepositoryMock, 'productRepository' => $this->productRepositoryMock, 'localeCurrency' => $this->currencyMock, 'imageHelper' => $this->imageHelperMock, 'attributeSetRepository' => $this->attributeSetRepositoryMock]);
 }