Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4139896
VisualEditorHookRunnerTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
VisualEditorHookRunnerTest.php
View Options
<?php
namespace
MediaWiki\Extension\VisualEditor\Tests
;
use
MediaWiki\Extension\VisualEditor\VisualEditorHookRunner
;
use
MediaWiki\HookContainer\HookContainer
;
use
MediaWiki\Page\PageIdentityValue
;
use
MediaWiki\User\UserIdentityValue
;
use
MediaWikiUnitTestCase
;
/**
* @covers \MediaWiki\Extension\VisualEditor\VisualEditorHookRunner
*/
class
VisualEditorHookRunnerTest
extends
MediaWikiUnitTestCase
{
public
function
testPreSaveHook
()
{
$container
=
$this
->
createNoOpMock
(
HookContainer
::
class
,
[
'run'
]
);
$container
->
expects
(
$this
->
once
()
)
->
method
(
'run'
)
->
with
(
'VisualEditorApiVisualEditorEditPreSave'
,
$this
->
isType
(
'array'
),
[
'abortable'
=>
true
]
)
->
willReturn
(
true
);
$runner
=
new
VisualEditorHookRunner
(
$container
);
$apiResponse
=
[];
$params
=
[];
$result
=
$runner
->
onVisualEditorApiVisualEditorEditPreSave
(
PageIdentityValue
::
localIdentity
(
0
,
0
,
'test'
),
UserIdentityValue
::
newAnonymous
(
''
),
''
,
$params
,
[],
$apiResponse
);
$this
->
assertTrue
(
$result
);
}
public
function
testPostSaveHook
()
{
$container
=
$this
->
createNoOpMock
(
HookContainer
::
class
,
[
'run'
]
);
$container
->
expects
(
$this
->
once
()
)
->
method
(
'run'
)
->
with
(
'VisualEditorApiVisualEditorEditPostSave'
,
$this
->
isType
(
'array'
),
[
'abortable'
=>
false
]
);
$runner
=
new
VisualEditorHookRunner
(
$container
);
$apiResponse
=
[];
$runner
->
onVisualEditorApiVisualEditorEditPostSave
(
PageIdentityValue
::
localIdentity
(
0
,
0
,
'test'
),
UserIdentityValue
::
newAnonymous
(
''
),
''
,
[],
[],
[],
$apiResponse
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 15:16 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ae/fe/f24b64496d4c428790e984c7d592
Default Alt Text
VisualEditorHookRunnerTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment