Example #1
0
 public function testGetSwatchesByOptionsIdIf3()
 {
     $swatchMock = $this->getMock('\\Magento\\Swatches\\Model\\Swatch', [], [], '', false);
     $optionsData = ['type' => 0, 'store_id' => 0, 'value' => 'test_test', 'option_id' => 35, 'id' => 423];
     $swatchMock->expects($this->at(0))->method('offsetGet')->with('type')->willReturn(0);
     $swatchMock->expects($this->at(1))->method('offsetGet')->with('store_id')->willReturn(0);
     $swatchMock->expects($this->at(2))->method('offsetGet')->with('store_id')->willReturn(0);
     $swatchMock->expects($this->at(3))->method('offsetGet')->with('option_id')->willReturn(35);
     $swatchMock->expects($this->at(4))->method('getData')->with('')->willReturn($optionsData);
     $swatchCollectionMock = $this->objectManager->getCollectionMock('\\Magento\\Swatches\\Model\\ResourceModel\\Swatch\\Collection', [$swatchMock]);
     $this->swatchCollectionFactoryMock->method('create')->willReturn($swatchCollectionMock);
     $swatchCollectionMock->method('addFilterByOptionsIds')->with([35])->will($this->returnSelf());
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $this->storeManagerMock->method('getStore')->willReturn($storeMock);
     $storeMock->method('getId')->willReturn(1);
     $this->swatchHelperObject->getSwatchesByOptionsId([35]);
 }