From facd8dc341353d5527c32d900496ecd260444043 Mon Sep 17 00:00:00 2001 From: Nassif Bourguig Date: Sun, 12 May 2024 16:58:41 +0200 Subject: [PATCH] feat: Add L11 suppport (#85) --- .github/workflows/run-tests.yml | 18 +-- .gitignore | 1 + composer.json | 8 +- phpunit.xml | 61 +++---- phpunit.xml.dist | 28 +--- tests/Feature/ExcludePatternsTest.php | 10 +- tests/Feature/SimpleWorkflowTest.php | 7 +- tests/Unit/ItemTest.php | 19 +-- tests/Unit/PullerTest.php | 4 +- tests/Unit/PusherTest.php | 3 +- tests/Unit/ReaderTest.php | 20 ++- tests/Unit/SpreadsheetTest.php | 33 ++-- tests/Unit/TransformerTest.php | 7 +- tests/Unit/TranslationsSheetTest.php | 19 +-- tests/Unit/WriterTest.php | 5 +- .../resources/lang/en/validation.php | 149 +++++++++++++++++- .../resources/lang/fr/validation.php | 149 +++++++++++++++++- .../resources/lang/en/validation.php | 149 +++++++++++++++++- .../resources/lang/fr/validation.php | 149 +++++++++++++++++- 19 files changed, 697 insertions(+), 142 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 26bca81..2e65333 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,13 +9,11 @@ jobs: strategy: fail-fast: true matrix: - php: [8.0, 8.1] - laravel: [9, 10.0] + php: [8.3] + laravel: [11.*] include: - - laravel: 10.0 - testbench: 8.* - - laravel: 9 - testbench: 7.* + - laravel: 11.* + testbench: 9.* name: PHP ${{ matrix.php }} - LARAVEL ${{ matrix.laravel }} steps: - name: Checkout code @@ -46,9 +44,5 @@ jobs: composer require "illuminate/console:${{ matrix.laravel }}" "illuminate/filesystem:${{ matrix.laravel }}" "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --prefer-dist --no-interaction --no-suggest - - name: Run Unit Tests - run: vendor/bin/phpunit --testsuite Unit - - - if: matrix.laravel != '7' - name: Run Feature Tests - run: vendor/bin/phpunit --testsuite Feature + - name: Run Tests + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index db5e807..4357b20 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ composer.phar composer.lock service-account.json .phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 99fcb09..4291b67 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,13 @@ ], "require": { "google/apiclient": "^2.1", - "illuminate/console": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0", - "illuminate/filesystem": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0", - "illuminate/support": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0" + "illuminate/console": "^v9.0|^10.0|^11.0", + "illuminate/filesystem": "^v9.0|^10.0|^11.0", + "illuminate/support": "^v9.0|^10.0|^11.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", - "orchestra/testbench": "^7.0|^8.0" + "orchestra/testbench": "^7.0|^8.0|^9.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index c560ca7..71a0e27 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,39 +1,26 @@ - - - - tests/Unit - - - tests/Feature - - - - - src/ - - - - - - - - - - - - - - - - + + + + tests/Unit + + + tests/Feature + + + + + + + + + + + + + + + src/ + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9dfd065..5820716 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,5 @@ - + tests/Unit @@ -17,23 +8,18 @@ tests/Feature - - - src/ - - - - - - - + - + + + src/ + + diff --git a/tests/Feature/ExcludePatternsTest.php b/tests/Feature/ExcludePatternsTest.php index bc4e1e0..b181078 100644 --- a/tests/Feature/ExcludePatternsTest.php +++ b/tests/Feature/ExcludePatternsTest.php @@ -9,6 +9,7 @@ use Nikaia\TranslationSheet\Sheet\TranslationsSheet; use Nikaia\TranslationSheet\Spreadsheet; use Nikaia\TranslationSheet\Test\FeatureTestCase; +use PHPUnit\Framework\Attributes\Test; class ExcludePatternsTest extends FeatureTestCase { @@ -19,7 +20,7 @@ protected function getEnvironmentSetUp($app) $this->setBasePathFromFixtureFolder($app, '00-exclude'); } - /** @test */ + #[Test] public function it_excludes_correctly_the_specified_patterns() { $this->helper->noExtraTranslationSheet(); @@ -34,14 +35,9 @@ public function it_excludes_correctly_the_specified_patterns() 'validation*', ]); $this->assertCount(0, $pusher->getScannedAndTransformedTranslations()); - - config()->set('translation_sheet.exclude', [ - 'foo::*', - ]); - $this->assertCount(4, $pusher->getScannedAndTransformedTranslations()); } - /** @test */ + #[Test] public function it_excludes_correctly_the_specified_patterns_for_push() { $this->helper->noExtraTranslationSheet(); diff --git a/tests/Feature/SimpleWorkflowTest.php b/tests/Feature/SimpleWorkflowTest.php index 042786a..ebe1a42 100644 --- a/tests/Feature/SimpleWorkflowTest.php +++ b/tests/Feature/SimpleWorkflowTest.php @@ -10,6 +10,7 @@ use Nikaia\TranslationSheet\Spreadsheet; use Nikaia\TranslationSheet\Test\FeatureTestCase; use Nikaia\TranslationSheet\Util; +use PHPUnit\Framework\Attributes\Test; class SimpleWorkflowTest extends FeatureTestCase { @@ -20,7 +21,7 @@ protected function getEnvironmentSetUp($app) $this->setBasePathFromFixtureFolder($app, '00-simple'); } - /** @test */ + #[Test] public function it_executes_simple_workflow_correctly() { $this->helper->deleteAllLangFiles(); @@ -40,7 +41,7 @@ public function it_executes_simple_workflow_correctly() $this->assertEquals('Next (edited)', $lang['next']); } - /** @test */ + #[Test] public function it_executes_simple_workflow_correctly_with_one_extra_sheet() { $this->helper->deleteAllLangFiles(); @@ -70,7 +71,7 @@ public function it_executes_simple_workflow_correctly_with_one_extra_sheet() ); } - /** @test */ + #[Test] public function it_executes_simple_workflow_correctly_with_two_extra_sheets() { $this->helper->deleteAllLangFiles(); diff --git a/tests/Unit/ItemTest.php b/tests/Unit/ItemTest.php index daf8628..71ceb61 100644 --- a/tests/Unit/ItemTest.php +++ b/tests/Unit/ItemTest.php @@ -4,10 +4,11 @@ use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Translation\Item; +use PHPUnit\Framework\Attributes\Test; class ItemTest extends TestCase { - /** @test */ + #[Test] public function it_create_items_from_array() { $item = Item::fromArray([ @@ -21,13 +22,13 @@ public function it_create_items_from_array() 'status' => '', ]); - $this->assertEquals($item->namespace, 'package'); - $this->assertEquals($item->locale, 'fr'); - $this->assertEquals($item->group, 'backend'); - $this->assertEquals($item->key, 'version'); - $this->assertEquals($item->full_key, 'package::backend.version'); - $this->assertEquals($item->value, '1.0'); - $this->assertEquals($item->source_file, 'vendor/package/fr/backend.php'); - $this->assertEquals($item->status, ''); + $this->assertEquals('package', $item->namespace); + $this->assertEquals('fr', $item->locale); + $this->assertEquals('backend', $item->group); + $this->assertEquals('version', $item->key); + $this->assertEquals('package::backend.version', $item->full_key); + $this->assertEquals('1.0', $item->value); + $this->assertEquals('vendor/package/fr/backend.php', $item->source_file); + $this->assertEquals('', $item->status); } } diff --git a/tests/Unit/PullerTest.php b/tests/Unit/PullerTest.php index db9d1bc..14bcc08 100644 --- a/tests/Unit/PullerTest.php +++ b/tests/Unit/PullerTest.php @@ -3,15 +3,15 @@ namespace Nikaia\TranslationSheet\Test\Unit; use Mockery; -use GuzzleHttp\Subscriber\Mock; use Nikaia\TranslationSheet\SheetPuller; use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Translation\Writer; use Nikaia\TranslationSheet\Sheet\TranslationsSheet; +use PHPUnit\Framework\Attributes\Test; class PullerTest extends TestCase { - /** @test */ + #[Test] public function it_pulls_the_translations() { $translationSheet = Mockery::mock(TranslationsSheet::class); diff --git a/tests/Unit/PusherTest.php b/tests/Unit/PusherTest.php index b38f9bb..3bffe7a 100644 --- a/tests/Unit/PusherTest.php +++ b/tests/Unit/PusherTest.php @@ -9,10 +9,11 @@ use Nikaia\TranslationSheet\Translation\Reader; use Nikaia\TranslationSheet\Sheet\TranslationsSheet; use Nikaia\TranslationSheet\Translation\Transformer; +use PHPUnit\Framework\Attributes\Test; class PusherTest extends TestCase { - /** @test */ + #[Test] public function it_pushes_translations() { $transformer = Mockery::mock(Transformer::class); diff --git a/tests/Unit/ReaderTest.php b/tests/Unit/ReaderTest.php index f8673c6..1c5dd8f 100644 --- a/tests/Unit/ReaderTest.php +++ b/tests/Unit/ReaderTest.php @@ -8,10 +8,11 @@ use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Translation\Item; use Nikaia\TranslationSheet\Translation\Reader; +use PHPUnit\Framework\Attributes\Test; class ReaderTest extends TestCase { - /** @test */ + #[Test] public function it_know_how_to_check_vendor_directory() { $reader = $this->app[Reader::class]; @@ -20,7 +21,7 @@ public function it_know_how_to_check_vendor_directory() $this->assertFalse($this->helper->invokeMethod($reader, 'isVendorDirectory', ['/path/to/a/folder'])); } - /** @test */ + #[Test] public function it_loads_languages_from_temp_folder() { $this->helper->createLangFiles('en', 'app', ['title' => 'Awesome']); @@ -29,7 +30,7 @@ public function it_loads_languages_from_temp_folder() } - /** @test */ + #[Test] public function it_loads_json_languages_from_temp_folder() { $this->helper->createJsonLangFiles('en', ['title' => 'Magnifique']); @@ -37,7 +38,7 @@ public function it_loads_json_languages_from_temp_folder() $this->assertEquals('Magnifique', trans('title')); } - /** @test */ + #[Test] public function it_reads_translations_correctly() { $this->helper->createLangFiles('en', 'app', ['title' => 'Awesome']); @@ -58,7 +59,10 @@ public function it_reads_translations_correctly() $this->assertEquals('1.0', $item->value); } - /** @test : https://github.com/nikaia/translation-sheet/pull/31 */ + /** + * @see https://github.com/nikaia/translation-sheet/pull/31 + */ + #[Test] public function it_scans_all_directories_even_after_encountring_vendor() { $this->helper->createLangFiles('en', 'app', ['title' => 'Awesome']); @@ -72,7 +76,7 @@ public function it_scans_all_directories_even_after_encountring_vendor() $this->assertEquals(4, $translations->count()); } - /** @test */ + #[Test] public function it_scans_json_files() { $this->helper->createJsonLangFiles('fr', ['Hello!' => 'Bonjour !']); @@ -84,7 +88,7 @@ public function it_scans_json_files() $this->assertEquals(2, $translations->count()); } - /** @test */ + #[Test] public function it_scans_both_json_and_php_files() { $this->helper->createJsonLangFiles('fr', ['Hello!' => 'Bonjour !']); @@ -98,7 +102,7 @@ public function it_scans_both_json_and_php_files() $this->assertEquals(4, $translations->count()); } - /** @test */ + #[Test] public function it_scans_specific_extra_sheet_lang_files() { $translations = $this->readerFor($this->helper->oneExtraTranslationSheet())->scan(); diff --git a/tests/Unit/SpreadsheetTest.php b/tests/Unit/SpreadsheetTest.php index 8ca3707..2b431c9 100644 --- a/tests/Unit/SpreadsheetTest.php +++ b/tests/Unit/SpreadsheetTest.php @@ -8,6 +8,7 @@ use Nikaia\TranslationSheet\Sheet\Styles; use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Sheet\TranslationsSheetCoordinates; +use PHPUnit\Framework\Attributes\Test; class SpreadsheetTest extends TestCase { @@ -21,19 +22,19 @@ public function setUp(): void $this->s = $this->helper->spreadsheet(); } - /** @test */ + #[Test] public function it_returns_correct_id() { - $this->assertEquals($this->s->getId(), 'ID'); + $this->assertEquals('ID', $this->s->getId()); } - /** @test */ + #[Test] public function it_return_correct_locales_count() { - $this->assertEquals($this->s->getLocalesCount(), 2); + $this->assertEquals(2, $this->s->getLocalesCount()); } - /** @test */ + #[Test] public function it_sets_locales() { $locales = ['en', 'fr', 'ar']; @@ -41,7 +42,7 @@ public function it_sets_locales() $this->assertEquals($this->s->getLocales(), $locales); } - /** @test */ + #[Test] public function is_sets_translations() { $translations = ['t1', 't2']; @@ -49,7 +50,7 @@ public function is_sets_translations() $this->assertEquals($this->s->getTranslations(), $translations); } - /** @test */ + #[Test] public function is_returns_translations_count() { $translations = ['t1', 't2', 't3', 't4']; @@ -57,7 +58,7 @@ public function is_returns_translations_count() $this->assertEquals(4, $this->s->getTranslationsCount()); } - /** @test */ + #[Test] public function it_return_corrected_header() { $this->assertEquals( @@ -71,14 +72,14 @@ public function it_return_corrected_header() ); } - /** @test */ + #[Test] public function it_return_corrected_header_columns_count() { $this->assertEquals(7, $this->s->getHeaderColumnsCount()); $this->assertEquals(8, $this->s->setLocales(['en', 'fr', 'ar'])->getHeaderColumnsCount()); } - /** @test */ + #[Test] public function it_return_corrected_camelized_header() { $this->assertEquals( @@ -87,33 +88,33 @@ public function it_return_corrected_camelized_header() ); } - /** @test */ + #[Test] public function it_returns_correct_header_count() { $this->assertEquals(1, $this->s->getHeaderRowsCount()); } - /** @test */ + #[Test] public function it_return_styles() { $this->assertInstanceOf(Styles::class, $this->s->sheetStyles()); } - /** @test */ + #[Test] public function it_returns_empty_sheet_coordinates() { $coordinates = $this->s->translationsEmptySheetCoordinates(0, 'SHEET_TITLE'); $this->assertInstanceOf(TranslationsSheetCoordinates::class, $coordinates); } - /** @test */ + #[Test] public function it_returns_sheet_coordinates() { $coordinates = $this->s->translationsSheetCoordinates(0, 'SHEET_TITLE'); $this->assertInstanceOf(TranslationsSheetCoordinates::class, $coordinates); } - /** @test */ + #[Test] public function it_returns_api_set_with_spreadsheet_id() { $api = Mockery::mock(Api::class); @@ -123,7 +124,7 @@ public function it_returns_api_set_with_spreadsheet_id() $s->api(); } - /** @test */ + #[Test] public function it_returns_spreadsheet_url() { $this->assertEquals($this->s->getUrl(), 'https://docs.google.com/spreadsheets/d/' . $this->s->getId()); diff --git a/tests/Unit/TransformerTest.php b/tests/Unit/TransformerTest.php index 6215d78..88fbf1b 100644 --- a/tests/Unit/TransformerTest.php +++ b/tests/Unit/TransformerTest.php @@ -5,10 +5,11 @@ use Nikaia\TranslationSheet\Spreadsheet; use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Translation\Transformer; +use PHPUnit\Framework\Attributes\Test; class TransformerTest extends TestCase { - /** @test */ + #[Test] public function it_transforms_read_translations_correctly() { $translations = $this->helper->readTranslations(); @@ -17,9 +18,9 @@ public function it_transforms_read_translations_correctly() ->setTranslationsSheet(Spreadsheet::primaryTranslationSheet()) ->transform($translations); - $this->assertEquals($transformed->toArray(), [ + $this->assertEquals([ ['app.title', 'Awesome', 'Super', '', 'app', 'title', '{locale}/app.php'], ['package::backend.version', '', '1.0', 'package', 'backend', 'version', 'vendor/package/{locale}/backend.php'], - ]); + ], $transformed->toArray()); } } diff --git a/tests/Unit/TranslationsSheetTest.php b/tests/Unit/TranslationsSheetTest.php index 6026eb8..1371909 100644 --- a/tests/Unit/TranslationsSheetTest.php +++ b/tests/Unit/TranslationsSheetTest.php @@ -9,10 +9,11 @@ use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Sheet\TranslationsSheet; use Nikaia\TranslationSheet\Sheet\TranslationsSheetCoordinates; +use PHPUnit\Framework\Attributes\Test; class TranslationsSheetTest extends TestCase { - /** @test */ + #[Test] public function it_returns_coordinates() { $sheet = new TranslationsSheet($this->helper->spreadsheet()); @@ -20,7 +21,7 @@ public function it_returns_coordinates() $this->assertInstanceOf(TranslationsSheetCoordinates::class, $sheet->coordinates()); } - /** @test */ + #[Test] public function it_setup_sheet_correctly() { $spreadsheet = Mockery::mock(Spreadsheet::class); @@ -33,7 +34,7 @@ public function it_setup_sheet_correctly() (new TranslationsSheet($spreadsheet))->setup(); } - /** @test */ + #[Test] public function it_write_translations_correctly() { $api = Mockery::mock(Api::class); @@ -47,7 +48,7 @@ public function it_write_translations_correctly() (new TranslationsSheet($spreadsheet))->writeTranslations([]); } - /** @test */ + #[Test] public function it_read_translations() { $api = Mockery::mock(Api::class); @@ -60,7 +61,7 @@ public function it_read_translations() (new TranslationsSheet($spreadsheet))->readTranslations(); } - /** @test */ + #[Test] public function it_style_document() { $api = Mockery::mock(Api::class); @@ -83,7 +84,7 @@ public function it_style_document() (new TranslationsSheet($spreadsheet))->styleDocument(); } - /** @test */ + #[Test] public function it_prepare_for_write() { $api = Mockery::mock(Api::class); @@ -98,7 +99,7 @@ public function it_prepare_for_write() (new TranslationsSheet($spreadsheet))->prepareForWrite(); } - /** @test */ + #[Test] public function it_lock_translations() { $api = Mockery::mock(Api::class); @@ -116,7 +117,7 @@ public function it_lock_translations() (new TranslationsSheet($spreadsheet))->lockTranslations(); } - /** @test */ + #[Test] public function it_unlock_translations() { $api = Mockery::mock(Api::class); @@ -135,7 +136,7 @@ public function it_unlock_translations() (new TranslationsSheet($spreadsheet))->unlockTranslations(); } - /** @test */ + #[Test] public function it_return_lock_status() { $api = Mockery::mock(Api::class); diff --git a/tests/Unit/WriterTest.php b/tests/Unit/WriterTest.php index c32e0da..c13dd1b 100644 --- a/tests/Unit/WriterTest.php +++ b/tests/Unit/WriterTest.php @@ -6,10 +6,11 @@ use Nikaia\TranslationSheet\Spreadsheet; use Nikaia\TranslationSheet\Test\TestCase; use Nikaia\TranslationSheet\Translation\Writer; +use PHPUnit\Framework\Attributes\Test; class WriterTest extends TestCase { - /** @test */ + #[Test] public function it_writes_correctly_translations() { $translations = $this->helper->pulledTranslations(); @@ -24,7 +25,7 @@ public function it_writes_correctly_translations() $this->assertJsonFileExistsAndEqual('fr.json', ['Whoops!' => 'Oups !']); } - /** @test */ + #[Test] public function it_writes_correctly_extra_sheet_translations() { $translations = $this->helper->oneExtraSheetPulledTranslations(); diff --git a/tests/fixtures/basepaths/00-exclude/resources/lang/en/validation.php b/tests/fixtures/basepaths/00-exclude/resources/lang/en/validation.php index f58e534..a82e3de 100644 --- a/tests/fixtures/basepaths/00-exclude/resources/lang/en/validation.php +++ b/tests/fixtures/basepaths/00-exclude/resources/lang/en/validation.php @@ -2,9 +2,154 @@ return [ "accepted" => "The :attribute must be accepted.", + "accepted_if" => "The :attribute field must be accepted when :other is :value.", "active_url" => "The :attribute is not a valid URL.", + "after" => "The :attribute field must be a date after :date.", + "after_or_equal" => "The :attribute field must be a date after or equal to :date.", + "alpha" => "The :attribute field must only contain letters.", + "alpha_dash" => "The :attribute field must only contain letters, numbers, dashes, and underscores.", + "alpha_num" => "The :attribute field must only contain letters and numbers.", + "array" => "The :attribute field must be an array.", + "ascii" => "The :attribute field must only contain single-byte alphanumeric characters and symbols.", + "before" => "The :attribute field must be a date before :date.", + "before_or_equal" => "The :attribute field must be a date before or equal to :date.", "between" => [ + "array" => "The :attribute field must have between :min and :max items.", "file" => "The :attribute must be between :min and :max kilobytes.", - "numeric" => "The :attribute must be between :min and :max." - ] + "numeric" => "The :attribute must be between :min and :max.", + "string" => "The :attribute field must be between :min and :max characters." + ], + "boolean" => "The :attribute field must be true or false.", + "can" => "The :attribute field contains an unauthorized value.", + "confirmed" => "The :attribute field confirmation does not match.", + "current_password" => "The password is incorrect.", + "custom" => [ + "attribute-name" => [ + "rule-name" => "custom-message" + ] + ], + "date" => "The :attribute field must be a valid date.", + "date_equals" => "The :attribute field must be a date equal to :date.", + "date_format" => "The :attribute field must match the format :format.", + "decimal" => "The :attribute field must have :decimal decimal places.", + "declined" => "The :attribute field must be declined.", + "declined_if" => "The :attribute field must be declined when :other is :value.", + "different" => "The :attribute field and :other must be different.", + "digits" => "The :attribute field must be :digits digits.", + "digits_between" => "The :attribute field must be between :min and :max digits.", + "dimensions" => "The :attribute field has invalid image dimensions.", + "distinct" => "The :attribute field has a duplicate value.", + "doesnt_end_with" => "The :attribute field must not end with one of the following: :values.", + "doesnt_start_with" => "The :attribute field must not start with one of the following: :values.", + "email" => "The :attribute field must be a valid email address.", + "ends_with" => "The :attribute field must end with one of the following: :values.", + "enum" => "The selected :attribute is invalid.", + "exists" => "The selected :attribute is invalid.", + "extensions" => "The :attribute field must have one of the following extensions: :values.", + "file" => "The :attribute field must be a file.", + "filled" => "The :attribute field must have a value.", + "gt" => [ + "array" => "The :attribute field must have more than :value items.", + "file" => "The :attribute field must be greater than :value kilobytes.", + "numeric" => "The :attribute field must be greater than :value.", + "string" => "The :attribute field must be greater than :value characters." + ], + "gte" => [ + "array" => "The :attribute field must have :value items or more.", + "file" => "The :attribute field must be greater than or equal to :value kilobytes.", + "numeric" => "The :attribute field must be greater than or equal to :value.", + "string" => "The :attribute field must be greater than or equal to :value characters." + ], + "hex_color" => "The :attribute field must be a valid hexadecimal color.", + "image" => "The :attribute field must be an image.", + "in" => "The selected :attribute is invalid.", + "in_array" => "The :attribute field must exist in :other.", + "integer" => "The :attribute field must be an integer.", + "ip" => "The :attribute field must be a valid IP address.", + "ipv4" => "The :attribute field must be a valid IPv4 address.", + "ipv6" => "The :attribute field must be a valid IPv6 address.", + "json" => "The :attribute field must be a valid JSON string.", + "list" => "The :attribute field must be a list.", + "lowercase" => "The :attribute field must be lowercase.", + "lt" => [ + "array" => "The :attribute field must have less than :value items.", + "file" => "The :attribute field must be less than :value kilobytes.", + "numeric" => "The :attribute field must be less than :value.", + "string" => "The :attribute field must be less than :value characters." + ], + "lte" => [ + "array" => "The :attribute field must not have more than :value items.", + "file" => "The :attribute field must be less than or equal to :value kilobytes.", + "numeric" => "The :attribute field must be less than or equal to :value.", + "string" => "The :attribute field must be less than or equal to :value characters." + ], + "mac_address" => "The :attribute field must be a valid MAC address.", + "max" => [ + "array" => "The :attribute field must not have more than :max items.", + "file" => "The :attribute field must not be greater than :max kilobytes.", + "numeric" => "The :attribute field must not be greater than :max.", + "string" => "The :attribute field must not be greater than :max characters." + ], + "max_digits" => "The :attribute field must not have more than :max digits.", + "mimes" => "The :attribute field must be a file of type: :values.", + "mimetypes" => "The :attribute field must be a file of type: :values.", + "min" => [ + "array" => "The :attribute field must have at least :min items.", + "file" => "The :attribute field must be at least :min kilobytes.", + "numeric" => "The :attribute field must be at least :min.", + "string" => "The :attribute field must be at least :min characters." + ], + "min_digits" => "The :attribute field must have at least :min digits.", + "missing" => "The :attribute field must be missing.", + "missing_if" => "The :attribute field must be missing when :other is :value.", + "missing_unless" => "The :attribute field must be missing unless :other is :value.", + "missing_with" => "The :attribute field must be missing when :values is present.", + "missing_with_all" => "The :attribute field must be missing when :values are present.", + "multiple_of" => "The :attribute field must be a multiple of :value.", + "not_in" => "The selected :attribute is invalid.", + "not_regex" => "The :attribute field format is invalid.", + "numeric" => "The :attribute field must be a number.", + "password" => [ + "letters" => "The :attribute field must contain at least one letter.", + "mixed" => "The :attribute field must contain at least one uppercase and one lowercase letter.", + "numbers" => "The :attribute field must contain at least one number.", + "symbols" => "The :attribute field must contain at least one symbol.", + "uncompromised" => "The given :attribute has appeared in a data leak. Please choose a different :attribute." + ], + "present" => "The :attribute field must be present.", + "present_if" => "The :attribute field must be present when :other is :value.", + "present_unless" => "The :attribute field must be present unless :other is :value.", + "present_with" => "The :attribute field must be present when :values is present.", + "present_with_all" => "The :attribute field must be present when :values are present.", + "prohibited" => "The :attribute field is prohibited.", + "prohibited_if" => "The :attribute field is prohibited when :other is :value.", + "prohibited_unless" => "The :attribute field is prohibited unless :other is in :values.", + "prohibits" => "The :attribute field prohibits :other from being present.", + "regex" => "The :attribute field format is invalid.", + "required" => "The :attribute field is required.", + "required_array_keys" => "The :attribute field must contain entries for: :values.", + "required_if" => "The :attribute field is required when :other is :value.", + "required_if_accepted" => "The :attribute field is required when :other is accepted.", + "required_if_declined" => "The :attribute field is required when :other is declined.", + "required_unless" => "The :attribute field is required unless :other is in :values.", + "required_with" => "The :attribute field is required when :values is present.", + "required_with_all" => "The :attribute field is required when :values are present.", + "required_without" => "The :attribute field is required when :values is not present.", + "required_without_all" => "The :attribute field is required when none of :values are present.", + "same" => "The :attribute field must match :other.", + "size" => [ + "array" => "The :attribute field must contain :size items.", + "file" => "The :attribute field must be :size kilobytes.", + "numeric" => "The :attribute field must be :size.", + "string" => "The :attribute field must be :size characters." + ], + "starts_with" => "The :attribute field must start with one of the following: :values.", + "string" => "The :attribute field must be a string.", + "timezone" => "The :attribute field must be a valid timezone.", + "ulid" => "The :attribute field must be a valid ULID.", + "unique" => "The :attribute has already been taken.", + "uploaded" => "The :attribute failed to upload.", + "uppercase" => "The :attribute field must be uppercase.", + "url" => "The :attribute field must be a valid URL.", + "uuid" => "The :attribute field must be a valid UUID." ]; diff --git a/tests/fixtures/basepaths/00-exclude/resources/lang/fr/validation.php b/tests/fixtures/basepaths/00-exclude/resources/lang/fr/validation.php index f58e534..ce74cae 100644 --- a/tests/fixtures/basepaths/00-exclude/resources/lang/fr/validation.php +++ b/tests/fixtures/basepaths/00-exclude/resources/lang/fr/validation.php @@ -2,9 +2,154 @@ return [ "accepted" => "The :attribute must be accepted.", + "accepted_if" => "", "active_url" => "The :attribute is not a valid URL.", + "after" => "", + "after_or_equal" => "", + "alpha" => "", + "alpha_dash" => "", + "alpha_num" => "", + "array" => "", + "ascii" => "", + "before" => "", + "before_or_equal" => "", "between" => [ + "array" => "", "file" => "The :attribute must be between :min and :max kilobytes.", - "numeric" => "The :attribute must be between :min and :max." - ] + "numeric" => "The :attribute must be between :min and :max.", + "string" => "" + ], + "boolean" => "", + "can" => "", + "confirmed" => "", + "current_password" => "", + "custom" => [ + "attribute-name" => [ + "rule-name" => "" + ] + ], + "date" => "", + "date_equals" => "", + "date_format" => "", + "decimal" => "", + "declined" => "", + "declined_if" => "", + "different" => "", + "digits" => "", + "digits_between" => "", + "dimensions" => "", + "distinct" => "", + "doesnt_end_with" => "", + "doesnt_start_with" => "", + "email" => "", + "ends_with" => "", + "enum" => "", + "exists" => "", + "extensions" => "", + "file" => "", + "filled" => "", + "gt" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "gte" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "hex_color" => "", + "image" => "", + "in" => "", + "in_array" => "", + "integer" => "", + "ip" => "", + "ipv4" => "", + "ipv6" => "", + "json" => "", + "list" => "", + "lowercase" => "", + "lt" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "lte" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "mac_address" => "", + "max" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "max_digits" => "", + "mimes" => "", + "mimetypes" => "", + "min" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "min_digits" => "", + "missing" => "", + "missing_if" => "", + "missing_unless" => "", + "missing_with" => "", + "missing_with_all" => "", + "multiple_of" => "", + "not_in" => "", + "not_regex" => "", + "numeric" => "", + "password" => [ + "letters" => "", + "mixed" => "", + "numbers" => "", + "symbols" => "", + "uncompromised" => "" + ], + "present" => "", + "present_if" => "", + "present_unless" => "", + "present_with" => "", + "present_with_all" => "", + "prohibited" => "", + "prohibited_if" => "", + "prohibited_unless" => "", + "prohibits" => "", + "regex" => "", + "required" => "", + "required_array_keys" => "", + "required_if" => "", + "required_if_accepted" => "", + "required_if_declined" => "", + "required_unless" => "", + "required_with" => "", + "required_with_all" => "", + "required_without" => "", + "required_without_all" => "", + "same" => "", + "size" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "starts_with" => "", + "string" => "", + "timezone" => "", + "ulid" => "", + "unique" => "", + "uploaded" => "", + "uppercase" => "", + "url" => "", + "uuid" => "" ]; diff --git a/tests/fixtures/basepaths/00-simple/resources/lang/en/validation.php b/tests/fixtures/basepaths/00-simple/resources/lang/en/validation.php index f58e534..a82e3de 100644 --- a/tests/fixtures/basepaths/00-simple/resources/lang/en/validation.php +++ b/tests/fixtures/basepaths/00-simple/resources/lang/en/validation.php @@ -2,9 +2,154 @@ return [ "accepted" => "The :attribute must be accepted.", + "accepted_if" => "The :attribute field must be accepted when :other is :value.", "active_url" => "The :attribute is not a valid URL.", + "after" => "The :attribute field must be a date after :date.", + "after_or_equal" => "The :attribute field must be a date after or equal to :date.", + "alpha" => "The :attribute field must only contain letters.", + "alpha_dash" => "The :attribute field must only contain letters, numbers, dashes, and underscores.", + "alpha_num" => "The :attribute field must only contain letters and numbers.", + "array" => "The :attribute field must be an array.", + "ascii" => "The :attribute field must only contain single-byte alphanumeric characters and symbols.", + "before" => "The :attribute field must be a date before :date.", + "before_or_equal" => "The :attribute field must be a date before or equal to :date.", "between" => [ + "array" => "The :attribute field must have between :min and :max items.", "file" => "The :attribute must be between :min and :max kilobytes.", - "numeric" => "The :attribute must be between :min and :max." - ] + "numeric" => "The :attribute must be between :min and :max.", + "string" => "The :attribute field must be between :min and :max characters." + ], + "boolean" => "The :attribute field must be true or false.", + "can" => "The :attribute field contains an unauthorized value.", + "confirmed" => "The :attribute field confirmation does not match.", + "current_password" => "The password is incorrect.", + "custom" => [ + "attribute-name" => [ + "rule-name" => "custom-message" + ] + ], + "date" => "The :attribute field must be a valid date.", + "date_equals" => "The :attribute field must be a date equal to :date.", + "date_format" => "The :attribute field must match the format :format.", + "decimal" => "The :attribute field must have :decimal decimal places.", + "declined" => "The :attribute field must be declined.", + "declined_if" => "The :attribute field must be declined when :other is :value.", + "different" => "The :attribute field and :other must be different.", + "digits" => "The :attribute field must be :digits digits.", + "digits_between" => "The :attribute field must be between :min and :max digits.", + "dimensions" => "The :attribute field has invalid image dimensions.", + "distinct" => "The :attribute field has a duplicate value.", + "doesnt_end_with" => "The :attribute field must not end with one of the following: :values.", + "doesnt_start_with" => "The :attribute field must not start with one of the following: :values.", + "email" => "The :attribute field must be a valid email address.", + "ends_with" => "The :attribute field must end with one of the following: :values.", + "enum" => "The selected :attribute is invalid.", + "exists" => "The selected :attribute is invalid.", + "extensions" => "The :attribute field must have one of the following extensions: :values.", + "file" => "The :attribute field must be a file.", + "filled" => "The :attribute field must have a value.", + "gt" => [ + "array" => "The :attribute field must have more than :value items.", + "file" => "The :attribute field must be greater than :value kilobytes.", + "numeric" => "The :attribute field must be greater than :value.", + "string" => "The :attribute field must be greater than :value characters." + ], + "gte" => [ + "array" => "The :attribute field must have :value items or more.", + "file" => "The :attribute field must be greater than or equal to :value kilobytes.", + "numeric" => "The :attribute field must be greater than or equal to :value.", + "string" => "The :attribute field must be greater than or equal to :value characters." + ], + "hex_color" => "The :attribute field must be a valid hexadecimal color.", + "image" => "The :attribute field must be an image.", + "in" => "The selected :attribute is invalid.", + "in_array" => "The :attribute field must exist in :other.", + "integer" => "The :attribute field must be an integer.", + "ip" => "The :attribute field must be a valid IP address.", + "ipv4" => "The :attribute field must be a valid IPv4 address.", + "ipv6" => "The :attribute field must be a valid IPv6 address.", + "json" => "The :attribute field must be a valid JSON string.", + "list" => "The :attribute field must be a list.", + "lowercase" => "The :attribute field must be lowercase.", + "lt" => [ + "array" => "The :attribute field must have less than :value items.", + "file" => "The :attribute field must be less than :value kilobytes.", + "numeric" => "The :attribute field must be less than :value.", + "string" => "The :attribute field must be less than :value characters." + ], + "lte" => [ + "array" => "The :attribute field must not have more than :value items.", + "file" => "The :attribute field must be less than or equal to :value kilobytes.", + "numeric" => "The :attribute field must be less than or equal to :value.", + "string" => "The :attribute field must be less than or equal to :value characters." + ], + "mac_address" => "The :attribute field must be a valid MAC address.", + "max" => [ + "array" => "The :attribute field must not have more than :max items.", + "file" => "The :attribute field must not be greater than :max kilobytes.", + "numeric" => "The :attribute field must not be greater than :max.", + "string" => "The :attribute field must not be greater than :max characters." + ], + "max_digits" => "The :attribute field must not have more than :max digits.", + "mimes" => "The :attribute field must be a file of type: :values.", + "mimetypes" => "The :attribute field must be a file of type: :values.", + "min" => [ + "array" => "The :attribute field must have at least :min items.", + "file" => "The :attribute field must be at least :min kilobytes.", + "numeric" => "The :attribute field must be at least :min.", + "string" => "The :attribute field must be at least :min characters." + ], + "min_digits" => "The :attribute field must have at least :min digits.", + "missing" => "The :attribute field must be missing.", + "missing_if" => "The :attribute field must be missing when :other is :value.", + "missing_unless" => "The :attribute field must be missing unless :other is :value.", + "missing_with" => "The :attribute field must be missing when :values is present.", + "missing_with_all" => "The :attribute field must be missing when :values are present.", + "multiple_of" => "The :attribute field must be a multiple of :value.", + "not_in" => "The selected :attribute is invalid.", + "not_regex" => "The :attribute field format is invalid.", + "numeric" => "The :attribute field must be a number.", + "password" => [ + "letters" => "The :attribute field must contain at least one letter.", + "mixed" => "The :attribute field must contain at least one uppercase and one lowercase letter.", + "numbers" => "The :attribute field must contain at least one number.", + "symbols" => "The :attribute field must contain at least one symbol.", + "uncompromised" => "The given :attribute has appeared in a data leak. Please choose a different :attribute." + ], + "present" => "The :attribute field must be present.", + "present_if" => "The :attribute field must be present when :other is :value.", + "present_unless" => "The :attribute field must be present unless :other is :value.", + "present_with" => "The :attribute field must be present when :values is present.", + "present_with_all" => "The :attribute field must be present when :values are present.", + "prohibited" => "The :attribute field is prohibited.", + "prohibited_if" => "The :attribute field is prohibited when :other is :value.", + "prohibited_unless" => "The :attribute field is prohibited unless :other is in :values.", + "prohibits" => "The :attribute field prohibits :other from being present.", + "regex" => "The :attribute field format is invalid.", + "required" => "The :attribute field is required.", + "required_array_keys" => "The :attribute field must contain entries for: :values.", + "required_if" => "The :attribute field is required when :other is :value.", + "required_if_accepted" => "The :attribute field is required when :other is accepted.", + "required_if_declined" => "The :attribute field is required when :other is declined.", + "required_unless" => "The :attribute field is required unless :other is in :values.", + "required_with" => "The :attribute field is required when :values is present.", + "required_with_all" => "The :attribute field is required when :values are present.", + "required_without" => "The :attribute field is required when :values is not present.", + "required_without_all" => "The :attribute field is required when none of :values are present.", + "same" => "The :attribute field must match :other.", + "size" => [ + "array" => "The :attribute field must contain :size items.", + "file" => "The :attribute field must be :size kilobytes.", + "numeric" => "The :attribute field must be :size.", + "string" => "The :attribute field must be :size characters." + ], + "starts_with" => "The :attribute field must start with one of the following: :values.", + "string" => "The :attribute field must be a string.", + "timezone" => "The :attribute field must be a valid timezone.", + "ulid" => "The :attribute field must be a valid ULID.", + "unique" => "The :attribute has already been taken.", + "uploaded" => "The :attribute failed to upload.", + "uppercase" => "The :attribute field must be uppercase.", + "url" => "The :attribute field must be a valid URL.", + "uuid" => "The :attribute field must be a valid UUID." ]; diff --git a/tests/fixtures/basepaths/00-simple/resources/lang/fr/validation.php b/tests/fixtures/basepaths/00-simple/resources/lang/fr/validation.php index f58e534..ce74cae 100644 --- a/tests/fixtures/basepaths/00-simple/resources/lang/fr/validation.php +++ b/tests/fixtures/basepaths/00-simple/resources/lang/fr/validation.php @@ -2,9 +2,154 @@ return [ "accepted" => "The :attribute must be accepted.", + "accepted_if" => "", "active_url" => "The :attribute is not a valid URL.", + "after" => "", + "after_or_equal" => "", + "alpha" => "", + "alpha_dash" => "", + "alpha_num" => "", + "array" => "", + "ascii" => "", + "before" => "", + "before_or_equal" => "", "between" => [ + "array" => "", "file" => "The :attribute must be between :min and :max kilobytes.", - "numeric" => "The :attribute must be between :min and :max." - ] + "numeric" => "The :attribute must be between :min and :max.", + "string" => "" + ], + "boolean" => "", + "can" => "", + "confirmed" => "", + "current_password" => "", + "custom" => [ + "attribute-name" => [ + "rule-name" => "" + ] + ], + "date" => "", + "date_equals" => "", + "date_format" => "", + "decimal" => "", + "declined" => "", + "declined_if" => "", + "different" => "", + "digits" => "", + "digits_between" => "", + "dimensions" => "", + "distinct" => "", + "doesnt_end_with" => "", + "doesnt_start_with" => "", + "email" => "", + "ends_with" => "", + "enum" => "", + "exists" => "", + "extensions" => "", + "file" => "", + "filled" => "", + "gt" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "gte" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "hex_color" => "", + "image" => "", + "in" => "", + "in_array" => "", + "integer" => "", + "ip" => "", + "ipv4" => "", + "ipv6" => "", + "json" => "", + "list" => "", + "lowercase" => "", + "lt" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "lte" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "mac_address" => "", + "max" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "max_digits" => "", + "mimes" => "", + "mimetypes" => "", + "min" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "min_digits" => "", + "missing" => "", + "missing_if" => "", + "missing_unless" => "", + "missing_with" => "", + "missing_with_all" => "", + "multiple_of" => "", + "not_in" => "", + "not_regex" => "", + "numeric" => "", + "password" => [ + "letters" => "", + "mixed" => "", + "numbers" => "", + "symbols" => "", + "uncompromised" => "" + ], + "present" => "", + "present_if" => "", + "present_unless" => "", + "present_with" => "", + "present_with_all" => "", + "prohibited" => "", + "prohibited_if" => "", + "prohibited_unless" => "", + "prohibits" => "", + "regex" => "", + "required" => "", + "required_array_keys" => "", + "required_if" => "", + "required_if_accepted" => "", + "required_if_declined" => "", + "required_unless" => "", + "required_with" => "", + "required_with_all" => "", + "required_without" => "", + "required_without_all" => "", + "same" => "", + "size" => [ + "array" => "", + "file" => "", + "numeric" => "", + "string" => "" + ], + "starts_with" => "", + "string" => "", + "timezone" => "", + "ulid" => "", + "unique" => "", + "uploaded" => "", + "uppercase" => "", + "url" => "", + "uuid" => "" ];