Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5979307
SearchUpdateSpyTrait.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
SearchUpdateSpyTrait.php
View Options
<?php
namespace
MediaWiki\Tests\Search
;
use
SearchEngine
;
use
SearchEngineFactory
;
/**
* Trait for asserting that the search component is getting notified
* about changes as expected.
*/
trait
SearchUpdateSpyTrait
{
/**
* Register expectations about updates that should get triggered.
* The parameters of this method represent known kinds of updates.
* If a parameter is added, tests calling this method should be forced
* to specify their expectations with respect to that kind of update.
* For this reason, this method should not be split, and all parameters
* should be required.
*/
private
function
expectSearchUpdates
(
int
$searchEngineCreate
)
{
// Make sure SearchEventIngress is triggered and tries to re-index the page
$searchEngine
=
$this
->
createNoOpMock
(
SearchEngine
::
class
,
[
'supports'
]
);
$searchEngine
->
method
(
'supports'
)->
willReturn
(
false
);
$searchEngineFactory
=
$this
->
createNoOpMock
(
SearchEngineFactory
::
class
,
[
'create'
]
);
// this is the relevant assertion:
$searchEngineFactory
->
expects
(
$this
->
exactly
(
$searchEngineCreate
)
)
->
method
(
'create'
)->
willReturn
(
$searchEngine
);
$this
->
setService
(
'SearchEngineFactory'
,
$searchEngineFactory
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:51 (4 d, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fe/3f/3aa214621698fdd3d8647bf56356
Default Alt Text
SearchUpdateSpyTrait.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment