wiki.techinc.nl/tests/phpunit/includes/filerepo/FileRepoTest.php
Aryeh Gregor b4a7620b9e Hard-deprecate Title::getUserCaseDBKey
The only use-case for this was if the local wiki's File namespace didn't
allow initial-lowercase names but a remote repo did. This case is
unlikely to be useful and was broken anyway, so it's now prohibited, and
getUserCaseDBKey is no longer needed. It's now an alias for getDBkey
until we remove it.

This includes a breaking change to
MediaWikiTitleCodec::splitTitleString, but that was always intended as
an internal method and I have now marked it officially as such. There is
one caller in code search outside core (JsonConfig), but it looks like
it will be unaffected.

Bug: T202094
Depends-On: I4b8ceb8a7f4624d6a3763aca6df41bf1a0d7293f
Depends-On: I724be15e93421f874fb202f0ec2ca6940e56a20a
Change-Id: I4fd64d4b0036b6dabdcfeee18766df18bf538542
2019-10-24 19:26:37 +03:00

71 lines
1.6 KiB
PHP

<?php
class FileRepoTest extends MediaWikiTestCase {
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeNull() {
$this->expectException( MWException::class );
new FileRepo();
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
$this->expectException( MWException::class );
new FileRepo( [] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedNameKey() {
$this->expectException( MWException::class );
new FileRepo( [
'backend' => 'foobar'
] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedBackendKey() {
$this->expectException( MWException::class );
new FileRepo( [
'name' => 'foobar'
] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionWithRequiredOptions() {
$f = new FileRepo( [
'name' => 'FileRepoTestRepository',
'backend' => new FSFileBackend( [
'name' => 'local-testing',
'wikiId' => 'test_wiki',
'containerPaths' => []
] )
] );
$this->assertInstanceOf( FileRepo::class, $f );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionWithInvalidCasing() {
$this->expectException( InvalidArgumentException::class );
$this->expectExceptionMessage( 'File repos with initial capital false' );
$this->setMwGlobals( 'wgCapitalLinks', true );
new FileRepo( [
'name' => 'foobar',
'backend' => 'local-backend',
'initialCapital' => false,
] );
}
}