summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/filerepo/FileRepoTest.php
blob: 8f92c123e6f5a705f2f514b0b617f0ad2fad174e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

class FileRepoTest extends MediaWikiTestCase {

	/**
	 * @expectedException MWException
	 */
	function testFileRepoConstructionOptionCanNotBeNull() {
		$f = new FileRepo();
	}
	/**
	 * @expectedException MWException
	 */
	function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
		$f = new FileRepo( array() );
	}
	/**
	 * @expectedException MWException
	 */
	function testFileRepoConstructionOptionNeedNameKey() {
		$f = new FileRepo( array(
			'backend' => 'foobar'
		) );
	}
	/**
	 * @expectedException MWException
	 */
	function testFileRepoConstructionOptionNeedBackendKey() {
		$f = new FileRepo( array(
			'name' => 'foobar'
		) );
	}

	function testFileRepoConstructionWithRequiredOptions() {
		$f = new FileRepo( array(
			'name'    => 'FileRepoTestRepository',
			'backend' => new FSFileBackend( array(
				'name'           => 'local-testing',
				'lockManager'    => 'nullLockManager',
				'containerPaths' => array()
			) )
		) );
		$this->assertInstanceOf( 'FileRepo', $f );
	}
}