public function testSetMainTable() { $setMainTableMethod = new \ReflectionMethod($this->_model, '_setMainTable'); $setMainTableMethod->setAccessible(true); $tableName = $this->_model->getTable('store_website'); $idFieldName = 'website_id'; $setMainTableMethod->invoke($this->_model, $tableName); $this->assertEquals($tableName, $this->_model->getMainTable()); $setMainTableMethod->invoke($this->_model, $tableName, $idFieldName); $this->assertEquals($tableName, $this->_model->getMainTable()); $this->assertEquals($idFieldName, $this->_model->getIdFieldName()); }
public function testGetTable() { $data = 'tableName'; $this->_resourcesMock->expects($this->once())->method('getTableName')->with($data)->will($this->returnValue('tableName')); $tablesProperty = new \ReflectionProperty('Magento\\Framework\\Model\\Resource\\Db\\AbstractDb', '_tables'); $tablesProperty->setAccessible(true); $tablesProperty->setValue($this->_model, [$data]); $this->assertEquals($data, $this->_model->getTable($data)); }