public function testGetIdFieldname() { $data = 'MainTableName'; $idFieldNameProperty = new \ReflectionProperty('Magento\\Framework\\Model\\ModelResource\\Db\\AbstractDb', '_idFieldName'); $idFieldNameProperty->setAccessible(true); $idFieldNameProperty->setValue($this->_model, $data); $this->assertEquals($data, $this->_model->getIdFieldName()); }
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()); }