From 36c92f893e0d23f22521a4958e47d6193f66f920 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 16 Jan 2019 12:04:59 -0800 Subject: [PATCH] Added some MySQL class tests. --- tests/unit/e_db_mysqlTest.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index a2e922549..4bf67162f 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -12,11 +12,30 @@ class e_db_mysqlTest extends \Codeception\Test\Unit { - /* public function testGetPDO() + /** @var e_db_mysql */ + protected $db; + + protected function _before() { + try + { + $this->db = $this->make('e_db_mysql'); + } + catch (Exception $e) + { + $this->fail("Couldn't load e_db_mysql object"); + } + + $this->db->__construct(); } + public function testGetPDO() + { + $result = $this->db->getPDO(); + $this->assertTrue($result); + } +/* public function testGetMode() { @@ -194,12 +213,21 @@ { } - +*/ public function testDb_Query() { + + $userp = "3, 'Display Name', 'Username', '', 'password-hash', '', 'email@address.com', '', '', 0, ".time().", 0, 0, 0, 0, 0, '127.0.0.1', 0, '', 0, 1, '', '', '0', '', ".time().", ''"; + $this->db->db_Query("REPLACE INTO ".MPREFIX."user VALUES ({$userp})" ); + + $res = $this->db->db_Query("SELECT user_email FROM ".MPREFIX."user WHERE user_id = 3"); + $result = $res->fetch(); + $this->assertEquals('email@address.com', $result['user_email']); + } +/* public function testRetrieve() {