Go to the documentation of this file.
9 unset(
$wgHooks[
'MediaWikiHooksTest001'] );
16 array(
'Object and method',
array( $i,
'someNonStatic' ),
'changed-nonstatic',
'changed-nonstatic' ),
17 array(
'Object and no method',
array( $i ),
'changed-onevent',
'original' ),
18 array(
'Object and method with data',
array( $i,
'someNonStaticWithData',
'data' ),
'data',
'original' ),
19 array(
'Object and static method',
array( $i,
'someStatic' ),
'changed-static',
'original' ),
20 array(
'Class::method static call',
array(
'NothingClass::someStatic' ),
'changed-static',
'original' ),
21 array(
'Global function',
array(
'NothingFunction' ),
'changed-func',
'original' ),
22 array(
'Global function with data',
array(
'NothingFunctionData',
'data' ),
'data',
'original' ),
23 array(
'Closure',
array(
function ( &$foo, $bar ) {
24 $foo =
'changed-closure';
27 } ),
'changed-closure',
'original' ),
28 array(
'Closure with data',
array(
function ( $data, &$foo, $bar ) {
32 },
'data' ),
'data',
'original' )
42 $foo = $bar =
'original';
44 $wgHooks[
'MediaWikiHooksTest001'][] = $hook;
47 $this->assertSame( $expectedFoo, $foo, $msg );
48 $this->assertSame( $expectedBar, $bar, $msg );
57 $foo = $bar =
'original';
62 $this->assertSame( $expectedFoo, $foo, $msg );
63 $this->assertSame( $expectedBar, $bar, $msg );
78 $wgHooks[
'MediaWikiHooksTest001'][] = $a;
79 $this->assertTrue(
Hooks::isRegistered(
'MediaWikiHooksTest001' ),
'Hook registered via $wgHooks should be noticed by Hooks::isRegistered' );
82 $this->assertEquals( 2, count(
Hooks::getHandlers(
'MediaWikiHooksTest001' ) ),
'Hooks::getHandlers() should return hooks registered via wgHooks as well as Hooks::register' );
88 $this->assertEquals( 1, $a->calls,
'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register' );
89 $this->assertEquals( 1, $b->calls,
'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register' );
115 $this->assertSame(
'original', $foo,
'Hooks continued processing after a false return.' );
131 $foo =
'changed-func';
146 $foo =
'changed-static';
153 $foo =
'changed-nonstatic';
154 $bar =
'changed-nonstatic';
161 $foo =
'changed-onevent';
testFalseReturn()
@covers Hooks::run
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static getHandlers( $name)
Returns an array of all the event functions attached to a hook This combines functions registered via...
someNonStatic(&$foo, &$bar)
testFatalError()
@expectedException FatalError @covers Hooks::run
NothingFunctionData( $data, &$foo, &$bar)
static clear( $name)
Clears hooks registered via Hooks::register().
$wgHooks['ArticleShow'][]
testUncallableFunction()
@expectedException MWException @covers Hooks::run
NothingFunction(&$foo, &$bar)
static someStatic(&$foo, &$bar)
onMediaWikiHooksTest001(&$foo, &$bar)
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
testOldStyleHooks( $msg, array $hook, $expectedFoo, $expectedBar)
@dataProvider provideHooks @covers wfRunHooks
static register( $name, $callback)
Attach an event handler to a given hook.
static run( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static isRegistered( $name)
Returns true if a hook has a function registered to it.
testNewStyleHooks( $msg, $hook, $expectedFoo, $expectedBar)
@dataProvider provideHooks @covers Hooks::register @covers Hooks::run
someNonStaticWithData( $data, &$foo, &$bar)
testNewStyleHookInteraction()
@covers Hooks::isRegistered @covers Hooks::register @covers Hooks::getHandlers @covers Hooks::run