2021-08-26 10:09:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\VisualEditor\Tests;
|
|
|
|
|
2022-03-13 01:38:23 +00:00
|
|
|
use MediaWiki\Extension\VisualEditor\SpecialCollabPad;
|
2021-08-26 10:09:27 +00:00
|
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
use Title;
|
|
|
|
|
|
|
|
/**
|
2022-03-13 01:38:23 +00:00
|
|
|
* @covers \MediaWiki\Extension\VisualEditor\SpecialCollabPad
|
2021-08-26 10:09:27 +00:00
|
|
|
*/
|
|
|
|
class SpecialCollabPadTest extends MediaWikiIntegrationTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider provideSubPages
|
|
|
|
*/
|
|
|
|
public function testGetSubPage( string $title, ?string $expected ) {
|
|
|
|
$result = SpecialCollabPad::getSubPage( Title::newFromText( $title ) );
|
|
|
|
$this->assertSame(
|
|
|
|
$expected,
|
|
|
|
$result ? $result->getPrefixedText() : $result
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function provideSubPages() {
|
|
|
|
return [
|
|
|
|
[ 'Special:CollabPad', null ],
|
|
|
|
[ 'Special:CollabPad/', null ],
|
|
|
|
[ 'Special:CollabPad/B_b', 'B b' ],
|
|
|
|
[ 'Special:CollabPad/B b', 'B b' ],
|
|
|
|
[ 'Special:CollabPad/B/C', 'B/C' ],
|
|
|
|
[ 'Special:CollabPad/B/C/', 'B/C/' ],
|
|
|
|
[ '/B/C', null ],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|