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')); }
/** * @covers \Magento\Framework\Module\Setup::updateTableRow * @expectedException \Zend_Db_Statement_Exception */ public function testUpdateTableRowNameConversion() { $original = $this->_model->getTableRow('core_resource', 'code', 'core_setup', 'version'); $this->_model->updateTableRow('core/resource', 'code', 'core_setup', 'version', $original); }