public function getFullName($tableName) { if (isset($this->entities[$tableName])) { return $this->entities[$tableName]; } return $this->entities[$tableName] = $this->installer->getTable(self::M2E_PRO_TABLE_PREFIX . $tableName); }
public function testApplyAllDataUpdates() { /*reset versions*/ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\Module\\ResourceInterface')->setDbVersion('adminnotification_setup', false); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\Module\\ResourceInterface')->setDataVersion('adminnotification_setup', false); $this->_model->deleteTableRow('core_resource', 'code', 'adminnotification_setup'); $this->_model->getConnection()->dropTable($this->_model->getTable('adminnotification_inbox')); $this->_model->getConnection()->dropTable($this->_model->getTable('admin_system_messages')); /** @var \Magento\Framework\Cache\FrontendInterface $cache */ $cache = $this->_objectManager->get('Magento\\Framework\\App\\Cache\\Type\\Config'); $cache->clean(); try { /* This triggers plugin to be executed */ $this->dispatch('index/index'); } catch (\Exception $e) { $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } try { $tableData = $this->_model->getConnection()->describeTable($this->_model->getTable('adminnotification_inbox')); $this->assertNotEmpty($tableData); } catch (\Exception $e) { $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version')); $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'data_version')); }
public function testGetTable() { $tableName = 'table'; $expectedTableName = 'expected_table'; $this->resourceModel->expects($this->once())->method('getTableName')->with($tableName)->will($this->returnValue($expectedTableName)); $this->assertSame($expectedTableName, $this->object->getTable($tableName)); // Check that table name is cached $this->assertSame($expectedTableName, $this->object->getTable($tableName)); }
public function testApplyAllDataUpdates() { /*reset versions*/ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\\Magento\\Framework\\Module\\ResourceInterface')->setDbVersion('adminnotification_setup', false); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\\Magento\\Framework\\Module\\ResourceInterface')->setDataVersion('adminnotification_setup', false); $this->_model->deleteTableRow('core_resource', 'code', 'adminnotification_setup'); $this->_model->getConnection()->dropTable($this->_model->getTable('adminnotification_inbox')); $this->_model->getConnection()->dropTable($this->_model->getTable('admin_system_messages')); /** @var $updater \Magento\Framework\Module\Updater */ $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\Module\\Updater'); try { $updater->updateScheme(); $updater->updateData(); } catch (\Exception $e) { $this->fail("Impossible to continue other tests, because database is broken: {$e}"); } $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version')); $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'data_version')); }
/** * Set order number prefix * * @param \Magento\Framework\Module\Setup $setupModel * @param string $orderIncrementPrefix * @return void */ protected function _setOrderIncrementPrefix(\Magento\Framework\Module\Setup $setupModel, $orderIncrementPrefix) { $select = $setupModel->getConnection()->select()->from($setupModel->getTable('eav_entity_type'), 'entity_type_id')->where('entity_type_code=?', 'order'); $data = array('entity_type_id' => $setupModel->getConnection()->fetchOne($select), 'store_id' => '1', 'increment_prefix' => $orderIncrementPrefix); $setupModel->getConnection()->insert($setupModel->getTable('eav_entity_store'), $data); }