Completed
Push — translationunittests ( 13fec9...09f392 )
by Tristan
18:00
created

LangFilesWellFormattedTest::testAllLangValuesDifferentInFrenchAndEnglish()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 13
nc 6
nop 0
dl 0
loc 17
rs 9.2222
c 0
b 0
f 0
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
    protected $sameTranslations = [];
12
13
    public function testAllLangValuesDifferentInFrenchAndEnglish() {
14
        $locales = ['en', 'fr'];
15
        foreach($locales as $locale) {
16
            $langFiles = $this->getLangFilenames($locale);
17
            foreach($langFiles as $langFile) {
18
                $entries = $this->getAllLangEntriesInFile($langFile); //TODO: create this function
0 ignored issues
show
Bug introduced by
The method getAllLangEntriesInFile() does not exist on Tests\Unit\LangFilesWellFormattedTest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
                /** @scrutinizer ignore-call */ 
19
                $entries = $this->getAllLangEntriesInFile($langFile); //TODO: create this function

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
                foreach($entries as $entry) {
20
                    $prevValues = [];
21
                    foreach($locales as $configLocale) {
22
                        App::setLocale($configLocale);
23
                        $value = Lang::get($entry);
24
                        if (in_array($value, $this->sameTranslations)) {
0 ignored issues
show
Bug Best Practice introduced by
The property sameTranslations does not exist on Tests\Unit\LangFilesWellFormattedTest. Did you maybe forget to declare it?
Loading history...
25
                            //TODO: do nothing?
26
                        } else {
27
                            //Assert $value not in $prevValues;
28
                        }                        
29
                        array_push($prevValues, $value);
30
                    }
31
                }
32
33
            }
34
        }
35
    }
36
}
37