Thread:Project:Support desk/Run parser tests suites

Hi,

I am using MediaWiki source code to develop my website. I wanted to run the test suites as I think continuous integration rocks ! So I started with the php tests/parserTests.php command line to run the parser tests. However this conflicts with my database. It literally suppressed my user table.

I then run the MediaWiki initial script again to end up with a new database I would use only for testing purposes. But when I run the php tests/parserTests.php command line, I now end up with the following error message: This is MediaWiki version 1.19.1.

PHP Warning: Invalid argument supplied for foreach in path_to_MediaWiki/includes/SpecialPageFactory.php on line 548

Warning: Invalid argument supplied for foreach in path_to_MediaWiki/includes/SpecialPageFactory.php on line 548 PHP Fatal error: Unsupported operand types in path_to_MediaWiki/languages/Language.php on line 353

Fatal error: Unsupported operand types in path_to_MediaWiki/languages/Language.php on line 353

Here is what SpecialPageFactory.php looks like on line 548: /**	 * Get the local name for a specified canonical name *	 * @param $name String * @param $subpage String|Bool *	 * @return String */	static function getLocalNameFor( $name, $subpage = false ) { global $wgContLang; //echo get_class( $wgContLang ) ." "; $aliases = $wgContLang->getSpecialPageAliases;

if ( isset( $aliases[$name][0] ) ) { $name = $aliases[$name][0]; } else { // Try harder in case someone misspelled the correct casing $found = false; foreach ( $aliases as $n => $values ) { /** LINE 548 **/ if ( strcasecmp( $name, $n ) === 0 ) { wfWarn( "Found alias defined for $n when searching for " .						"special page aliases for $name. Case mismatch?" ); $name = $values[0]; $found = true; break; }			}			if ( !$found ) { wfWarn( "Did not find alias for special page '$name'. " .					"Perhaps no aliases are defined for it?" ); }		}		if ( $subpage !== false && !is_null( $subpage ) ) { $name = "$name/$subpage"; }		return $wgContLang->ucfirst( $name ); }

Here is what Language.php looks like on line 353: /**	 * @return array */	public function getNamespaces { if ( is_null( $this->namespaceNames ) ) { global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces;

$this->namespaceNames = self::$dataCache->getItem( $this->mCode, 'namespaceNames' ); $validNamespaces = MWNamespace::getCanonicalNamespaces; $this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames + $validNamespaces; /** LINE 353 **/

$this->namespaceNames[NS_PROJECT] = $wgMetaNamespace; if ( $wgMetaNamespaceTalk ) { $this->namespaceNames[NS_PROJECT_TALK] = $wgMetaNamespaceTalk; } else { $talk = $this->namespaceNames[NS_PROJECT_TALK]; $this->namespaceNames[NS_PROJECT_TALK] = $this->fixVariableInNamespace( $talk ); }

# Sometimes a language will be localised but not actually exist on this wiki. foreach ( $this->namespaceNames as $key => $text ) { if ( !isset( $validNamespaces[$key] ) ) { unset( $this->namespaceNames[$key] ); }			}

# The above mixing may leave namespaces out of canonical order. # Re-order by namespace ID number... ksort( $this->namespaceNames );

wfRunHooks( 'LanguageGetNamespaces', array( &$this->namespaceNames ) ); }		return $this->namespaceNames; }

Would someone knowledgeable about those test suites could write a Setting a testing database part so everyone can benefit from those already written tests ? It may already exists but I did not find it (yet).

Otherwise, if someone has the solution to my particular problem, this would also be appreciated. :)

Thank you very much in advance for your time and help.