wiki.techinc.nl/tests/phpunit/includes/filerepo/FileRepoTest.php
addshore 959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00

71 lines
1.6 KiB
PHP

<?php
class FileRepoTest extends MediaWikiIntegrationTestCase {
/**
* @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,
] );
}
}