public function testSetSetupScriptExecuted() { $this->appMock->expects($this->any())->method('db')->will($this->returnValue($this->dbMock)); $this->dbMock->expects($this->at(0))->method('execute')->with($this->matchesRegularExpression('/CREATE TABLE.*/')); $installer = \Magelight\Installer::forge(); $this->dbMock->expects($this->at(0))->method('execute')->with($this->matches("INSERT INTO `" . $installer->getVersionTable() . "` (module_name, setup_script) VALUES (?, ?)"), ['Module1', 'setup-1.0.0.0.php']); $this->assertInstanceOf(\Magelight\Installer::class, $installer->setSetupScriptExecuted('Module1', 'setup-1.0.0.0.php')); }
public function testDbMysql() { $mysqlConfig = new \SimpleXMLElement('<config> <type>mysql</type> <host>localhost</host> </config>'); $index = \Magelight\App::DEFAULT_INDEX; $mysqlDbAdapterMock = $this->getMock(\Magelight\Db\Mysql\Adapter::class, ['init'], [], '', false); $mysqlDbAdapterMock->expects($this->once())->method('init')->with((array) $mysqlConfig); \Magelight\Db\Mysql\Adapter::forgeMock($mysqlDbAdapterMock); $this->configMock->expects($this->once())->method('getConfig')->with('/global/db/' . $index, null)->will($this->returnValue($mysqlConfig)); $this->assertInstanceOf(\Magelight\Db\Mysql\Adapter::class, $this->app->db()); }