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.
This commit is contained in:
Dan Brown
2017-03-05 15:34:54 +00:00
parent d4e790d3cf
commit 4499ae84bb
7 changed files with 70 additions and 51 deletions

View File

@ -3,13 +3,24 @@
class LanguageTest extends TestCase
{
public function test_js_endpoint_for_each_language() {
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()
{
$langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
$visibleKeys = ['common', 'components', 'entities', 'errors'];
$this->asEditor();
foreach ($langs as $lang) {
foreach ($this->langs as $lang) {
setting()->putUser($this->getEditor(), 'language', $lang);
$transResp = $this->get('/translations');
foreach ($visibleKeys as $key) {
@ -18,4 +29,20 @@ class LanguageTest extends TestCase
}
}
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");
}
}
}
}