Completed
Push — translationunittests ( 2f16a4...13fec9 )
by Tristan
17:41
created

LangFilesWellFormattedTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 9
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testAllLangFilesWellFormatted() 0 7 3
1
<?php
2
3
namespace Tests\Unit;
4
5
use Tests\TestCase;
6
use Illuminate\Support\Facades\Lang;
7
use Illuminate\Support\Facades\App;
8
9
class LangFilesWellFormattedTest extends BaseTranslationTest
10
{
11
    public function testAllLangFilesWellFormatted() {
12
        $locales = ['en', 'fr'];
13
        foreach($locales as $locale) {
14
            $langFiles = $this->getLangFilenames($locale);
15
            App::setLocale($locale);
16
            foreach($langFiles as $langFile) {
17
                $this->assertInternalType('array', Lang::get($langFile));
18
            }
19
        }
20
    }
21
}
22
// instead of checking if specific files exists, check if every file in the lang folder returns an array. Do it for french and english at ghe same time no seperate test needed.
23
//
24
//  Prefix: Write a function, make it a function that returns an array of everything that you could use to pass into Lang::get. (return auth, manager/applicant, everything under resources/lang/en. For now.)
25
 // Loop through that array and make sure everything is passable into Lang::get and use that for other tests.
26
27
/*---
28
 *
29
 * 1) Use Scandir to get everything in the folder and loop through them. (same function as step 7) (its a recursive function, if its a file, turn that into a string that we can pass into Lang::get, if its a folder, we need to call this function again using that folder as a location.
30
 * 2) If its a file, you need to use the name of the file, and pass it to lang::get.
31
 * 3) and then use Assert InternalType array. The Assert is to check what comes back from Lang::get. Its possible Lang::get causes an exception, but will show up in tests (probably)
32
 * 4) Resources/Lang/EN or FR is where you start looking.
33
 * 5) Function needs to take a second argument, what am I going to prefix the filename with(arugment 1 is the directory you are looking in), for the Lang::get funcction, start with empty string. (argument 2 is an empty string. ''),
34
 * 6) Check Applicant Profile Controller line 43 for a working example of Lang::get.
35
 *
36
 * ---
37
 *
38
 * Put the test in one function, but have the function contain two starting points. One for EN/ one for FR.
39
 *
40
 */
41