diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41f0d1d1..c2fab03d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,25 +38,25 @@ show which files are missing or extra or which language strings are missing or e For instance, a test error showing that the `de` translation has extra files not found in the framework: - 1) CodeIgniter\Language\GermanTranslationTest::testAllTranslatedLanguageFilesAreConfigured with data set "de" ('de') + 1) Translations\Tests\GermanTranslationTest::testAllTranslatedLanguageFilesAreConfigured with data set "de" ('de') Failed asserting that translated language file "Seed.php" in "de" locale is configured in the main repository. Failed asserting that an array is empty. Another example showing missing files in the `de` translation set: - 2) CodeIgniter\Language\GermanTranslationTest::testAllConfiguredLanguageFilesAreTranslated with data set "de" ('de') + 2) Translations\Tests\GermanTranslationTest::testAllConfiguredLanguageFilesAreTranslated with data set "de" ('de') Failed asserting that language file "CLI.php" in the main repository is translated in "de" locale. Failed asserting that an array is empty. An example showing missing keys for the `de` translation set: - 3) CodeIgniter\Language\GermanTranslationTest::testAllConfiguredLanguageKeysAreIncluded with data set "de" ('de') + 3) Translations\Tests\GermanTranslationTest::testAllConfiguredLanguageKeysAreIncluded with data set "de" ('de') Failed asserting that the language keys "CLI.altCommandPlural", "CLI.altCommandSingular", "CLI.generateClassName", "CLI.generateFileError", "CLI.generateFileExists", "CLI.generateFileSuccess", "CLI.generateParentClass", "CLI.namespaceNotDefined", "Database.emptyDataset", "Database.emptyPrimaryKey", "Email.sent", "Fabricator.createFailed", "Format.invalidFormatter", "Format.invalidMime", "HTTP.invalidSameSiteSetting", "Migrations.batch", "Migrations.group", "Migrations.missingTable", "Migrations.nameSeeder", "Migrations.namespace", "Session.invalidSameSiteSetting", "Validation.not_in_list" in the main repository are included for translation in "de" locale. Failed asserting that an array is empty. Lastly, an example showing extra keys for the `de` translation set: - 4) CodeIgniter\Language\GermanTranslationTest::testAllIncludedLanguageKeysAreConfigured with data set "de" ('de') + 4) Translations\Tests\GermanTranslationTest::testAllIncludedLanguageKeysAreConfigured with data set "de" ('de') Failed asserting that the translated language keys "Migrations.badCreateName", "Migrations.writeError" in "de" locale are configured in the main repository. Failed asserting that an array is empty. @@ -66,7 +66,7 @@ The failure messages are fully descriptive of what went wrong in the translation Each language locale in this repository has a corresponding test class located in `tests/Language/` folder. These test classes test individually the language sets for its completeness and precision. However, the test -class `CodeIgniter\Language\AllLocalesTranslationTest` tests **ALL** locales at once. This is used for a +class `Translations\Tests\AllLocalesTranslationTest` tests **ALL** locales at once. This is used for a full-blown testing of all language sets. When adding a new locale for translation, the following steps should be followed strictly: @@ -75,7 +75,7 @@ When adding a new locale for translation, the following steps should be followed 2. Create a new test class in `tests/Language` folder. For example, the new locale is Canadian French (fr-CA), then a test class named `CanadianFrenchTranslationTest` will be created. The pattern for naming is the full name of the new locale followed by `TranslationTest`. -3. This new test class should be extending `CodeIgniter\Language\AbstractTranslationTestCase` and be marked +3. This new test class should be extending `Translations\Tests\AbstractTranslationTestCase` and be marked as a final class. This would not contain any new methods or properties as its sole purpose is to extend `AbstractTranslationTestCase` for testing the specific locale. 4. In the static `$locales` array of `AbstractTranslationTestCase` this new class should be added. The name diff --git a/composer.json b/composer.json index c167b68e..25243066 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,12 @@ }, "autoload": { "psr-4": { - "CodeIgniter\\Language\\": "Language/" + "Translations\\": "" } }, "autoload-dev": { "psr-4": { - "CodeIgniter\\Language\\": "tests/Language/" + "Translations\\Tests\\": "tests/Language/" } }, "repositories": [ diff --git a/tests/Language/AbstractTranslationTestCase.php b/tests/Language/AbstractTranslationTestCase.php index 36bb66bc..38ba01ee 100644 --- a/tests/Language/AbstractTranslationTestCase.php +++ b/tests/Language/AbstractTranslationTestCase.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; use PHPUnit\Framework\TestCase; @@ -107,7 +107,7 @@ final public function testAllConfiguredLanguageFilesAreTranslated(string $locale sort($filesNotTranslated); $count = count($filesNotTranslated); - $this->assertEmpty($filesNotTranslated, sprintf( + self::assertEmpty($filesNotTranslated, sprintf( 'Failed asserting that language %s "%s" in the main repository %s translated in "%s" locale.', $count > 1 ? 'files' : 'file', implode('", "', $filesNotTranslated), @@ -136,7 +136,7 @@ final public function testAllTranslatedLanguageFilesAreConfigured(string $locale sort($filesNotConfigured); $count = count($filesNotConfigured); - $this->assertEmpty($filesNotConfigured, sprintf( + self::assertEmpty($filesNotConfigured, sprintf( 'Failed asserting that translated language %s "%s" in "%s" locale %s configured in the main repository.', $count > 1 ? 'files' : 'file', implode('", "', $filesNotConfigured), @@ -157,7 +157,7 @@ final public function testAllTranslatedLanguageFilesAreConfigured(string $locale */ final public function testAllConfiguredLanguageKeysAreIncluded(string $locale): void { - $availableSets = array_intersect($this->expectedSets(), $this->foundSets($locale)); + $availableSets = array_intersect($this->expectedSets(), $this->foundSets($locale)); $keysNotIncluded = []; foreach ($availableSets as $file) @@ -176,7 +176,7 @@ final public function testAllConfiguredLanguageKeysAreIncluded(string $locale): sort($keysNotIncluded); $count = count($keysNotIncluded); - $this->assertEmpty($keysNotIncluded, sprintf( + self::assertEmpty($keysNotIncluded, sprintf( 'Failed asserting that the language %s "%s" in the main repository %s included for translation in "%s" locale.', $count > 1 ? 'keys' : 'key', implode('", "', $keysNotIncluded), @@ -197,7 +197,7 @@ final public function testAllConfiguredLanguageKeysAreIncluded(string $locale): */ final public function testAllIncludedLanguageKeysAreConfigured(string $locale): void { - $availableSets = array_intersect($this->expectedSets(), $this->foundSets($locale)); + $availableSets = array_intersect($this->expectedSets(), $this->foundSets($locale)); $keysNotConfigured = []; foreach ($availableSets as $file) @@ -216,7 +216,7 @@ final public function testAllIncludedLanguageKeysAreConfigured(string $locale): sort($keysNotConfigured); $count = count($keysNotConfigured); - $this->assertEmpty($keysNotConfigured, sprintf( + self::assertEmpty($keysNotConfigured, sprintf( 'Failed asserting that the translated language %s "%s" in "%s" locale %s configured in the main repository.', $count > 1 ? 'keys' : 'key', implode('", "', $keysNotConfigured), @@ -248,7 +248,7 @@ final public function testAllLocalesHaveCorrespondingTestCaseInArray(): void sort($untestedLocales); $count = count($untestedLocales); - $this->assertEmpty($untestedLocales, sprintf( + self::assertEmpty($untestedLocales, sprintf( 'Failed asserting that %s "%s" %s corresponding test %s in %s::$locales array.', $count > 1 ? 'locales' : 'locale', implode('", "', $untestedLocales), @@ -267,7 +267,7 @@ final public function testAllLocalesHaveCorrespondingTestCaseInArray(): void */ final public function testAllLocalesHaveCorrespondingTestCaseFiles(string $class): void { - $this->assertTrue(class_exists($class, false), sprintf( + self::assertTrue(class_exists($class, false), sprintf( 'Failed asserting that test class "%s" is existing.', $class )); @@ -301,7 +301,7 @@ final public function translationKeys(): array foreach ($dirs as $dir) { - $dir = trim($dir, '\\/'); + $dir = trim($dir, '\\/'); $sets[$dir] = [$dir]; } @@ -339,7 +339,7 @@ final public function loadFile(string $file, ?string $locale = null): array /** * Gets the set of language files for each location. * - * @param string|null $locale + * @param null|string $locale * * @return array */ @@ -349,7 +349,7 @@ private function translationSets(?string $locale = null): array ? getcwd() . "/Language/{$locale}/" : getcwd() . self::MAIN_LANGUAGE_REPO; - $sets = []; + $sets = []; $files = directory_map($location, 1); foreach ($files as $file) diff --git a/tests/Language/AllLocalesTranslationTest.php b/tests/Language/AllLocalesTranslationTest.php index 3c21f298..930ebd07 100644 --- a/tests/Language/AllLocalesTranslationTest.php +++ b/tests/Language/AllLocalesTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/ArabicTranslationTest.php b/tests/Language/ArabicTranslationTest.php index 65b33a07..eaafa484 100644 --- a/tests/Language/ArabicTranslationTest.php +++ b/tests/Language/ArabicTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/BrazilianTranslationTest.php b/tests/Language/BrazilianTranslationTest.php index 70bd4cbc..84aa2200 100644 --- a/tests/Language/BrazilianTranslationTest.php +++ b/tests/Language/BrazilianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/CzechTranslationTest.php b/tests/Language/CzechTranslationTest.php index a8531623..e36ce334 100644 --- a/tests/Language/CzechTranslationTest.php +++ b/tests/Language/CzechTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/DutchTranslationTest.php b/tests/Language/DutchTranslationTest.php index fe1f9486..1cb5ef1b 100644 --- a/tests/Language/DutchTranslationTest.php +++ b/tests/Language/DutchTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/FarsiTranslationTest.php b/tests/Language/FarsiTranslationTest.php index eda7d02d..687aa00b 100644 --- a/tests/Language/FarsiTranslationTest.php +++ b/tests/Language/FarsiTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/FrenchTranslationTest.php b/tests/Language/FrenchTranslationTest.php index 7df3df25..cf0e3fa1 100644 --- a/tests/Language/FrenchTranslationTest.php +++ b/tests/Language/FrenchTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/GermanTranslationTest.php b/tests/Language/GermanTranslationTest.php index 72601fa5..265193f1 100644 --- a/tests/Language/GermanTranslationTest.php +++ b/tests/Language/GermanTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/IndonesianTranslationTest.php b/tests/Language/IndonesianTranslationTest.php index d401d01e..ee82c24a 100644 --- a/tests/Language/IndonesianTranslationTest.php +++ b/tests/Language/IndonesianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/ItalianTranslationTest.php b/tests/Language/ItalianTranslationTest.php index 7f511ea9..fe3f2441 100644 --- a/tests/Language/ItalianTranslationTest.php +++ b/tests/Language/ItalianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/JapaneseTranslationTest.php b/tests/Language/JapaneseTranslationTest.php index 952d8e08..1b07cf67 100644 --- a/tests/Language/JapaneseTranslationTest.php +++ b/tests/Language/JapaneseTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/KoreanTranslationTest.php b/tests/Language/KoreanTranslationTest.php index 79195c00..debfeeb2 100644 --- a/tests/Language/KoreanTranslationTest.php +++ b/tests/Language/KoreanTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/LatvianTranslationTest.php b/tests/Language/LatvianTranslationTest.php index 53e0d13f..02a99f27 100644 --- a/tests/Language/LatvianTranslationTest.php +++ b/tests/Language/LatvianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/LithuanianTranslationTest.php b/tests/Language/LithuanianTranslationTest.php index 1c7868ee..da676f31 100644 --- a/tests/Language/LithuanianTranslationTest.php +++ b/tests/Language/LithuanianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/MalayalamTranslationTest.php b/tests/Language/MalayalamTranslationTest.php index f8e340cd..f5f25cce 100644 --- a/tests/Language/MalayalamTranslationTest.php +++ b/tests/Language/MalayalamTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/NorwegianTranslationTest.php b/tests/Language/NorwegianTranslationTest.php index 28e3417f..9bc2a893 100644 --- a/tests/Language/NorwegianTranslationTest.php +++ b/tests/Language/NorwegianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/PolishTranslationTest.php b/tests/Language/PolishTranslationTest.php index 8d7ca233..2f687be0 100644 --- a/tests/Language/PolishTranslationTest.php +++ b/tests/Language/PolishTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/PortugueseTranslationTest.php b/tests/Language/PortugueseTranslationTest.php index e7afecbc..95599bc2 100644 --- a/tests/Language/PortugueseTranslationTest.php +++ b/tests/Language/PortugueseTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/RussianTranslationTest.php b/tests/Language/RussianTranslationTest.php index a67077f0..444f9cf8 100644 --- a/tests/Language/RussianTranslationTest.php +++ b/tests/Language/RussianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/SimpleChineseTranslationTest.php b/tests/Language/SimpleChineseTranslationTest.php index 615c9f6b..bb3a145b 100644 --- a/tests/Language/SimpleChineseTranslationTest.php +++ b/tests/Language/SimpleChineseTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/SlovakTranslationTest.php b/tests/Language/SlovakTranslationTest.php index d4793ad4..f33dfe8b 100644 --- a/tests/Language/SlovakTranslationTest.php +++ b/tests/Language/SlovakTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/SpanishTranslationTest.php b/tests/Language/SpanishTranslationTest.php index 4f64e8d1..85193d60 100644 --- a/tests/Language/SpanishTranslationTest.php +++ b/tests/Language/SpanishTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/SwedishTranslationTest.php b/tests/Language/SwedishTranslationTest.php index 31e67d0f..3f6bf4e6 100644 --- a/tests/Language/SwedishTranslationTest.php +++ b/tests/Language/SwedishTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/TraditionalChineseTranslationTest.php b/tests/Language/TraditionalChineseTranslationTest.php index 48e7364a..a64d8964 100644 --- a/tests/Language/TraditionalChineseTranslationTest.php +++ b/tests/Language/TraditionalChineseTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/TurkishTranslationTest.php b/tests/Language/TurkishTranslationTest.php index afdb751c..c0343d2e 100644 --- a/tests/Language/TurkishTranslationTest.php +++ b/tests/Language/TurkishTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/UkrainianTranslationTest.php b/tests/Language/UkrainianTranslationTest.php index a1ba3f26..267be247 100644 --- a/tests/Language/UkrainianTranslationTest.php +++ b/tests/Language/UkrainianTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal diff --git a/tests/Language/VietnameseTranslationTest.php b/tests/Language/VietnameseTranslationTest.php index dac09103..df9f1910 100644 --- a/tests/Language/VietnameseTranslationTest.php +++ b/tests/Language/VietnameseTranslationTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace CodeIgniter\Language; +namespace Translations\Tests; /** * @internal