From c4cbb19749d73b5e1e388c71d3f3fa281cae48c8 Mon Sep 17 00:00:00 2001 From: Deltik Date: Wed, 13 Feb 2019 21:31:28 -0600 Subject: [PATCH 1/2] Improved determinism of cloned testDb_Select_gen() tests If either e_db_mysqlTest's or e_db_pdoTest's testDb_Select_gen() method gets called before the other, the second won't update and will return 0 instead of the expected 1. The UPDATE query is unique for each test now so that this cannot happen anymore. --- tests/unit/e_db_mysqlTest.php | 4 +++- tests/unit/e_db_pdoTest.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index f3c6ffcba..37d6116b8 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -303,7 +303,9 @@ public function testDb_Select_gen() { - $result = $this->db->db_Select_gen("UPDATE `#user` SET user_ip = '127.0.0.3' WHERE user_id = 1"); + $result = $this->db->db_Select_gen( + "UPDATE `#user` SET user_signature = 'e_db_mysql' WHERE user_id = 1" + ); $this->assertEquals(1,$result); } diff --git a/tests/unit/e_db_pdoTest.php b/tests/unit/e_db_pdoTest.php index 783d9ad7e..3dd2943fc 100644 --- a/tests/unit/e_db_pdoTest.php +++ b/tests/unit/e_db_pdoTest.php @@ -330,7 +330,9 @@ public function testDb_Select_gen() { - $result = $this->db->db_Select_gen("UPDATE `#user` SET user_ip = '127.0.0.3' WHERE user_id = 1"); + $result = $this->db->db_Select_gen( + "UPDATE `#user` SET user_signature = 'e_db_pdo' WHERE user_id = 1" + ); $this->assertEquals(1,$result); } From d4d631f7a567bf86264623a1b01e80cd5c907d34 Mon Sep 17 00:00:00 2001 From: Deltik Date: Wed, 13 Feb 2019 22:03:16 -0600 Subject: [PATCH 2/2] Removed var_dump() that may have been committed by accident --- tests/unit/e_db_mysqlTest.php | 4 ---- tests/unit/e_db_pdoTest.php | 3 --- 2 files changed, 7 deletions(-) diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index 37d6116b8..610b4fdc2 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -559,8 +559,6 @@ $this->db->gen($qry); $row = $this->db->db_Fetch(MYSQL_NUM); - var_dump($row); - // $this->assertEquals('e107_user', $row[0]); $this->db->select('user', '*', 'user_id = 1'); $row = $this->db->db_Fetch(MYSQL_BOTH); @@ -586,8 +584,6 @@ $result = $this->db->db_Count('SELECT COUNT(*) FROM '.MPREFIX.'missing ','generic'); $this->assertFalse($result); - //var_dump($result); - //$this->assertEquals(1,$result); } /* public function testClose() diff --git a/tests/unit/e_db_pdoTest.php b/tests/unit/e_db_pdoTest.php index 3dd2943fc..583b7afbc 100644 --- a/tests/unit/e_db_pdoTest.php +++ b/tests/unit/e_db_pdoTest.php @@ -616,8 +616,6 @@ $result = $this->db->db_Count('SELECT COUNT(*) FROM '.MPREFIX.'missing ','generic'); $this->assertFalse($result); - //var_dump($result); - //$this->assertEquals(1,$result); } /* public function testClose() @@ -742,7 +740,6 @@ $result = $this->db->max('generic', 'gen_user_id'); $this->assertEquals('555', $result, "gen_ip = '127.0.0.1'"); - // var_dump($result); }