2 namespace Friendica\Test\src\Util;
4 use Friendica\Test\MockedTest;
5 use Friendica\Util\BasePath;
7 class BasePathTest extends MockedTest
9 public function dataPaths()
14 'input' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
15 'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
20 'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
24 'DOCUMENT_ROOT' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
27 'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
31 'PWD' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
34 'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
38 'DOCUMENT_ROOT' => dirname(__DIR__, 3),
39 'PWD' => dirname(__DIR__, 3),
42 'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
48 * Test the basepath determination
49 * @dataProvider dataPaths
51 public function testDetermineBasePath(array $server, $input, $output)
53 $this->assertEquals($output, BasePath::create($input, $server));
57 * Test the basepath determination with a complete wrong path
58 * @expectedException \Exception
59 * @expectedExceptionMessageRegExp /(.*) is not a valid basepath/
61 public function testFailedBasePath()
63 BasePath::create('/now23452sgfgas', []);