Skip to content

Commit

Permalink
Test isolation fixes for e_db_abstractTest
Browse files Browse the repository at this point in the history
Also needed a null check in e_db_pdo::db_Query()
  • Loading branch information
Deltik committed Jan 18, 2020
1 parent a0f4489 commit 91660a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions e107_handlers/e_db_pdo_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ public function db_Query($query, $rli = NULL, $qry_from = '', $debug = false, $l

if(is_array($query))
{
$query['BIND'] = isset($query['BIND']) ? $query['BIND'] : null;
$query = "PREPARE: " . $query['PREPARE'] . "<br />BIND:" . print_a($query['BIND'], true); // ,true);
}

Expand Down
10 changes: 10 additions & 0 deletions e107_tests/tests/unit/e_db_abstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public function testDatabase()
public function testDb_Mark_Time()
{
$this->db->debugMode(true);
e107::getDebug()->aTimeMarks = [];
e107::getDebug()->nTimeMarks = 0;
e107::getDebug()->e107_db_debug();

$this->db->db_Mark_Time("Testing");

Expand All @@ -121,8 +124,12 @@ public function testDb_Mark_Time()
$this->assertArrayHasKey('Memory', $actual[1]);

$this->db->debugMode(false);
e107::getDebug()->aTimeMarks = [];
e107::getDebug()->nTimeMarks = 0;
e107::getDebug()->e107_db_debug();
$result = $this->db->db_Mark_Time("Testing");
$this->assertNull($result);
$this->assertEquals(1, count(e107::getDebug()->getTimeMarkers()));


}
Expand All @@ -138,6 +145,9 @@ public function testDb_Mark_Time()

public function testDb_IsLang()
{
// XXX: This test leads to e_pref, which depends on lan_admin.php
e107::coreLan('', true);

$result = $this->db->db_IsLang('news', false);
$this->assertEquals('news', $result);

Expand Down

0 comments on commit 91660a2

Please sign in to comment.