Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Base test case class.

Author: Tony Levi <tony.levi@blackboard.com>
Copyright: 2015 Blackboard (http://www.blackboard.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 574 lines (19 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

base_testcase:: (7 methods):
  assertTag()
  assertNotTag()
  assertValidKeys()
  findNodes()
  getDescendants()
  getElementsByCaseInsensitiveTagName()
  getNodeText()


Class: base_testcase  - X-Ref

Base class for PHPUnit test cases customised for Moodle

It is intended for functionality common to both basic and advanced_testcase.

assertTag($matcher, $actual, $message = '', $ishtml = true)   X-Ref
Note: we are overriding this method to remove the deprecated error

param: array   $matcher
param: string  $actual
param: string  $message
param: boolean $ishtml

assertNotTag($matcher, $actual, $message = '', $ishtml = true)   X-Ref
Note: we are overriding this method to remove the deprecated error

param: array   $matcher
param: string  $actual
param: string  $message
param: boolean $ishtml

assertValidKeys(array $hash, array $validKeys)   X-Ref
Validate list of keys in the associative array.

param: array $hash
param: array $validKeys
return: array

findNodes(DOMDocument $dom, array $options, $isHtml = true)   X-Ref
Parse out the options from the tag using DOM object tree.

param: DOMDocument $dom
param: array       $options
param: bool        $isHtml
return: array

getDescendants(DOMNode $node)   X-Ref
Recursively get flat array of all descendants of this node.

param: DOMNode $node
return: array

getElementsByCaseInsensitiveTagName(DOMDocument $dom, $tag)   X-Ref
Gets elements by case insensitive tagname.

param: DOMDocument $dom
param: string      $tag
return: DOMNodeList

getNodeText(DOMNode $node)   X-Ref
Get the text value of this node's child text node.

param: DOMNode $node
return: string