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')); }
/** * 2016-08-14 * @param Setup $setup * @param IModuleContext|ModuleContext $context * @return void */ protected final function process(Setup $setup, IModuleContext $context) { $setup->startSetup(); $this->_context = $context; $this->_setup = $setup; $this->_process(); $setup->endSetup(); }
public function __construct(Setup $installer, Factory $helperFactory, Tables $tablesObject, $tableName) { $this->installer = $installer; $this->connection = $installer->getConnection(); $this->helperFactory = $helperFactory; $this->tablesObject = $tablesObject; if (!$this->tablesObject->isExists($tableName)) { throw new \Ess\M2ePro\Model\Exception\Setup("Table Name does not exist."); } $this->tableName = $this->tablesObject->getFullName($tableName); }
/** * @param Setup\Context $context * @param string $resourceName * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Eav\Model\Entity\Setup\Context $context, $resourceName, \Magento\Framework\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, $moduleName = 'Magento_Eav', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_cache = $cache; $this->_attrGroupCollectionFactory = $attrGroupCollectionFactory; $this->attributeMapper = $context->getAttributeMapper(); parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory * @param \Magento\User\Model\RoleFactory $roleFactory * @param \Magento\User\Model\RulesFactory $rulesFactory * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory, \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, \Magento\User\Model\RoleFactory $roleFactory, \Magento\User\Model\RulesFactory $rulesFactory, $moduleName = 'Magento_User', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_roleCollectionFactory = $roleCollectionFactory; $this->_rulesCollectionFactory = $rulesCollectionFactory; $this->_roleFactory = $roleFactory; $this->_rulesFactory = $rulesFactory; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * Init * * @param \Magento\Framework\Module\Setup\Context $context * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $connectionName = ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION) { parent::__construct($context->getResourceModel(), $connectionName); $this->_eventManager = $context->getEventManager(); $this->_logger = $context->getLogger(); $this->_migrationFactory = $context->getMigrationFactory(); $this->filesystem = $context->getFilesystem(); $this->setupCache = new SetupCache(); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, $moduleName, $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { parent::__construct($context->getResourceModel(), $connectionName); $this->_eventManager = $context->getEventManager(); $this->_logger = $context->getLogger(); $this->_modulesReader = $context->getModulesReader(); $this->_resourceName = $resourceName; $this->_resource = $context->getResource(); $this->_migrationFactory = $context->getMigrationFactory(); $this->_moduleConfig = $context->getModuleList()->getOne($moduleName); $this->filesystem = $context->getFilesystem(); $this->modulesDir = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Directory\Helper\Data $directoryData * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, \Magento\Directory\Helper\Data $directoryData, $moduleName = 'Magento_Directory', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_directoryData = $directoryData; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, \Magento\Core\Model\Theme\CollectionFactory $themeFactory, $moduleName = 'Magento_Core', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_themeResourceFactory = $themeResourceFactory; $this->_themeFactory = $themeFactory; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param string $moduleName * @param \Magento\Framework\Locale\ListsInterface $localeLists * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, $moduleName, \Magento\Framework\Locale\ListsInterface $localeLists, $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_localeLists = $localeLists; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param \Magento\GoogleShopping\Model\ConfigFactory $configFactory * @param \Magento\GoogleShopping\Helper\Data $googleShoppingData * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, \Magento\GoogleShopping\Model\ConfigFactory $configFactory, \Magento\GoogleShopping\Helper\Data $googleShoppingData, $moduleName = 'Magento_GoogleShopping', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_configFactory = $configFactory; $this->_googleShoppingData = $googleShoppingData; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * Apply Index module DB updates and sync indexes declaration * * @return void */ public function applyUpdates() { parent::applyUpdates(); $this->_syncIndexes(); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param \Magento\Framework\Module\Setup\MigrationData $migrationData * @param string $confPathToMapFile * @param string $resourceName * @param string $moduleName * @param string $connectionName * @param array $compositeModules */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, $moduleName, \Magento\Framework\Module\Setup\MigrationData $migrationData, $confPathToMapFile, $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION, $compositeModules = array()) { $this->_directory = $context->getFilesystem()->getDirectoryRead(\Magento\Framework\App\Filesystem::ROOT_DIR); $this->_pathToMapFile = $confPathToMapFile; $this->_migrationData = $migrationData; $this->_replacePatterns = array(self::FIELD_CONTENT_TYPE_WIKI => $this->_migrationData->getWikiFindPattern(), self::FIELD_CONTENT_TYPE_XML => $this->_migrationData->getXmlFindPattern()); $this->_compositeModules = $compositeModules; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @return \Magento\Framework\DB\Adapter\AdapterInterface */ private function getConnection() { return $this->installer->getConnection(); }
/** * 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); }
public function testEndSetup() { $this->connection->expects($this->once())->method('endSetup'); $this->object->endSetup(); }
public function testTableExists() { $this->assertTrue($this->_model->tableExists('store_website')); $this->assertFalse($this->_model->tableExists('core/website')); }
/** * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Cms\Model\BlockFactory $blockFactory * @param \Magento\Cms\Model\PageFactory $pageFactory * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, \Magento\Cms\Model\BlockFactory $blockFactory, \Magento\Cms\Model\PageFactory $pageFactory, $moduleName = 'Magento_Cms', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_blockFactory = $blockFactory; $this->_pageFactory = $pageFactory; parent::__construct($context, $resourceName, $moduleName, $connectionName); }
/** * @param \Magento\Framework\App\Resource $resource * @param string $resourceName * @param string $moduleName * @param string $connectionName */ public function __construct(\Magento\Framework\App\ResourceConnection $resource, $resourceName, $moduleName = 'Ebizmarts_MageMonkey', $connectionName = \Magento\Framework\Setup\ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION) { parent::__construct($resource, $connectionName); }
/** * Construct resource Setup Model * * @param \Magento\Framework\Module\Setup\Context $context * @param string $resourceName * @param Manager $integrationManager * @param string $moduleName * @param string $connectionName * */ public function __construct(\Magento\Framework\Module\Setup\Context $context, $resourceName, Manager $integrationManager, $moduleName = 'Magento_Integration', $connectionName = \Magento\Framework\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION) { $this->_integrationManager = $integrationManager; parent::__construct($context, $resourceName, $moduleName, $connectionName); }