mirror of
https://github.com/e107inc/e107.git
synced 2025-08-14 02:24:08 +02:00
Don't spam database server with connections
- MOD: Silently ignore failures to e_db_mysql::close(); if it's failing, it's probably already closed - FIX: Close the PDO or mysqli connection after each e_db_abstractTest test - MOD: Changed class2.php's $sql variable to be hinted as an e_db instead of e_db_mysql
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2019 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
@@ -20,6 +20,14 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
||||
*/
|
||||
abstract protected function makeDb();
|
||||
|
||||
/**
|
||||
* Prevent creating too many connections to database server
|
||||
*/
|
||||
public function _after()
|
||||
{
|
||||
$this->db->close();
|
||||
}
|
||||
|
||||
protected function loadConfig()
|
||||
{
|
||||
/** @var Helper\DelayedDb $db */
|
||||
@@ -47,9 +55,6 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testGetMode()
|
||||
{
|
||||
$actual = $this->db->getMode();
|
||||
@@ -1006,7 +1011,6 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
||||
*/
|
||||
public function testSecondaryDatabaseInstance()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$xql = $this->makeDb();
|
||||
@@ -1128,8 +1132,7 @@ abstract class e_db_abstractTest extends \Codeception\Test\Unit
|
||||
$empty = $xql->isEmpty($table);
|
||||
$this->assertTrue($empty,"isEmpty() or truncate() failed");
|
||||
|
||||
|
||||
|
||||
$xql->close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
|
Reference in New Issue
Block a user