Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
|
Special test case for testing of DML drivers and DDL layer. More...
Public Member Functions | |
__construct ($name=null) | |
Constructs a test case with the given name. | |
assertDebuggingCalled ($debugmessage=null, $debuglevel=null, $message='') | |
Assert that exactly debugging was just called once. | |
assertDebuggingNotCalled ($message='') | |
Call when no debugging() messages expected. | |
assertEqualsIgnoringWhitespace ($expected, $actual, string $message='') | |
Assert that two Date/Time strings are equal. | |
check_debugging () | |
getDebuggingMessages () | |
Return debugging messages from the current test. | |
isInIsolation () | |
Determine whether the test is running in isolation. | |
resetDebugging () | |
Clear all previous debugging messages in current test. | |
Static Public Member Functions | |
static | assertNotTag ($matcher, $actual, $message='', $ishtml=true) |
Note: we are overriding this method to remove the deprecated error. | |
static | assertTag ($matcher, $actual, $message='', $ishtml=true) |
Note: we are overriding this method to remove the deprecated error. | |
static | assertValidKeys (array $hash, array $validKeys) |
Validate list of keys in the associative array. | |
static | findNodes (DOMDocument $dom, array $options, $isHtml=true) |
Parse out the options from the tag using DOM object tree. | |
static | loadHTML (string $actual) |
Load HTML into a DomDocument. | |
static | setUpBeforeClass () |
static | tearDownAfterClass () |
Protected Member Functions | |
setup_extradb () | |
teardown_extradb () | |
Static Protected Member Functions | |
static | get_invokable () |
Get an invokable object for testing. | |
static | getDescendants (DOMNode $node) |
Recursively get flat array of all descendants of this node. | |
static | getElementsByCaseInsensitiveTagName (DOMDocument $dom, $tag) |
Gets elements by case insensitive tagname. | |
static | getInvocationCount (InvocationOrder $counter) |
Helper to get the count of invocation. | |
static | getNodeText (DOMNode $node) |
Get the text value of this node's child text node. | |
Protected Attributes | |
moodle_database | $tdb |
used in these tests | |
Special test case for testing of DML drivers and DDL layer.
Note: Use only 'test_table*' names when creating new tables.
For DML/DDL developers: you can add following settings to config.php if you want to test different driver than the main one, the reason is to allow testing of incomplete drivers that do not allow full PHPUnit environment initialisation (the database can be empty). $CFG->phpunit_extra_drivers = array( 1=>array('dbtype'=>'mysqli', 'dbhost'=>'localhost', 'dbname'=>'moodle', 'dbuser'=>'root', 'dbpass'=>'', 'prefix'=>'phpu2_'), 2=>array('dbtype'=>'pgsql', 'dbhost'=>'localhost', 'dbname'=>'moodle', 'dbuser'=>'postgres', 'dbpass'=>'', 'prefix'=>'phpu2_'), 3=>array('dbtype'=>'sqlsrv', 'dbhost'=>'127.0.0.1', 'dbname'=>'moodle', 'dbuser'=>'sa', 'dbpass'=>'', 'prefix'=>'phpu2_'), ); define('PHPUNIT_TEST_DRIVER')=1; //number is index in the previous array
|
final |
Constructs a test case with the given name.
string | $name |
database_driver_testcase::assertDebuggingCalled | ( | $debugmessage = null, | |
$debuglevel = null, | |||
$message = '' ) |
Assert that exactly debugging was just called once.
Discards the debugging message if successful.
null | string | $debugmessage | null means any |
null | string | $debuglevel | null means any |
string | $message |
database_driver_testcase::assertDebuggingNotCalled | ( | $message = '' | ) |
Call when no debugging() messages expected.
string | $message |
|
inherited |
Assert that two Date/Time strings are equal.
The strings generated by DateTime, strtotime, date, time, etc. are generated outside of our control. From time-to-time string changes are made. One such example is from ICU 72.1 which changed the time format to include a narrow-non-breaking-space (U+202F) between the time and AM/PM.
We should not update our tests to match these changes, as it is not our code that is generating the strings and they may change again. In addition, the changes are not equal amongst all systems as they depend on the version of ICU installed.
string | $expected | |
string | $actual | |
string | $message |
|
staticinherited |
Note: we are overriding this method to remove the deprecated error.
array | $matcher | |
string | $actual | |
string | $message | |
boolean | $ishtml |
|
staticinherited |
Note: we are overriding this method to remove the deprecated error.
array | $matcher | |
string | $actual | |
string | $message | |
boolean | $ishtml |
|
staticinherited |
Validate list of keys in the associative array.
array | $hash | |
array | $validKeys |
array |
PHPUnit::Framework::Exception |
|
staticinherited |
Parse out the options from the tag using DOM object tree.
DOMDocument | $dom | |
array | $options | |
bool | $isHtml |
array |
|
staticprotectedinherited |
Get an invokable object for testing.
This is a helper method to create an invokable object for testing which can be used to track invocations, including arguments provided.
This can be useful for modifications to the error handler.
object |
database_driver_testcase::getDebuggingMessages | ( | ) |
Return debugging messages from the current test.
array | with instances having 'message', 'level' and 'stacktrace' property. |
|
staticprotectedinherited |
Recursively get flat array of all descendants of this node.
DOMNode | $node |
array |
|
staticprotectedinherited |
Gets elements by case insensitive tagname.
DOMDocument | $dom | |
string | $tag |
DOMNodeList |
|
staticprotectedinherited |
Helper to get the count of invocation.
This is required because the method to use changed names in PHPUnit 10.0 in a breaking change.
PHPUnit::Framework::MockObject::Rule::InvocationOrder | $counter |
int |
|
staticprotectedinherited |
Get the text value of this node's child text node.
DOMNode | $node |
string |
|
inherited |
Determine whether the test is running in isolation.
Note: This was previously a public method of the TestCase, but as removed in PHPUnit 10. There is no direct replacement, but we can use reflection to access the protected property.
bool |
|
staticinherited |
Load HTML into a DomDocument.
Note: THis is a replacement for functionality removed from PHPUnit 10.
string | $actual |
PHPUnit::Util::Xml::XmlException |
DOMDocument |