mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-73713 dml: test namespaces fix - a noop
This commit is contained in:
parent
8a386d68f6
commit
343384d921
@ -21,8 +21,11 @@
|
||||
* @category dml
|
||||
* @copyright 2018 Srdjan Janković, Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \mysqli_native_moodle_database
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/fixtures/read_slave_moodle_database_mock_mysqli.php');
|
||||
@ -35,7 +38,7 @@ require_once(__DIR__.'/fixtures/read_slave_moodle_database_mock_mysqli.php');
|
||||
* @copyright 2018 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_dml_mysqli_read_slave_testcase extends base_testcase {
|
||||
class dml_mysqli_read_slave_test extends \base_testcase {
|
||||
/**
|
||||
* Test readonly handle is not used for reading from special pg_*() call queries,
|
||||
* pg_try_advisory_lock and pg_advisory_unlock.
|
||||
@ -80,7 +83,7 @@ class core_dml_mysqli_read_slave_testcase extends base_testcase {
|
||||
'connecttimeout' => 1
|
||||
];
|
||||
|
||||
$db2 = moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2 = \moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2->connect($cfg->dbhost, $cfg->dbuser, $cfg->dbpass, $cfg->dbname, $cfg->prefix, $cfg->dboptions);
|
||||
$this->assertTrue(count($db2->get_records('user')) > 0);
|
||||
}
|
||||
|
@ -21,8 +21,11 @@
|
||||
* @category dml
|
||||
* @copyright 2018 Srdjan Janković, Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \pgsql_native_moodle_database
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/fixtures/read_slave_moodle_database_mock_pgsql.php');
|
||||
@ -35,7 +38,7 @@ require_once(__DIR__.'/fixtures/read_slave_moodle_database_mock_pgsql.php');
|
||||
* @copyright 2018 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_dml_pgsql_read_slave_testcase extends base_testcase {
|
||||
class dml_pgsql_read_slave_test extends \base_testcase {
|
||||
/**
|
||||
* Test correct database handles are used for cursors
|
||||
*
|
||||
@ -135,12 +138,12 @@ class core_dml_pgsql_read_slave_testcase extends base_testcase {
|
||||
}
|
||||
|
||||
// Get a separate disposable db connection handle with guaranteed 'readonly' config.
|
||||
$db2 = moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2 = \moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2->connect($cfg->dbhost, $cfg->dbuser, $cfg->dbpass, $cfg->dbname, $cfg->prefix, $cfg->dboptions);
|
||||
|
||||
$dbman = $db2->get_manager();
|
||||
|
||||
$table = new xmldb_table('silly_test_table');
|
||||
$table = new \xmldb_table('silly_test_table');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
||||
$table->add_field('msg', XMLDB_TYPE_CHAR, 255);
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
@ -155,7 +158,7 @@ class core_dml_pgsql_read_slave_testcase extends base_testcase {
|
||||
$db2->get_records('silly_test_table');
|
||||
$this->assertEquals($reads, $db2->perf_get_reads_slave());
|
||||
|
||||
$table2 = new xmldb_table('silly_test_table2');
|
||||
$table2 = new \xmldb_table('silly_test_table2');
|
||||
$table2->add_field('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
||||
$table2->add_field('msg', XMLDB_TYPE_CHAR, 255);
|
||||
$table2->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
@ -193,7 +196,7 @@ class core_dml_pgsql_read_slave_testcase extends base_testcase {
|
||||
'connecttimeout' => 1
|
||||
];
|
||||
|
||||
$db2 = moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2 = \moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary);
|
||||
$db2->connect($cfg->dbhost, $cfg->dbuser, $cfg->dbpass, $cfg->dbname, $cfg->prefix, $cfg->dboptions);
|
||||
$this->assertTrue(count($db2->get_records('user')) > 0);
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
* @coversDefaultClass \moodle_temptables
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/fixtures/read_slave_moodle_database_table_names.php');
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/test_moodle_database.php');
|
||||
@ -37,7 +39,7 @@ require_once(__DIR__.'/../../moodle_read_slave_trait.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class read_slave_moodle_database extends test_moodle_database {
|
||||
use moodle_read_slave_trait;
|
||||
use \moodle_read_slave_trait;
|
||||
|
||||
/** @var string */
|
||||
protected $handle;
|
||||
@ -58,7 +60,7 @@ class read_slave_moodle_database extends test_moodle_database {
|
||||
$this->prefix = $prefix;
|
||||
|
||||
if ($dbhost == 'test_ro_fail') {
|
||||
throw new dml_connection_exception($dbhost);
|
||||
throw new \dml_connection_exception($dbhost);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/../../mysqli_native_moodle_database.php');
|
||||
@ -36,7 +38,7 @@ require_once(__DIR__.'/test_moodle_read_slave_trait.php');
|
||||
* @copyright 2018 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class read_slave_moodle_database_mock_mysqli extends mysqli_native_moodle_database {
|
||||
class read_slave_moodle_database_mock_mysqli extends \mysqli_native_moodle_database {
|
||||
use test_moodle_read_slave_trait;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/../../pgsql_native_moodle_database.php');
|
||||
@ -36,6 +38,6 @@ require_once(__DIR__.'/test_moodle_read_slave_trait.php');
|
||||
* @copyright 2018 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class read_slave_moodle_database_mock_pgsql extends pgsql_native_moodle_database {
|
||||
class read_slave_moodle_database_mock_pgsql extends \pgsql_native_moodle_database {
|
||||
use test_moodle_read_slave_trait;
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/read_slave_moodle_database.php');
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/read_slave_moodle_database.php');
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/../../moodle_database.php');
|
||||
@ -38,7 +40,7 @@ require_once(__DIR__.'/test_sql_generator.php');
|
||||
* @copyright 2018 Catalyst IT
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class test_moodle_database extends moodle_database {
|
||||
abstract class test_moodle_database extends \moodle_database {
|
||||
|
||||
/** @var string */
|
||||
private $error;
|
||||
@ -53,7 +55,7 @@ abstract class test_moodle_database extends moodle_database {
|
||||
public function __construct($external = false) {
|
||||
parent::__construct($external);
|
||||
|
||||
$this->temptables = new moodle_temptables($this);
|
||||
$this->temptables = new \moodle_temptables($this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,9 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/../../pgsql_native_moodle_database.php');
|
||||
namespace core;
|
||||
|
||||
/**
|
||||
* Read slave helper that exposes selected moodle_read_slave_trait metods
|
||||
@ -55,7 +53,7 @@ trait test_moodle_read_slave_trait {
|
||||
$this->dbhreadonly = $ro;
|
||||
$this->set_db_handle($this->dbhwrite);
|
||||
|
||||
$this->temptables = new moodle_temptables($this);
|
||||
$this->temptables = new \moodle_temptables($this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__.'/../../../ddl/sql_generator.php');
|
||||
@ -36,7 +38,7 @@ require_once(__DIR__.'/../../../ddl/sql_generator.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
*/
|
||||
class test_sql_generator extends sql_generator {
|
||||
class test_sql_generator extends \sql_generator {
|
||||
// phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user