See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
DML read/read-write database handle use tests
Copyright: | 2018 Srdjan Janković, Catalyst IT |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 432 lines (15 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 2 files lib/dml/tests/fixtures/read_slave_moodle_database_table_names.php lib/dml/tests/fixtures/read_slave_moodle_database_special.php |
core_dml_read_slave_testcase:: (15 methods):
new_db()
assert_readonly_handle()
table_names_provider()
test_table_names()
test_read_read_write_read()
test_read_write_write()
test_write_read_read()
test_read_temptable()
test_read_excluded_tables()
test_transaction()
test_read_only_conn_fail()
test_read_only_conn_first_fail()
with_global_db()
test_lock_db()
test_sessions()
Class: core_dml_read_slave_testcase - X-Ref
DML read/read-write database handle use testsnew_db($wantlatency = false,$readonly = [['dbhost' => 'test_ro1', 'dbport' => 1, 'dbuser' => 'test1', 'dbpass' => 'test1'],['dbhost' => 'test_ro2', 'dbport' => 2, 'dbuser' => 'test2', 'dbpass' => 'test2'],['dbhost' => 'test_ro3', 'dbport' => 3, 'dbuser' => 'test3', 'dbpass' => 'test3'],],$dbclass = read_slave_moodle_database::class) X-Ref |
Instantiates a test database interface object. param: bool $wantlatency param: mixed $readonly param: mixed $dbclass return: read_slave_moodle_database $db |
assert_readonly_handle($handle) X-Ref |
Asert that the mock handle returned from read_slave_moodle_database methods is a readonly slave handle. param: string $handle return: void |
table_names_provider() X-Ref |
moodle_read_slave_trait::table_names() test data provider return: array |
test_table_names($sql, $tables) X-Ref |
Test moodle_read_slave_trait::table_names() query parser. param: string $sql param: array $tables return: void |
test_read_read_write_read() X-Ref |
Test correct database handles are used in a read-read-write-read scenario. Test lazy creation of the write handle. return: void |
test_read_write_write() X-Ref |
Test correct database handles are used in a read-write-write scenario. return: void |
test_write_read_read() X-Ref |
Test correct database handles are used in a write-read-read scenario. return: void |
test_read_temptable() X-Ref |
Test readonly handle is not used for reading from temptables. return: void |
test_read_excluded_tables() X-Ref |
Test readonly handle is not used for reading from excluded tables. return: void |
test_transaction() X-Ref |
Test readonly handle is not used during transactions. Test last written time is adjusted post-transaction, so the latency parameter is applied properly. return: void |
test_read_only_conn_fail() X-Ref |
Test failed readonly connection falls back to write connection. return: void |
test_read_only_conn_first_fail() X-Ref |
In multiple slaves scenario, test failed readonly connection falls back to another readonly connection. return: void |
with_global_db($test) X-Ref |
Helper to restore global $DB param: callable $test return: void |
test_lock_db() X-Ref |
Test lock_db table exclusion return: void |
test_sessions() X-Ref |
Test sessions table exclusion return: void |