Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7435905
LinksMigrationTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
LinksMigrationTest.php
View Options
<?php
use
MediaWiki\Config\HashConfig
;
use
MediaWiki\Linker\LinksMigration
;
use
MediaWiki\Linker\LinkTargetLookup
;
use
MediaWiki\Title\TitleValue
;
/**
* @covers \MediaWiki\Linker\LinksMigration
*/
class
LinksMigrationTest
extends
MediaWikiUnitTestCase
{
public
static
function
provideReadNew
()
{
yield
[
SCHEMA_COMPAT_READ_NEW
];
yield
[
SCHEMA_COMPAT_NEW
];
}
/**
* @dataProvider provideReadNew
* @covers \MediaWiki\Linker\LinksMigration::getLinksConditions
*/
public
function
testGetLinksConditionsReadNew
(
$configValue
)
{
$this
->
markTestSkipped
(
'There is currently no xxxlinks table which has a migration config.'
);
$title
=
new
TitleValue
(
NS_CATEGORY
,
'Somecategory'
);
$linkTargetStore
=
$this
->
createMock
(
LinkTargetLookup
::
class
);
$linkTargetStore
->
method
(
'getLinkTargetId'
)
->
with
(
$title
)
->
willReturn
(
1
);
$linkTargetStore
->
expects
(
$this
->
never
()
)->
method
(
'acquireLinkTargetId'
);
$config
=
new
HashConfig
(
[
'SchemaMigrationStage'
=>
$configValue
]
);
$linksMigration
=
new
LinksMigration
(
$config
,
$linkTargetStore
);
$this
->
assertSame
(
[
'cl_target_id'
=>
1
],
$linksMigration
->
getLinksConditions
(
'categorylinks'
,
$title
)
);
}
public
static
function
provideReadOld
()
{
yield
[
SCHEMA_COMPAT_READ_OLD
];
}
/**
* @dataProvider provideReadOld
* @covers \MediaWiki\Linker\LinksMigration::getLinksConditions
*/
public
function
testGetLinksConditionsReadOld
(
$configValue
)
{
$this
->
markTestSkipped
(
'There is currently no xxxlinks table which has a migration config.'
);
$title
=
new
TitleValue
(
NS_CATEGORY
,
'Somecategory'
);
$linkTargetStore
=
$this
->
createMock
(
LinkTargetLookup
::
class
);
$linkTargetStore
->
expects
(
$this
->
never
()
)->
method
(
'getLinkTargetId'
);
$linkTargetStore
->
expects
(
$this
->
never
()
)->
method
(
'acquireLinkTargetId'
);
$config
=
new
HashConfig
(
[
'SchemaMigrationStage'
=>
$configValue
]
);
$linksMigration
=
new
LinksMigration
(
$config
,
$linkTargetStore
);
$this
->
assertSame
(
[
14
=>
NS_CATEGORY
,
'cl_to'
=>
'Somecategory'
],
$linksMigration
->
getLinksConditions
(
'categorylinks'
,
$title
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 13:10 (1 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
76/14/8c631bb1275076fb57a086f8b1e3
Default Alt Text
LinksMigrationTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment