コード例 #1
0
 protected function setUp()
 {
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->collection = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product\\Collection', ['__wakeup', 'getSelect', 'joinLeft', 'order', 'getStoreId', 'getConnection', 'getCheckSql'], [], '', false);
     $this->attributeModel = $this->getMock('\\Magento\\Catalog\\Model\\Entity\\Attributee', ['__wakeup', 'getAttributeCode', 'getBackend', 'getId', 'isScopeGlobal'], [], '', false);
     $this->backendAttributeModel = $this->getMock('\\Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Sku', ['__wakeup', 'getTable'], [], '', false);
     $this->status = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product\\Attribute\\Source\\Status');
     $this->attributeModel->expects($this->any())->method('getAttribute')->will($this->returnSelf());
     $this->attributeModel->expects($this->any())->method('getAttributeCode')->will($this->returnValue('attribute_code'));
     $this->attributeModel->expects($this->any())->method('getId')->will($this->returnValue('1'));
     $this->attributeModel->expects($this->any())->method('getBackend')->will($this->returnValue($this->backendAttributeModel));
     $this->collection->expects($this->any())->method('getSelect')->will($this->returnSelf());
     $this->collection->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->backendAttributeModel->expects($this->any())->method('getTable')->will($this->returnValue('table_name'));
 }