2012-01-23 14:50:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
class FileRepoTest extends MediaWikiTestCase {
|
2013-10-21 08:46:11 +00:00
|
|
|
|
2012-01-23 14:50:54 +00:00
|
|
|
/**
|
|
|
|
|
* @expectedException MWException
|
2013-10-21 08:46:11 +00:00
|
|
|
* @covers FileRepo::__construct
|
2012-01-23 14:50:54 +00:00
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testFileRepoConstructionOptionCanNotBeNull() {
|
2013-04-26 07:48:46 +00:00
|
|
|
new FileRepo();
|
2012-01-23 14:50:54 +00:00
|
|
|
}
|
2013-02-15 10:17:52 +00:00
|
|
|
|
2012-01-23 14:50:54 +00:00
|
|
|
/**
|
|
|
|
|
* @expectedException MWException
|
2013-10-21 08:46:11 +00:00
|
|
|
* @covers FileRepo::__construct
|
2012-01-23 14:50:54 +00:00
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
|
2016-02-17 09:09:32 +00:00
|
|
|
new FileRepo( [] );
|
2012-01-23 14:50:54 +00:00
|
|
|
}
|
2013-02-15 10:17:52 +00:00
|
|
|
|
2012-01-23 14:50:54 +00:00
|
|
|
/**
|
|
|
|
|
* @expectedException MWException
|
2013-10-21 08:46:11 +00:00
|
|
|
* @covers FileRepo::__construct
|
2012-01-23 14:50:54 +00:00
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testFileRepoConstructionOptionNeedNameKey() {
|
2016-02-17 09:09:32 +00:00
|
|
|
new FileRepo( [
|
2012-01-23 14:50:54 +00:00
|
|
|
'backend' => 'foobar'
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2012-01-23 14:50:54 +00:00
|
|
|
}
|
2013-02-15 10:17:52 +00:00
|
|
|
|
2012-01-23 14:50:54 +00:00
|
|
|
/**
|
|
|
|
|
* @expectedException MWException
|
2013-10-21 08:46:11 +00:00
|
|
|
* @covers FileRepo::__construct
|
2012-01-23 14:50:54 +00:00
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testFileRepoConstructionOptionNeedBackendKey() {
|
2016-02-17 09:09:32 +00:00
|
|
|
new FileRepo( [
|
2012-01-23 14:50:54 +00:00
|
|
|
'name' => 'foobar'
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2012-01-23 14:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-21 08:46:11 +00:00
|
|
|
/**
|
|
|
|
|
* @covers FileRepo::__construct
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testFileRepoConstructionWithRequiredOptions() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$f = new FileRepo( [
|
2013-02-15 10:17:52 +00:00
|
|
|
'name' => 'FileRepoTestRepository',
|
2016-02-17 09:09:32 +00:00
|
|
|
'backend' => new FSFileBackend( [
|
2013-02-15 10:17:52 +00:00
|
|
|
'name' => 'local-testing',
|
2013-12-03 20:55:44 +00:00
|
|
|
'wikiId' => 'test_wiki',
|
2016-02-17 09:09:32 +00:00
|
|
|
'containerPaths' => []
|
|
|
|
|
] )
|
|
|
|
|
] );
|
2012-02-07 14:54:06 +00:00
|
|
|
$this->assertInstanceOf( 'FileRepo', $f );
|
|
|
|
|
}
|
2012-01-23 14:50:54 +00:00
|
|
|
}
|