From d84c8880bdd71bf9a0b86712106834e655823a9e Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 10 Feb 2019 15:02:14 -0800 Subject: [PATCH] debug test class added. More pdo tests. --- tests/unit/e107_db_debugTest.php | 138 +++++++++++++++++++++++++++++++ tests/unit/e_db_pdoTest.php | 22 ++++- 2 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 tests/unit/e107_db_debugTest.php diff --git a/tests/unit/e107_db_debugTest.php b/tests/unit/e107_db_debugTest.php new file mode 100644 index 000000000..f795cdc46 --- /dev/null +++ b/tests/unit/e107_db_debugTest.php @@ -0,0 +1,138 @@ +dbg = $this->make('e107_db_debug'); + } + catch(Exception $e) + { + $this->assertTrue(false, "Couldn't load e107_db_debug object"); + } + + } +/* + public function testShowIf() + { + + } + + public function testShow_Log() + { + + } + + public function testShow_Includes() + { + + } + + public function testSave() + { + + } + + public function testShow_DEPRECATED() + { + + }*/ + + public function testLog() + { + + define('E107_DBG_BASIC', true); // fails , already defined? + + $res = $this->dbg->log('hello world'); + + $this->assertTrue($res, 'db_debug->log() method returned false.'); + + + $result = $this->dbg->Show_Log(); + + // var_dump($result); + } +/* + public function testLogCode() + { + + } + + public function testLogDeprecated() + { + + } + + public function test__construct() + { + + } + + public function testE107_db_debug() + { + + } + + public function testShow_SQL_Details() + { + + } + + public function testShow_SC_BB() + { + + } + + public function testShow_All() + { + + } + + public function testCountLabel() + { + + } + + public function testMark_Time() + { + + } + + public function testMark_Query() + { + + } + + public function testShow_Performance() + { + + } + + public function testShow_PATH() + { + + } + + public function testDump() + { + + } +*/ + + + + } diff --git a/tests/unit/e_db_pdoTest.php b/tests/unit/e_db_pdoTest.php index b5f0c363d..dabbf7026 100644 --- a/tests/unit/e_db_pdoTest.php +++ b/tests/unit/e_db_pdoTest.php @@ -683,7 +683,8 @@ { } -*//* +*/ + public function testBackup() { $opts = array( @@ -702,28 +703,41 @@ $this->assertContains("CREATE TABLE `e107_core_media_cat`", $tmp); - }*/ + } /* public function testDbError() { } - +*/ public function testGetLastErrorNumber() { + $this->db->select('doesnt_exists'); + $result = $this->db->getLastErrorNumber(); + $this->assertEquals("42S02", $result); } public function testGetLastErrorText() { + $this->db->select('doesnt_exists'); + $result = $this->db->getLastErrorText(); + $actual = (strpos($result,"doesn't exist")!== false ); + + $this->assertTrue($actual); } public function testResetLastError() { + $this->db->select('doesnt_exists'); + $this->db->resetLastError(); + + $num = $this->db->getLastErrorNumber(); + $this->assertEquals(0, $num); } - +/* public function testGetLastQuery() {