The simplest PHPUnit test case customised for Moodle.
More...
|
| __construct ($name=null, array $data=array(), $dataName='') |
| Constructs a test case with the given name.
|
|
| assertEqualsIgnoringWhitespace ($expected, $actual, string $message='') |
| Assert that two Date/Time strings are equal.
|
|
| runBare () |
| Runs the bare test sequence and log any changes in global state or database.
|
|
|
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.
|
|
The simplest PHPUnit test case customised for Moodle.
- Copyright
- 2012 Petr Skoda
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
It is intended for isolated tests that do not modify database or any globals.
- Copyright
- 2012 Petr Skoda
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
basic_testcase::__construct |
( |
| $name = null, |
|
|
array | $data = array(), |
|
|
| $dataName = '' ) |
|
final |
Constructs a test case with the given name.
Note: use setUp() or setUpBeforeClass() in your test cases.
- Parameters
-
string | $name | |
array | $data | |
string | $dataName | |
◆ assertEqualsIgnoringWhitespace()
base_testcase::assertEqualsIgnoringWhitespace |
( |
| $expected, |
|
|
| $actual, |
|
|
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.
- Parameters
-
string | $expected | |
string | $actual | |
string | $message | |
◆ assertNotTag()
static base_testcase::assertNotTag |
( |
| $matcher, |
|
|
| $actual, |
|
|
| $message = '', |
|
|
| $ishtml = true ) |
|
staticinherited |
◆ assertTag()
static base_testcase::assertTag |
( |
| $matcher, |
|
|
| $actual, |
|
|
| $message = '', |
|
|
| $ishtml = true ) |
|
staticinherited |
◆ assertValidKeys()
static base_testcase::assertValidKeys |
( |
array | $hash, |
|
|
array | $validKeys ) |
|
staticinherited |
Validate list of keys in the associative array.
- Parameters
-
array | $hash | |
array | $validKeys | |
- Return values
-
- Exceptions
-
PHPUnit\Framework\Exception | |
◆ findNodes()
static base_testcase::findNodes |
( |
DOMDocument | $dom, |
|
|
array | $options, |
|
|
| $isHtml = true ) |
|
staticinherited |
Parse out the options from the tag using DOM object tree.
- Parameters
-
DOMDocument | $dom | |
array | $options | |
bool | $isHtml | |
- Return values
-
◆ getDescendants()
static base_testcase::getDescendants |
( |
DOMNode | $node | ) |
|
|
staticprotectedinherited |
Recursively get flat array of all descendants of this node.
- Parameters
-
- Return values
-
◆ getElementsByCaseInsensitiveTagName()
static base_testcase::getElementsByCaseInsensitiveTagName |
( |
DOMDocument | $dom, |
|
|
| $tag ) |
|
staticprotectedinherited |
Gets elements by case insensitive tagname.
- Parameters
-
DOMDocument | $dom | |
string | $tag | |
- Return values
-
◆ getNodeText()
static base_testcase::getNodeText |
( |
DOMNode | $node | ) |
|
|
staticprotectedinherited |
Get the text value of this node's child text node.
- Parameters
-
- Return values
-
◆ runBare()
basic_testcase::runBare |
( |
| ) |
|
|
final |
Runs the bare test sequence and log any changes in global state or database.
- Return values
-
The documentation for this class was generated from the following file:
- lib/phpunit/classes/basic_testcase.php