]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/BasePathTest.php
Merge branch 'stable' into develop
[friendica.git] / tests / src / Util / BasePathTest.php
index c31adb079e0d888c94e86c42e354241a02be37f3..7cdf612e64aa2ce31f40aeba0408ce8362c41335 100644 (file)
@@ -40,6 +40,14 @@ class BasePathTest extends MockedTest
                                ],
                                'input' => 'config',
                                'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
+                       ],
+                       'no_overwrite_if_invalid' => [
+                               'server' => [
+                                       'DOCUMENT_ROOT' => '/nopopop',
+                                       'PWD' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
+                               ],
+                               'input' => '/noatgawe22fafa',
+                               'output' => dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'config',
                        ]
                ];
        }
@@ -50,16 +58,19 @@ class BasePathTest extends MockedTest
         */
        public function testDetermineBasePath(array $server, $input, $output)
        {
-               $this->assertEquals($output, BasePath::create($input, $server));
+               $basepath = new BasePath($input, $server);
+               self::assertEquals($output, $basepath->getPath());
        }
 
        /**
         * Test the basepath determination with a complete wrong path
-        * @expectedException \Exception
-        * @expectedExceptionMessageRegExp /(.*) is not a valid basepath/
         */
        public function testFailedBasePath()
        {
-               BasePath::create('/now23452sgfgas', []);
+               $this->expectException(\Exception::class);
+               $this->expectExceptionMessageMatches("/(.*) is not a valid basepath/");
+               
+               $basepath = new BasePath('/now23452sgfgas', []);
+               $basepath->getPath();
        }
 }