]> BookStack Code Mirror - bookstack/blob - tests/ThemeTest.php
LDAP: Added TLS support
[bookstack] / tests / ThemeTest.php
1 <?php namespace Tests;
2
3 use File;
4
5 class ThemeTest extends TestCase
6 {
7     protected $themeFolderName;
8     protected $themeFolderPath;
9
10     public function setUp(): void
11     {
12         parent::setUp();
13
14         // Create a folder and configure a theme
15         $this->themeFolderName = 'testing_theme_' . rtrim(base64_encode(time()), "=");
16         config()->set('view.theme', $this->themeFolderName);
17         $this->themeFolderPath = theme_path('');
18         File::makeDirectory($this->themeFolderPath);
19     }
20
21     public function tearDown(): void
22     {
23         // Cleanup the custom theme folder we created
24         File::deleteDirectory($this->themeFolderPath);
25
26         parent::tearDown();
27     }
28
29     public function test_translation_text_can_be_overriden_via_theme()
30     {
31         $translationPath = theme_path('/lang/en');
32         File::makeDirectory($translationPath, 0777, true);
33
34         $customTranslations = '<?php
35             return [\'books\' => \'Sandwiches\'];
36         ';
37         file_put_contents($translationPath . '/entities.php', $customTranslations);
38
39         $homeRequest = $this->actingAs($this->getViewer())->get('/');
40         $homeRequest->assertElementContains('header nav', 'Sandwiches');
41     }
42
43 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.