wiki.techinc.nl/tests/phpunit/includes/filerepo/FileRepoTest.php
Aaron Schulz 1f129a22cb filebackend: cleaned up the FileBackend constructor
* Moved some of the graph construction work to FileBackendGroup.
  This helps the code in not depending on the rest of MW so much.
* Updated tests and FileBackendMultiwrite, which are the only things
  directly constructing FileBackend objects.

Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
2013-11-23 20:21:53 -08:00

55 lines
1.2 KiB
PHP

<?php
class FileRepoTest extends MediaWikiTestCase {
/**
* @expectedException MWException
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeNull() {
new FileRepo();
}
/**
* @expectedException MWException
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
new FileRepo( array() );
}
/**
* @expectedException MWException
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedNameKey() {
new FileRepo( array(
'backend' => 'foobar'
) );
}
/**
* @expectedException MWException
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedBackendKey() {
new FileRepo( array(
'name' => 'foobar'
) );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionWithRequiredOptions() {
$f = new FileRepo( array(
'name' => 'FileRepoTestRepository',
'backend' => new FSFileBackend( array(
'name' => 'local-testing',
'wikiId' => 'test_wiki',
'containerPaths' => array()
) )
) );
$this->assertInstanceOf( 'FileRepo', $f );
}
}