From 0633e3201b4396023da8caf89c2b40059cd5f1c1 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 21:27:13 +0900 Subject: [PATCH 01/27] Update run-tests.yml --- .github/workflows/run-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ec52cbc..2ad0ee3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,16 +14,20 @@ jobs: matrix: os: [ubuntu-latest] php: [8.0, 8.1, 8.2, 8.3] - laravel: [10.*, 9.*] + laravel: [11.*, 10.*, 9.*] stability: [prefer-lowest, prefer-stable] include: - laravel: 9.* testbench: 7.* - laravel: 10.* testbench: 8.* + - laravel: 11.* + testbench: 9.* exclude: - laravel: 10.* php: 8.0 + - laravel: 11.* + php: [8.0, 8.1] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From aa7ae71981bf3e5fae9da4e4314c6eb643095039 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 21:31:27 +0900 Subject: [PATCH 02/27] Update run-tests.yml --- .github/workflows/run-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2ad0ee3..efd9371 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,7 +27,9 @@ jobs: - laravel: 10.* php: 8.0 - laravel: 11.* - php: [8.0, 8.1] + php: 8.0 + - laravel: 11.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From 3d20762c5b3d6638c374e461f004ed6c34565adc Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 21:33:40 +0900 Subject: [PATCH 03/27] Update composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index ac49a8a..5630bd4 100644 --- a/composer.json +++ b/composer.json @@ -21,13 +21,13 @@ "require": { "php": "^8.0", "spatie/laravel-package-tools": "^1.14.0", - "illuminate/contracts": "^9.28|^10.0" + "illuminate/contracts": "^9.28|^10.0|^11.0" }, "require-dev": { "laravel/pint": "^1.4", "nunomaduro/collision": "^6.0|^7.0", - "nunomaduro/larastan": "^2.0", - "orchestra/testbench": "^7.7|^8.0", + "larastan/larastan": "^2.0", + "orchestra/testbench": "^7.7|^8.0|^9.0", "pestphp/pest": "^1.22|^2.0", "phpstan/extension-installer": "^1.2", "phpunit/phpunit": "^9.5.27|^10.0" From aa55527c6bac216052111cdb901a46034d4800d0 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 21:36:46 +0900 Subject: [PATCH 04/27] Update composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 5630bd4..367e49e 100644 --- a/composer.json +++ b/composer.json @@ -25,12 +25,12 @@ }, "require-dev": { "laravel/pint": "^1.4", - "nunomaduro/collision": "^6.0|^7.0", + "nunomaduro/collision": "^6.0|^7.0|^8.0", "larastan/larastan": "^2.0", "orchestra/testbench": "^7.7|^8.0|^9.0", - "pestphp/pest": "^1.22|^2.0", + "pestphp/pest": "^1.22|^2.0|^3.0", "phpstan/extension-installer": "^1.2", - "phpunit/phpunit": "^9.5.27|^10.0" + "phpunit/phpunit": "^9.5.27|^10.0|^11.0" }, "autoload": { "psr-4": { From 5956821809955376f91769e809bbf26cda685087 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 07:49:21 +0900 Subject: [PATCH 05/27] Update install command for Laravel 11 --- src/Commands/BreezejpCommand.php | 83 +++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index 94d4be7..14f8aba 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -25,36 +25,71 @@ public function handle(): int (new Filesystem)->ensureDirectoryExists(lang_path()); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/lang/', lang_path()); - $this->info('config/app.phpのlocaleをjaにします'); - // Read the contents of the file into a string - $configfile = file_get_contents(base_path('config/app.php')); + if (file_exists(base_path("config/app.php"))) { + $this->info('config/app.phpのlocaleをjaにします'); + // Read the contents of the file into a string + $configfile = file_get_contents(base_path('config/app.php')); + + // Modify the contents of the string + $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); + $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); + $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); + + // Save the modified contents back to the file + file_put_contents(base_path('config/app.php'), $configfile); + + if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) { + $repoUrl = 'https://github.com/askdkc/breezejp'; + + if (PHP_OS_FAMILY == 'Darwin') { + exec("open {$repoUrl}"); + } + if (PHP_OS_FAMILY == 'Windows') { + exec("start {$repoUrl}"); + } + if (PHP_OS_FAMILY == 'Linux') { + exec("xdg-open {$repoUrl}"); + } + + $this->line('Thank you! / ありがとう💓'); + } - // Modify the contents of the string - $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); - $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); - $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); + $this->info('日本語ファイルのインストールが完了しました!'); - // Save the modified contents back to the file - file_put_contents(base_path('config/app.php'), $configfile); + return self::SUCCESS; - if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) { - $repoUrl = 'https://github.com/askdkc/breezejp'; + } - if (PHP_OS_FAMILY == 'Darwin') { - exec("open {$repoUrl}"); - } - if (PHP_OS_FAMILY == 'Windows') { - exec("start {$repoUrl}"); - } - if (PHP_OS_FAMILY == 'Linux') { - exec("xdg-open {$repoUrl}"); - } - $this->line('Thank you! / ありがとう💓'); - } + // For Laravel 11 and above + $this->info('.envのlocaleをjaにします'); + // Read the contents of the file into a string + $configfile = file_get_contents(base_path('.env')); - $this->info('日本語ファイルのインストールが完了しました!'); + // Modify the contents of the string + $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); + $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); + $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); + + // Save the modified contents back to the file + file_put_contents(base_path('.env'), $configfile); + + if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) { + $repoUrl = 'https://github.com/askdkc/breezejp'; + + if (PHP_OS_FAMILY == 'Darwin') { + exec("open {$repoUrl}"); + } + if (PHP_OS_FAMILY == 'Windows') { + exec("start {$repoUrl}"); + } + if (PHP_OS_FAMILY == 'Linux') { + exec("xdg-open {$repoUrl}"); + } + + $this->line('Thank you! / ありがとう💓'); + } - return self::SUCCESS; + } } From 843a825920d4185946f04fba7ce02b01cf356ac4 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 22:49:44 +0000 Subject: [PATCH 06/27] Fix styling --- src/Commands/BreezejpCommand.php | 46 +++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index 14f8aba..a16991c 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -25,7 +25,7 @@ public function handle(): int (new Filesystem)->ensureDirectoryExists(lang_path()); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/lang/', lang_path()); - if (file_exists(base_path("config/app.php"))) { + if (file_exists(base_path('config/app.php'))) { $this->info('config/app.phpのlocaleをjaにします'); // Read the contents of the file into a string $configfile = file_get_contents(base_path('config/app.php')); @@ -60,36 +60,34 @@ public function handle(): int } - // For Laravel 11 and above $this->info('.envのlocaleをjaにします'); - // Read the contents of the file into a string - $configfile = file_get_contents(base_path('.env')); - - // Modify the contents of the string - $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); - $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); - $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); + // Read the contents of the file into a string + $configfile = file_get_contents(base_path('.env')); - // Save the modified contents back to the file - file_put_contents(base_path('.env'), $configfile); + // Modify the contents of the string + $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); + $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); + $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); - if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) { - $repoUrl = 'https://github.com/askdkc/breezejp'; + // Save the modified contents back to the file + file_put_contents(base_path('.env'), $configfile); - if (PHP_OS_FAMILY == 'Darwin') { - exec("open {$repoUrl}"); - } - if (PHP_OS_FAMILY == 'Windows') { - exec("start {$repoUrl}"); - } - if (PHP_OS_FAMILY == 'Linux') { - exec("xdg-open {$repoUrl}"); - } + if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) { + $repoUrl = 'https://github.com/askdkc/breezejp'; - $this->line('Thank you! / ありがとう💓'); + if (PHP_OS_FAMILY == 'Darwin') { + exec("open {$repoUrl}"); + } + if (PHP_OS_FAMILY == 'Windows') { + exec("start {$repoUrl}"); } + if (PHP_OS_FAMILY == 'Linux') { + exec("xdg-open {$repoUrl}"); + } + + $this->line('Thank you! / ありがとう💓'); + } - } } From 7f60983c1c78115b08aacb6955c7c0f59ec0b438 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 07:52:13 +0900 Subject: [PATCH 07/27] Update test to support Laravel 11 --- tests/CommandTest.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 1c0c284..47c74e5 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,10 +21,17 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - $configfile = file_get_contents(base_path('config/app.php')); - $this->assertStringContainsString("'locale' => 'ja'", $configfile); - $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); - $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + if (file_exists(base_path("config/app.php"))) { + $configfile = file_get_contents(base_path('config/app.php')); + $this->assertStringContainsString("'locale' => 'ja'", $configfile); + $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); + $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + } else { // For Laravel 11 and above + $configfile = file_get_contents(base_path('.env')); + $this->assertStringContainsString("'locale' => 'ja'", $configfile); + $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); + $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + } }); test('breezejp command successfully update config/app.php timezone to Asia/Tokyo', function () { @@ -34,6 +41,11 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - $configfile = file_get_contents(base_path('config/app.php')); - $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + if (file_exists(base_path("config/app.php"))) { + $configfile = file_get_contents(base_path('config/app.php')); + $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + } else { // For Laravel 11 and above + $configfile = file_get_contents(base_path('.env')); + $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + } }); From f083efc4ababd926f344883a0ad79fba044b487b Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 22:52:55 +0000 Subject: [PATCH 08/27] Fix styling --- tests/CommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 47c74e5..e933c90 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,7 +21,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (file_exists(base_path("config/app.php"))) { + if (file_exists(base_path('config/app.php'))) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'locale' => 'ja'", $configfile); $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); @@ -41,7 +41,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (file_exists(base_path("config/app.php"))) { + if (file_exists(base_path('config/app.php'))) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above From d96130c9b77f29dd1b7c2fa6e0f2a72c3d777fc6 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:02:08 +0900 Subject: [PATCH 09/27] Fix to adopt Laravel 11 .env --- src/Commands/BreezejpCommand.php | 8 ++++---- tests/CommandTest.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index a16991c..e3b76a7 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -61,14 +61,14 @@ public function handle(): int } // For Laravel 11 and above - $this->info('.envのlocaleをjaにします'); + $this->info('.envのAPP_LOCALEやTAPP_IMEZONEを日本にします'); // Read the contents of the file into a string $configfile = file_get_contents(base_path('.env')); // Modify the contents of the string - $configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile); - $configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile); - $configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile); + $configfile = str_replace("APP_LOCALE=en", "APP_LOCALE=ja", $configfile); + $configfile = str_replace("APP_FAKER_LOCALE=en", "APP_FAKER_LOCALE=ja_JP", $configfile); + $configfile = str_replace("APP_TIMEZONE=UTC", "APP_TIMEZONE=Asia/Tokyo", $configfile); // Save the modified contents back to the file file_put_contents(base_path('.env'), $configfile); diff --git a/tests/CommandTest.php b/tests/CommandTest.php index e933c90..8e617d1 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -28,9 +28,9 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); - $this->assertStringContainsString("'locale' => 'ja'", $configfile); - $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); - $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + $this->assertStringContainsString("APP_LOCALE=ja", $configfile); + $this->assertStringContainsString("APP_FAKER_LOCALE=ja_JP", $configfile); + $this->assertStringContainsString("APP_TIMEZONE=Asia/Tokyo", $configfile); } }); @@ -46,6 +46,6 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); - $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); + $this->assertStringContainsString("APP_TIMEZONE=Asia/Tokyo", $configfile); } }); From e116fce471f46a222752b7bc5ac56bcd173e3639 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 23:02:34 +0000 Subject: [PATCH 10/27] Fix styling --- src/Commands/BreezejpCommand.php | 6 +++--- tests/CommandTest.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index e3b76a7..ce1d276 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -66,9 +66,9 @@ public function handle(): int $configfile = file_get_contents(base_path('.env')); // Modify the contents of the string - $configfile = str_replace("APP_LOCALE=en", "APP_LOCALE=ja", $configfile); - $configfile = str_replace("APP_FAKER_LOCALE=en", "APP_FAKER_LOCALE=ja_JP", $configfile); - $configfile = str_replace("APP_TIMEZONE=UTC", "APP_TIMEZONE=Asia/Tokyo", $configfile); + $configfile = str_replace('APP_LOCALE=en', 'APP_LOCALE=ja', $configfile); + $configfile = str_replace('APP_FAKER_LOCALE=en', 'APP_FAKER_LOCALE=ja_JP', $configfile); + $configfile = str_replace('APP_TIMEZONE=UTC', 'APP_TIMEZONE=Asia/Tokyo', $configfile); // Save the modified contents back to the file file_put_contents(base_path('.env'), $configfile); diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 8e617d1..063cb27 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -28,9 +28,9 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); - $this->assertStringContainsString("APP_LOCALE=ja", $configfile); - $this->assertStringContainsString("APP_FAKER_LOCALE=ja_JP", $configfile); - $this->assertStringContainsString("APP_TIMEZONE=Asia/Tokyo", $configfile); + $this->assertStringContainsString('APP_LOCALE=ja', $configfile); + $this->assertStringContainsString('APP_FAKER_LOCALE=ja_JP', $configfile); + $this->assertStringContainsString('APP_TIMEZONE=Asia/Tokyo', $configfile); } }); @@ -46,6 +46,6 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); - $this->assertStringContainsString("APP_TIMEZONE=Asia/Tokyo", $configfile); + $this->assertStringContainsString('APP_TIMEZONE=Asia/Tokyo', $configfile); } }); From 61262523472f5ca20b070bd03a1254421b17f7be Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:25:59 +0900 Subject: [PATCH 11/27] Using Laravel version for test --- tests/CommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 8e617d1..e16ad0d 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,7 +21,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (file_exists(base_path('config/app.php'))) { + if (11 <= (int) substr(Illuminate\Foundation\Application::VERSION, 0, 2)) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'locale' => 'ja'", $configfile); $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); From 1aca61c689ae3290caf920aee84f8a4ca64cf37e Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 23:26:30 +0000 Subject: [PATCH 12/27] Fix styling --- tests/CommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index ff146f7..b2ed17c 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,7 +21,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (11 <= (int) substr(Illuminate\Foundation\Application::VERSION, 0, 2)) { + if ((int) substr(Illuminate\Foundation\Application::VERSION, 0, 2) >= 11) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'locale' => 'ja'", $configfile); $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); From b4905e27b53a9f040a62c4ee206c923c6d9a3b73 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:29:20 +0900 Subject: [PATCH 13/27] Fix condition --- tests/CommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index ff146f7..5e2fa1d 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,7 +21,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (11 <= (int) substr(Illuminate\Foundation\Application::VERSION, 0, 2)) { + if (11 > (int) substr(Illuminate\Foundation\Application::VERSION, 0, 2)) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'locale' => 'ja'", $configfile); $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); From 4385358e52a2b872ad2721e46306f41e09f606d8 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:32:12 +0900 Subject: [PATCH 14/27] Fix condition --- tests/CommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 5e2fa1d..8ea88d1 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -21,7 +21,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (11 > (int) substr(Illuminate\Foundation\Application::VERSION, 0, 2)) { + if ((int) substr(Illuminate\Foundation\Application::VERSION, 0, 2) < 11) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'locale' => 'ja'", $configfile); $this->assertStringContainsString("'faker_locale' => 'ja_JP'", $configfile); @@ -41,7 +41,7 @@ ->expectsOutput('日本語ファイルのインストールが完了しました!') ->assertExitCode(0); - if (file_exists(base_path('config/app.php'))) { + if ((int) substr(Illuminate\Foundation\Application::VERSION, 0, 2) < 11) { $configfile = file_get_contents(base_path('config/app.php')); $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above From 92ff933513833d597b36f770fe0da978ac099fcc Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:37:26 +0900 Subject: [PATCH 15/27] Update run-tests.yml --- .github/workflows/run-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index efd9371..1bbcef4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -65,5 +65,9 @@ jobs: - name: List Installed Dependencies run: composer show -D + - name: Laravel Setup + run: | + cp .env.test .env + - name: Execute tests run: vendor/bin/pest --ci From 95f976f17e3195f2f9ad6442b2efabc72dfa18e7 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:48:37 +0900 Subject: [PATCH 16/27] Update test case for 11 --- .github/workflows/run-tests.yml | 4 ---- tests/TestCase.php | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1bbcef4..efd9371 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -65,9 +65,5 @@ jobs: - name: List Installed Dependencies run: composer show -D - - name: Laravel Setup - run: | - cp .env.test .env - - name: Execute tests run: vendor/bin/pest --ci diff --git a/tests/TestCase.php b/tests/TestCase.php index 0ff1962..ab53ee4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,6 +12,8 @@ protected function setUp(): void { parent::setUp(); + copy (__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env.example', __DIR__.'/../vendor/orchestra/testbench-core/laravel/.env'); + // テスト用のファイルが残ってたら消す(web.php) if (is_file(__DIR__.'/../vendor/orchestra/testbench-core/laravel/routes/web.php')) { unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/routes/web.php'); From 2a3f8b0070e5c19d64e3ce19b1b20b22dcf0b817 Mon Sep 17 00:00:00 2001 From: askdkc Date: Tue, 16 Jan 2024 23:49:03 +0000 Subject: [PATCH 17/27] Fix styling --- tests/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index ab53ee4..08ab769 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,7 +12,7 @@ protected function setUp(): void { parent::setUp(); - copy (__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env.example', __DIR__.'/../vendor/orchestra/testbench-core/laravel/.env'); + copy(__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env.example', __DIR__.'/../vendor/orchestra/testbench-core/laravel/.env'); // テスト用のファイルが残ってたら消す(web.php) if (is_file(__DIR__.'/../vendor/orchestra/testbench-core/laravel/routes/web.php')) { From f95f848b7d4bc9fafc327d14ee774f58c6221ec8 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 08:56:11 +0900 Subject: [PATCH 18/27] Update CommandTest.php --- tests/CommandTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 8ea88d1..09d7bfd 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -1,5 +1,9 @@ assertFileExists(base_path('.env')); +}); + test('breezejp command successfully run and see all the published files', closure: function () { $this->artisan('breezejp') ->expectsOutput('Laravel Breeze用に日本語翻訳ファイルを準備します') From a75cd7f06ce0e0eb3ec18aafd2d223459b36f9e0 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 09:04:34 +0900 Subject: [PATCH 19/27] debug --- tests/CommandTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 09d7bfd..a18c289 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -32,6 +32,7 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); + dump($configfile); $this->assertStringContainsString('APP_LOCALE=ja', $configfile); $this->assertStringContainsString('APP_FAKER_LOCALE=ja_JP', $configfile); $this->assertStringContainsString('APP_TIMEZONE=Asia/Tokyo', $configfile); From a42b21795faf3c59c08c35ecc2d93d5abb2b2af7 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 09:11:42 +0900 Subject: [PATCH 20/27] Update CommandTest.php --- tests/CommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index a18c289..a154a53 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -2,6 +2,7 @@ test('.env file exists', function () { $this->assertFileExists(base_path('.env')); + var_dump(file_get_contents(base_path(".env"))); }); test('breezejp command successfully run and see all the published files', closure: function () { @@ -32,7 +33,6 @@ $this->assertStringContainsString("'timezone' => 'Asia/Tokyo'", $configfile); } else { // For Laravel 11 and above $configfile = file_get_contents(base_path('.env')); - dump($configfile); $this->assertStringContainsString('APP_LOCALE=ja', $configfile); $this->assertStringContainsString('APP_FAKER_LOCALE=ja_JP', $configfile); $this->assertStringContainsString('APP_TIMEZONE=Asia/Tokyo', $configfile); From 5ae1d96841855f29cc63f772a29c2f2623e9c2ef Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 00:12:07 +0000 Subject: [PATCH 21/27] Fix styling --- tests/CommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index a154a53..b46c560 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -2,7 +2,7 @@ test('.env file exists', function () { $this->assertFileExists(base_path('.env')); - var_dump(file_get_contents(base_path(".env"))); + var_dump(file_get_contents(base_path('.env'))); }); test('breezejp command successfully run and see all the published files', closure: function () { From 952dc888f07b9d9e7d0465e71dd239d65c0d1a63 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 09:21:25 +0900 Subject: [PATCH 22/27] Update BreezejpCommand.php --- src/Commands/BreezejpCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index ce1d276..e9d2265 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -70,6 +70,8 @@ public function handle(): int $configfile = str_replace('APP_FAKER_LOCALE=en', 'APP_FAKER_LOCALE=ja_JP', $configfile); $configfile = str_replace('APP_TIMEZONE=UTC', 'APP_TIMEZONE=Asia/Tokyo', $configfile); + var_dump($configfile); + // Save the modified contents back to the file file_put_contents(base_path('.env'), $configfile); @@ -89,5 +91,9 @@ public function handle(): int $this->line('Thank you! / ありがとう💓'); } + $this->info('日本語ファイルのインストールが完了しました!'); + + return self::SUCCESS; + } } From 24562bb5e0a44a227f5d993e27475073798ad4ae Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 00:22:06 +0000 Subject: [PATCH 23/27] Fix styling --- src/Commands/BreezejpCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index e9d2265..23e463f 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -93,7 +93,7 @@ public function handle(): int $this->info('日本語ファイルのインストールが完了しました!'); - return self::SUCCESS; + return self::SUCCESS; } } From 4acfa5ab5d36b63580483317b707cb963e612f4f Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 09:23:15 +0900 Subject: [PATCH 24/27] Update BreezejpCommand.php --- src/Commands/BreezejpCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index 23e463f..be85142 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -67,7 +67,7 @@ public function handle(): int // Modify the contents of the string $configfile = str_replace('APP_LOCALE=en', 'APP_LOCALE=ja', $configfile); - $configfile = str_replace('APP_FAKER_LOCALE=en', 'APP_FAKER_LOCALE=ja_JP', $configfile); + $configfile = str_replace('APP_FAKER_LOCALE=en_US', 'APP_FAKER_LOCALE=ja_JP', $configfile); $configfile = str_replace('APP_TIMEZONE=UTC', 'APP_TIMEZONE=Asia/Tokyo', $configfile); var_dump($configfile); From 807f0c0e824f6422100c1083613f640f24f764c5 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 10:15:05 +0900 Subject: [PATCH 25/27] Fix Laravel 11 Issue --- src/Commands/BreezejpCommand.php | 6 +++--- tests/CommandTest.php | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index be85142..fdade51 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -25,7 +25,9 @@ public function handle(): int (new Filesystem)->ensureDirectoryExists(lang_path()); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/lang/', lang_path()); - if (file_exists(base_path('config/app.php'))) { + $envfile = file_get_contents(base_path('.env')); + + if (strpos($envfile, "APP_FAKER_LOCALE") == false) { $this->info('config/app.phpのlocaleをjaにします'); // Read the contents of the file into a string $configfile = file_get_contents(base_path('config/app.php')); @@ -70,8 +72,6 @@ public function handle(): int $configfile = str_replace('APP_FAKER_LOCALE=en_US', 'APP_FAKER_LOCALE=ja_JP', $configfile); $configfile = str_replace('APP_TIMEZONE=UTC', 'APP_TIMEZONE=Asia/Tokyo', $configfile); - var_dump($configfile); - // Save the modified contents back to the file file_put_contents(base_path('.env'), $configfile); diff --git a/tests/CommandTest.php b/tests/CommandTest.php index b46c560..09d7bfd 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -2,7 +2,6 @@ test('.env file exists', function () { $this->assertFileExists(base_path('.env')); - var_dump(file_get_contents(base_path('.env'))); }); test('breezejp command successfully run and see all the published files', closure: function () { From 7b8658b90ef21fd8da6c135adf336cfd87f44e42 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 01:15:28 +0000 Subject: [PATCH 26/27] Fix styling --- src/Commands/BreezejpCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BreezejpCommand.php b/src/Commands/BreezejpCommand.php index fdade51..9c63aac 100644 --- a/src/Commands/BreezejpCommand.php +++ b/src/Commands/BreezejpCommand.php @@ -27,7 +27,7 @@ public function handle(): int $envfile = file_get_contents(base_path('.env')); - if (strpos($envfile, "APP_FAKER_LOCALE") == false) { + if (strpos($envfile, 'APP_FAKER_LOCALE') == false) { $this->info('config/app.phpのlocaleをjaにします'); // Read the contents of the file into a string $configfile = file_get_contents(base_path('config/app.php')); From a039b23efe0cb79fd89a14a2f5a6311aad89a6d7 Mon Sep 17 00:00:00 2001 From: askdkc Date: Wed, 17 Jan 2024 10:17:34 +0900 Subject: [PATCH 27/27] Update run-tests.yml --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index efd9371..8da058a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -15,7 +15,7 @@ jobs: os: [ubuntu-latest] php: [8.0, 8.1, 8.2, 8.3] laravel: [11.*, 10.*, 9.*] - stability: [prefer-lowest, prefer-stable] + stability: [prefer-stable] include: - laravel: 9.* testbench: 7.*