* @since 1.18
*/
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
-
/**
* $called tracks whether the setUp and tearDown method has been called.
* class extending MediaWikiTestCase usually override setUp and tearDown
*
* @since 1.20
*
- * @return string absolute name of the temporary file
+ * @return string Absolute name of the temporary file
*/
protected function getNewTempFile() {
$fileName = tempnam( wfTempDir(), 'MW_PHPUnit_' . get_class( $this ) . '_' );
$GLOBALS[$key] = $value;
}
$this->mwGlobals = array();
+ RequestContext::resetMain();
+ MediaHandler::resetCache();
$phpErrorLevel = intval( ini_get( 'error_reporting' ) );
$oldHex = strtoupper( dechex( $this->phpErrorLevel ) );
$newHex = strtoupper( dechex( $phpErrorLevel ) );
- $message = "PHP error_reporting setting was left dirty: was 0x$oldHex before test, 0x$newHex after test!";
+ $message = "PHP error_reporting setting was left dirty: "
+ . "was 0x$oldHex before test, 0x$newHex after test!";
$this->fail( $message );
}
//Make 1 page with 1 revision
$page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
- if ( !$page->getId() == 0 ) {
+ if ( $page->getId() == 0 ) {
$page->doEditContent(
new WikitextContent( 'UTContent' ),
'UTPageSummary',
* even if using different parameters.
*
* @param DatabaseBase $db The database connection
- * @param String $prefix The prefix to use for the new table set (aka schema).
+ * @param string $prefix The prefix to use for the new table set (aka schema).
*
* @throws MWException if the database table prefix is already $prefix
*/
/**
* Used as a compatibility method for phpunit < 3.7.32
+ * @param string $value
+ * @param string $msg
*/
private function assertEmpty2( $value, $msg ) {
return $this->assertTrue( $value == '', $msg );
/**
* @since 1.18
+ * @param string $offset
+ * @return mixed
*/
public function getCliArg( $offset ) {
if ( isset( MediaWikiPHPUnitCommand::$additionalOptions[$offset] ) ) {
/**
* @since 1.18
+ * @param string $offset
+ * @param mixed $value
*/
public function setCliArg( $offset, $value ) {
MediaWikiPHPUnitCommand::$additionalOptions[$offset] = $value;
* @since 1.19
*
* @param string $function
- * @return null
*/
public function hideDeprecated( $function ) {
wfSuppressWarnings();
* @param bool $ordered If the order of the values should match
* @param bool $named If the keys should match
*/
- protected function assertArrayEquals( array $expected, array $actual, $ordered = false, $named = false ) {
+ protected function assertArrayEquals( array $expected, array $actual,
+ $ordered = false, $named = false
+ ) {
if ( !$ordered ) {
$this->objectAssociativeSort( $expected );
$this->objectAssociativeSort( $actual );
* test whenever it is not loaded.
*
* @since 1.21
+ * @param string $extName
+ * @return bool
*/
protected function checkPHPExtension( $extName ) {
$loaded = extension_loaded( $extName );
$this->assertEmpty( $errors, implode( "\n", $errors ) );
}
-
}