示例#1
0
 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', ['create'], [], '', false);
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategy\\Query', ['fetchAll'], [], '', false);
     $this->eventManagerMock = $this->getMock('Magento\\Framework\\Event\\Manager', [], [], '', false);
     $this->optionsFactoryMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\Option\\Value\\CollectionFactory', ['create'], [], '', false);
     $this->storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\Option', ['getReadConnection', '__wakeup', 'getMainTable', 'getTable'], [], '', false);
     $this->selectMock = $this->getMock('Zend_Db_Select', ['from', 'reset'], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select'], [], '', false);
     $this->adapterMock->expects($this->once())->method('select')->will($this->returnValue($this->selectMock));
     $this->resourceMock->expects($this->once())->method('getReadConnection')->will($this->returnValue($this->adapterMock));
     $this->resourceMock->expects($this->once())->method('getMainTable')->will($this->returnValue('test_main_table'));
     $this->resourceMock->expects($this->once())->method('getTable')->with('test_main_table')->will($this->returnValue('test_main_table'));
     $this->collection = new Collection($this->entityFactoryMock, $this->loggerMock, $this->fetchStrategyMock, $this->eventManagerMock, $this->optionsFactoryMock, $this->storeManagerMock, null, $this->resourceMock);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function delete(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $entity)
 {
     $this->optionResource->delete($entity);
     return true;
 }