From a941bee847a4f1c2d45bcb08aaf60ce527d70284 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 11 Feb 2019 16:23:24 -0800 Subject: [PATCH] Ported PDO tests across to Mysql tests. --- tests/unit/e_db_mysqlTest.php | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index 5f20a88f7..ee46346b4 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -148,6 +148,26 @@ } + public function testDb_IsLang() + { + $result = $this->db->db_IsLang('news', false); + $this->assertEquals('news', $result); + + $this->db->db_CopyTable('news','lan_spanish_news',true, true); + + e107::getConfig()->set('multilanguage',true)->save(); + + $this->db->mySQLlanguage = 'Spanish'; + + $result = $this->db->db_IsLang('news', false); + $this->assertEquals('lan_spanish_news', $result); + + $this->db->mySQLlanguage = 'English'; + + $this->db->gen('DROP TABLE '.MPREFIX.'lan_spanish_news'); + } + + public function testDb_Write_log() { @@ -414,6 +434,14 @@ } + public function testGetLastQuery() + { + $this->db->select('user'); + $result = $this->db->getLastQuery(); + $this->assertEquals("SELECT * FROM e107_user", $result); + } + + public function testDb_UpdateArray() { @@ -817,6 +845,27 @@ public function testGetFieldDefs() { + $actual = $this->db->getFieldDefs('plugin'); + + $expected = array ( + '_FIELD_TYPES' => + array ( + 'plugin_id' => 'int', + 'plugin_name' => 'escape', + 'plugin_version' => 'escape', + 'plugin_path' => 'escape', + 'plugin_installflag' => 'int', + 'plugin_addons' => 'escape', + 'plugin_category' => 'escape', + ), + '_NOTNULL' => + array ( + 'plugin_id' => '', + 'plugin_addons' => '', + ), + ); + + $this->assertEquals($expected, $actual); }