array(
'tr_date' => $this->db->timestamp(),
'tr_mw_version' => $this->version,
- 'tr_php_version' => phpversion(),
+ 'tr_php_version' => PHP_VERSION,
'tr_db_version' => $this->db->getServerVersion(),
'tr_uname' => php_uname()
),
continue;
}
+ if ( $this->section == 'endtransparenthooks' ) {
+ $this->checkSection( 'transparenthooks' );
+
+ foreach ( explode( "\n", $this->sectionData['transparenthooks'] ) as $line ) {
+ $line = trim( $line );
+
+ if ( $line ) {
+ $delayedParserTest->requireTransparentHook( $line );
+ }
+ }
+
+ $this->clearSection();
+
+ continue;
+ }
+
if ( $this->section == 'end' ) {
$this->checkSection( 'test' );
// "input" and "result" are old section names allowed
/** Initialized on construction */
private $hooks;
private $fnHooks;
+ private $transparentHooks;
public function __construct() {
$this->reset();
public function reset() {
$this->hooks = array();
$this->fnHooks = array();
+ $this->transparentHooks = array();
}
/**
}
}
+ # Trigger delayed transparent hooks. Any failure will make us abort
+ foreach ( $this->transparentHooks as $hook ) {
+ $ret = $parserTest->requireTransparentHook( $hook );
+ if ( !$ret ) {
+ return false;
+ }
+ }
+
# Delayed execution was successful.
return true;
}
$this->fnHooks[] = $fnHook;
}
+ /**
+ * Similar to ParserTest object but does not run anything
+ * Use unleash() to really execute the hook function
+ * @param string $fnHook
+ */
+ public function requireTransparentHook( $hook ) {
+ $this->transparentHooks[] = $hook;
+ }
+
}
/**