Extension:MWUnit/Assertions

This appendix lists the various assertion parser functions that are available.

#assert_equals
Reports an error identified by  if and only if the two variables,   and   are not identical to each other.

#assert_equals_ignore_case
Reports an error identified by  if and only if the two variables,   and   are not identical to each other. Differences in casing are ignored in the comparison.

#assert_error
Reports an error identified by  if and only if   does not contain at least one ,  ,   or   tag with the attribute. Tags with this attribute are usually returned by parser functions.

#assert_greater_than
Reports an error identified by  if and only if   is not greater than.

#assert_greater_than_or_equal
Reports an error identified by  if and only if   is not greater than or equal to.

#assert_has_length
Reports an error identified by  if and only if   is not exactly   characters in size.

#assert_empty
Reports an error identified by  if and only if   is not empty.

#assert_is_integer
Reports an error identified by  if and only if   is not an integer. A value is only considered an integer if it only consists of numeric characters.

#assert_is_numeric
Reports an error identified by  if and only if   is not numeric. You can read more about which values are considered numeric on the PHP website.

#assert_less_than
Reports an error identified by  if and only if   is not less than.

#assert_less_than_or_equal
Reports an error identified by  if and only if   is not less than or equal to.

#assert_no_error
Reports an error identified by  if and only if   contains at least one ,  ,   or   tag with the attribute. Tags with this element are usually returned by parser functions.

#assert_not_empty
Reports an error identified by  if and only if   is empty.

#assert_page_exists
Reports an error identified by  if and only if the page specified by   does not exist. must include the namespace if the page is not located in the main namespace.

#assert_string_contains
Reports an error identified by  if and only if   is not contained within.

#assert_string_contains_ignore_case
Reports an error identified by  if and only if   is not contained within. Differences in casing are ignored in the comparison.

#assert_string_ends_with
Reports an error identified by  if and only if   is not at the end of.

#assert_string_starts_with
Reports an error identified by  if and only if   is not at the start of.

#assert_that
Reports an error identified by  if and only if   is not one of the following values:


 * true
 * yes
 * on
 * 1

This assertion can be useful for asserting more complex propositions.

#assert_has_property
Reports an error identified by  if and only if the page given by   does not have the property given by

#assert_property_has_value
Reports an error identified by  if and only if the property given by   on the page given by   does not have the value given by.