diff options
Diffstat (limited to 'tests/front/controller/visitor/InstallControllerTest.php')
-rw-r--r-- | tests/front/controller/visitor/InstallControllerTest.php | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/front/controller/visitor/InstallControllerTest.php b/tests/front/controller/visitor/InstallControllerTest.php index 3b855365..994d3f33 100644 --- a/tests/front/controller/visitor/InstallControllerTest.php +++ b/tests/front/controller/visitor/InstallControllerTest.php | |||
@@ -257,6 +257,39 @@ class InstallControllerTest extends TestCase | |||
257 | static::assertSame('/subfolder/login', $result->getHeader('location')[0]); | 257 | static::assertSame('/subfolder/login', $result->getHeader('location')[0]); |
258 | 258 | ||
259 | static::assertSame('UTC', $confSettings['general.timezone']); | 259 | static::assertSame('UTC', $confSettings['general.timezone']); |
260 | static::assertSame('Shared bookmarks on http://shaarli', $confSettings['general.title']); | 260 | static::assertSame('Shared bookmarks on http://shaarli/subfolder/', $confSettings['general.title']); |
261 | } | ||
262 | |||
263 | /** | ||
264 | * Same test as testSaveInstallDefaultValues() but for an instance install in root directory. | ||
265 | */ | ||
266 | public function testSaveInstallDefaultValuesWithoutSubfolder(): void | ||
267 | { | ||
268 | $confSettings = []; | ||
269 | |||
270 | $this->container->environment = [ | ||
271 | 'SERVER_NAME' => 'shaarli', | ||
272 | 'SERVER_PORT' => '80', | ||
273 | 'REQUEST_URI' => '/install', | ||
274 | 'REMOTE_ADDR' => '1.2.3.4', | ||
275 | 'SCRIPT_NAME' => '/index.php', | ||
276 | ]; | ||
277 | |||
278 | $this->container->basePath = ''; | ||
279 | |||
280 | $request = $this->createMock(Request::class); | ||
281 | $response = new Response(); | ||
282 | |||
283 | $this->container->conf->method('set')->willReturnCallback(function (string $key, $value) use (&$confSettings) { | ||
284 | $confSettings[$key] = $value; | ||
285 | }); | ||
286 | |||
287 | $result = $this->controller->save($request, $response); | ||
288 | |||
289 | static::assertSame(302, $result->getStatusCode()); | ||
290 | static::assertSame('/login', $result->getHeader('location')[0]); | ||
291 | |||
292 | static::assertSame('UTC', $confSettings['general.timezone']); | ||
293 | static::assertSame('Shared bookmarks on http://shaarli/', $confSettings['general.title']); | ||
261 | } | 294 | } |
262 | } | 295 | } |