/**
  * @return void
  */
 public function testModifyMeta()
 {
     $this->locatorMock->expects($this->exactly(2))->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->any())->method('getTypeId');
     $this->arrayManagerMock->expects($this->exactly(3))->method('set')->willReturn([]);
     $this->assertEquals([], $this->downloadablePanel->modifyMeta([]));
 }
Esempio n. 2
0
 protected function setUp()
 {
     $this->productLocatorMock = $this->getMockBuilder(LocatorInterface::class)->getMockForAbstractClass();
     $this->productMock = $this->getMockBuilder(ProductInterface::class)->getMockForAbstractClass();
     $this->productLocatorMock->expects(static::any())->method('getProduct')->willReturn($this->productMock);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->stockDataModifier = $this->objectManagerHelper->getObject(StockDataModifier::class, ['locator' => $this->productLocatorMock]);
 }
 protected function setUp()
 {
     $this->objectManager = new ObjectManager($this);
     $this->locatorMock = $this->getMockBuilder(LocatorInterface::class)->getMockForAbstractClass();
     $this->productMock = $this->getMockBuilder(ProductInterface::class)->getMockForAbstractClass();
     $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($this->productMock);
     $this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)->disableOriginalConstructor()->getMock();
     $this->arrayManagerMock->expects($this->any())->method('get')->willReturnArgument(3);
 }
 protected function setUp()
 {
     $this->productLocatorMock = $this->getMockBuilder(LocatorInterface::class)->getMockForAbstractClass();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMockForAbstractClass();
     $this->productMock = $this->getMockBuilder(ProductInterface::class)->getMockForAbstractClass();
     $this->productLocatorMock->expects(static::any())->method('getProduct')->willReturn($this->productMock);
     $this->urlBuilderMock->expects(static::any())->method('addSessionParam')->willReturnSelf();
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->configurablePanelModifier = $this->objectManagerHelper->getObject(ConfigurablePanelModifier::class, ['locator' => $this->productLocatorMock, 'urlBuilder' => $this->urlBuilderMock]);
 }
Esempio n. 5
0
 protected function setUp()
 {
     $this->productLocatorMock = $this->getMockBuilder(LocatorInterface::class)->getMockForAbstractClass();
     $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)->getMockForAbstractClass();
     $this->associatedProductsMock = $this->getMockBuilder(AssociatedProducts::class)->disableOriginalConstructor()->getMock();
     $this->productMock = $this->getMockBuilder(ProductInterface::class)->getMockForAbstractClass();
     $this->allowedProductTypesMock = $this->getMock(AllowedProductTypes::class, [], [], '', false);
     $this->productLocatorMock->expects(static::any())->method('getProduct')->willReturn($this->productMock);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
 }
 /**
  * @return void
  */
 protected function setUp()
 {
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->productMock = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false, false);
     $this->locatorMock = $this->getMock('Magento\\Catalog\\Model\\Locator\\LocatorInterface', [], []);
     $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($this->productMock);
     $this->dataHelperMock = $this->getMock('Magento\\GoogleOptimizer\\Helper\\Data', [], [], '', false, false);
     $this->codeHelperMock = $this->getMock('Magento\\GoogleOptimizer\\Helper\\Code', [], [], '', false, false);
     $this->googleOptimizer = $this->objectManagerHelper->getObject(GoogleOptimizer::class, ['locator' => $this->locatorMock, 'dataHelper' => $this->dataHelperMock, 'codeHelper' => $this->codeHelperMock]);
 }
Esempio n. 7
0
 /**
  * @magentoDataFixture Magento/Catalog/_files/product_simple_with_admin_store.php
  */
 public function testModifyData()
 {
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class);
     $product->load(1);
     $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($product);
     $expectedData = (include __DIR__ . '/_files/eav_expected_data_output.php');
     $actualData = $this->eavModifier->modifyData([]);
     $this->prepareDataForComparison($actualData, $expectedData);
     $this->assertEquals($expectedData, $actualData);
 }
 /**
  * @return void
  */
 protected function setUp()
 {
     $this->meta = ['some_meta'];
     $this->modifiedMeta = ['modified_meta'];
     $this->modifierClass = 'SomeClass';
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
     $this->locatorMock = $this->getMock(\Magento\Catalog\Model\Locator\LocatorInterface::class);
     $this->productMock = $this->getMock(\Magento\Catalog\Api\Data\ProductInterface::class);
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->composite = $this->objectManagerHelper->getObject(\Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\Composite::class, ['locator' => $this->locatorMock, 'objectManager' => $this->objectManagerMock, 'modifiers' => ['mod' => $this->modifierClass]]);
 }
 protected function setUp()
 {
     $this->objectManager = new ObjectManager($this);
     $this->locatorMock = $this->getMockBuilder(LocatorInterface::class)->getMockForAbstractClass();
     $this->productMock = $this->getMockBuilder(ProductInterface::class)->setMethods(['getStoreId', 'getResource', 'getData', 'getAttributes', 'getStore', 'getAttributeDefaultValue', 'getExistsStoreValueFlag'])->getMockForAbstractClass();
     $this->storeMock = $this->getMockBuilder(StoreInterface::class)->setMethods(['load', 'getId', 'getConfig'])->getMockForAbstractClass();
     $this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)->disableOriginalConstructor()->getMock();
     $this->arrayManagerMock->expects($this->any())->method('replace')->willReturnArgument(1);
     $this->arrayManagerMock->expects($this->any())->method('get')->willReturnArgument(2);
     $this->arrayManagerMock->expects($this->any())->method('set')->willReturnArgument(1);
     $this->arrayManagerMock->expects($this->any())->method('merge')->willReturnArgument(1);
     $this->arrayManagerMock->expects($this->any())->method('remove')->willReturnArgument(1);
     $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($this->productMock);
     $this->locatorMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
 }
Esempio n. 10
0
 /**
  * @param int|null $id
  * @param string $typeId
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetTitle
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetValue
  * @return void
  * @dataProvider getLinksTitleDataProvider
  */
 public function testGetLinksTitle($id, $typeId, $expectedGetTitle, $expectedGetValue)
 {
     $title = 'My Title';
     $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getId')->willReturn($id);
     $this->productMock->expects($this->any())->method('getTypeId')->willReturn($typeId);
     $this->productMock->expects($expectedGetTitle)->method('getLinksTitle')->willReturn($title);
     $this->scopeConfigMock->expects($expectedGetValue)->method('getValue')->willReturn($title);
     $this->assertEquals($title, $this->links->getLinksTitle());
 }
 /**
  * @return void
  */
 public function testModifyMeta()
 {
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getTypeId');
     $this->storeManagerMock->expects($this->once())->method('isSingleStoreMode');
     $this->typeUploadMock->expects($this->once())->method('toOptionArray');
     $this->urlBuilderMock->expects($this->once())->method('addSessionParam')->willReturnSelf();
     $this->urlBuilderMock->expects($this->once())->method('getUrl');
     $this->arrayManagerMock->expects($this->exactly(6))->method('set')->willReturn([]);
     $this->assertEquals([], $this->samples->modifyMeta([]));
 }
 /**
  * @return void
  */
 public function testModifyMeta()
 {
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->any())->method('getTypeId');
     $this->storeManagerMock->expects($this->exactly(2))->method('isSingleStoreMode');
     $this->typeUploadMock->expects($this->exactly(2))->method('toOptionArray');
     $this->shareableMock->expects($this->once())->method('toOptionArray');
     $this->urlBuilderMock->expects($this->exactly(2))->method('addSessionParam')->willReturnSelf();
     $this->urlBuilderMock->expects($this->exactly(2))->method('getUrl');
     $currencyMock = $this->getMock(\Magento\Directory\Model\Currency::class, [], [], '', false);
     $currencyMock->expects($this->once())->method('getCurrencySymbol');
     $storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)->setMethods(['getBaseCurrency'])->getMockForAbstractClass();
     $storeMock->expects($this->once())->method('getBaseCurrency')->willReturn($currencyMock);
     $this->locatorMock->expects($this->once())->method('getStore')->willReturn($storeMock);
     $this->arrayManagerMock->expects($this->exactly(9))->method('set')->willReturn([]);
     $this->assertEquals([], $this->links->modifyMeta([]));
 }
Esempio n. 13
0
 /**
  * @param string $typeId
  * @return void
  */
 protected function canShowDownloadablePanel($typeId)
 {
     $this->locatorMock->expects($this->once())->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getTypeId')->willReturn($typeId);
 }