1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-24 20:02:35 +01:00
BookStack/tests/LanguageTest.php
Dan Brown 4499ae84bb
Made fixes to es languge files and users page
Fixed PHP formatting error in ES lang file and added tests to cover.
Made user edit page more responsive on smaller devices.
Fixed 'cancel' button on profile screen when the user does not have
permission to manage users.
2017-03-05 15:34:54 +00:00

48 lines
1.3 KiB
PHP

<?php namespace Tests;
class LanguageTest extends TestCase
{
protected $langs;
/**
* LanguageTest constructor.
*/
public function setUp()
{
parent::setUp();
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
}
public function test_js_endpoint_for_each_language()
{
$visibleKeys = ['common', 'components', 'entities', 'errors'];
$this->asEditor();
foreach ($this->langs as $lang) {
setting()->putUser($this->getEditor(), 'language', $lang);
$transResp = $this->get('/translations');
foreach ($visibleKeys as $key) {
$transResp->assertSee($key);
}
}
}
public function test_all_lang_files_loadable()
{
$files = array_diff(scandir(resource_path('lang/en')), ['..', '.']);
foreach ($this->langs as $lang) {
foreach ($files as $file) {
$loadError = false;
try {
$translations = trans(str_replace('.php', '', $file), [], $lang);
} catch (\Exception $e) {
$loadError = true;
}
$this->assertFalse($loadError, "Translation file {$lang}/{$file} failed to load");
}
}
}
}