From 83d1ff20dc907af7e13fc2d6b24cc4b120131a57 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 1 Apr 2025 21:53:12 +0300 Subject: [PATCH 1/2] Removed Laravel 10 --- .github/workflows/{phpunit.yml => tests.yml} | 9 +---- composer.json | 13 ++---- tests/Commands/MutexTest.php | 40 +++++++++---------- tests/Concerns/AssertDatabase.php | 16 ++++++-- .../async/2021_04_06_212742_every_time.php | 4 +- .../app/async/2023_04_06_212637_foo_bar.php | 4 +- .../operations/2020_12_07_153105_foo_bar.php | 4 +- .../2021_01_02_020947_every_time.php | 4 +- .../2021_05_24_120003_run_on_all.php | 6 +-- ..._05_24_120003_run_on_many_environments.php | 6 +-- .../2021_05_24_120003_run_on_production.php | 6 +-- .../2021_05_24_120003_run_on_testing.php | 6 +-- ...021_06_07_132849_run_except_production.php | 6 +-- .../2021_06_07_132917_run_except_testing.php | 6 +-- ...07_134045_run_except_many_environments.php | 6 +-- .../2021_10_26_143247_run_allow.php | 6 +-- .../2021_10_26_143304_run_disallow.php | 6 +-- .../2021_12_23_165047_run_success.php | 8 ++-- .../2021_12_23_184029_run_failed.php | 4 +- .../2022_08_17_135147_test_before_enabled.php | 6 +-- ...2022_08_17_135153_test_before_disabled.php | 6 +-- .../sub_path/2021_12_15_205804_baz.php | 4 +- .../sub_path/2022_10_27_230732_foo.php | 4 +- ...021_12_23_165048_run_success_on_failed.php | 4 +- .../2021_12_23_184029_run_failed_failure.php | 4 +- ...2_15_124237_test_success_transactions.stub | 4 +- ...02_15_124852_test_failed_transactions.stub | 4 +- 27 files changed, 96 insertions(+), 100 deletions(-) rename .github/workflows/{phpunit.yml => tests.yml} (74%) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/tests.yml similarity index 74% rename from .github/workflows/phpunit.yml rename to .github/workflows/tests.yml index 658c16e8..0b22f4e2 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/tests.yml @@ -10,10 +10,7 @@ jobs: fail-fast: true matrix: php: [ "8.2", "8.3", "8.4" ] - laravel: [ "10.0", "11.0", "12.0" ] - exclude: - - laravel: "10.0" - php: "8.4" + laravel: [ "11.0", "12.0" ] name: PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }} @@ -31,9 +28,5 @@ jobs: - name: Install dependencies run: composer require --dev laravel/framework:^${{ matrix.laravel }} - - name: Install Doctrine - if: matrix.laravel == '10.0' - run: composer require doctrine/dbal - - name: Execute tests run: sudo vendor/bin/phpunit diff --git a/composer.json b/composer.json index 2bbd60e8..445f75f9 100644 --- a/composer.json +++ b/composer.json @@ -41,20 +41,15 @@ "php": "^8.2", "composer-runtime-api": "^2.2", "dragon-code/support": "^6.6", - "illuminate/console": "^10.0 || ^11.0 || ^12.0", - "illuminate/container": "^10.0 || ^11.0 || ^12.0", - "illuminate/database": "^10.0 || ^11.0 || ^12.0", - "illuminate/support": "^10.0 || ^11.0 || ^12.0", + "laravel/framework": "^11.0 || ^12.0", "laravel/prompts": ">=0.1", - "spatie/laravel-data": "^4.14", - "symfony/console": "^6.0 || ^7.0" + "spatie/laravel-data": "^4.14" }, "require-dev": { "mockery/mockery": "^1.3.1", "nesbot/carbon": "^2.62.1 || ^3.0", - "orchestra/testbench": "^8.0 || ^9.0 || ^10.0", - "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", - "ramsey/uuid": "^4.0" + "orchestra/testbench": "^9.0 || ^10.0", + "phpunit/phpunit": "^11.0 || ^12.0" }, "conflict": { "andrey-helldar/laravel-actions": "*", diff --git a/tests/Commands/MutexTest.php b/tests/Commands/MutexTest.php index a3d5ce7a..d7ec9d05 100644 --- a/tests/Commands/MutexTest.php +++ b/tests/Commands/MutexTest.php @@ -19,26 +19,6 @@ class MutexTest extends TestCase protected MutexService $mutex; - protected function setUp(): void - { - $this->command = new class extends Command { - public int $ran = 0; - - public function handle(): int - { - ++$this->ran; - - return self::SUCCESS; - } - }; - - $this->mutex = m::mock(MutexService::class); - - $container = Container::getInstance(); - $container->instance(MutexService::class, $this->mutex); - $this->command->setLaravel($container); - } - public function testCanRunIsolatedCommandIfNotBlocked() { $this->mutex->shouldReceive('create') @@ -91,6 +71,26 @@ public function testCanRunCommandAgainNonAutomated() $this->assertEquals(1, $this->command->ran); } + protected function setUp(): void + { + $this->command = new class extends Command { + public int $ran = 0; + + public function handle(): int + { + ++$this->ran; + + return self::SUCCESS; + } + }; + + $this->mutex = m::mock(MutexService::class); + + $container = Container::getInstance(); + $container->instance(MutexService::class, $this->mutex); + $this->command->setLaravel($container); + } + protected function runCommand($withIsolated = true) { $input = new ArrayInput(['--' . Options::Isolated => $withIsolated]); diff --git a/tests/Concerns/AssertDatabase.php b/tests/Concerns/AssertDatabase.php index 7f663dbb..d613220c 100644 --- a/tests/Concerns/AssertDatabase.php +++ b/tests/Concerns/AssertDatabase.php @@ -24,8 +24,12 @@ protected function assertDatabaseDoesntTable(string $table): void ); } - protected function assertDatabaseOperationHas(string $table, $value, $connection = null, string $column = 'operation'): void - { + protected function assertDatabaseOperationHas( + string $table, + $value, + $connection = null, + string $column = 'operation' + ): void { $this->assertDatabaseHasLike($table, $column, $value, $connection); } @@ -39,8 +43,12 @@ protected function assertDatabaseHasLike(string $table, string $column, $value, $this->assertTrue($exists); } - protected function assertDatabaseOperationDoesntLike(string $table, $value, $connection = null, string $column = 'operation'): void - { + protected function assertDatabaseOperationDoesntLike( + string $table, + $value, + $connection = null, + string $column = 'operation' + ): void { $this->assertDatabaseDoesntLike($table, $column, $value, $connection); } diff --git a/tests/fixtures/app/async/2021_04_06_212742_every_time.php b/tests/fixtures/app/async/2021_04_06_212742_every_time.php index db46d5f9..00480505 100644 --- a/tests/fixtures/app/async/2021_04_06_212742_every_time.php +++ b/tests/fixtures/app/async/2021_04_06_212742_every_time.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function __invoke(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/async/2023_04_06_212637_foo_bar.php b/tests/fixtures/app/async/2023_04_06_212637_foo_bar.php index 835d291e..a30b8bd0 100644 --- a/tests/fixtures/app/async/2023_04_06_212637_foo_bar.php +++ b/tests/fixtures/app/async/2023_04_06_212637_foo_bar.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function __invoke(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2020_12_07_153105_foo_bar.php b/tests/fixtures/app/operations/2020_12_07_153105_foo_bar.php index b1a58e47..835b1c22 100644 --- a/tests/fixtures/app/operations/2020_12_07_153105_foo_bar.php +++ b/tests/fixtures/app/operations/2020_12_07_153105_foo_bar.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_01_02_020947_every_time.php b/tests/fixtures/app/operations/2021_01_02_020947_every_time.php index 76bdc934..6bc7a160 100644 --- a/tests/fixtures/app/operations/2021_01_02_020947_every_time.php +++ b/tests/fixtures/app/operations/2021_01_02_020947_every_time.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_05_24_120003_run_on_all.php b/tests/fixtures/app/operations/2021_05_24_120003_run_on_all.php index b1314138..fd6351f2 100644 --- a/tests/fixtures/app/operations/2021_05_24_120003_run_on_all.php +++ b/tests/fixtures/app/operations/2021_05_24_120003_run_on_all.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_05_24_120003_run_on_many_environments.php b/tests/fixtures/app/operations/2021_05_24_120003_run_on_many_environments.php index f0c017d8..a2add2f8 100644 --- a/tests/fixtures/app/operations/2021_05_24_120003_run_on_many_environments.php +++ b/tests/fixtures/app/operations/2021_05_24_120003_run_on_many_environments.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_05_24_120003_run_on_production.php b/tests/fixtures/app/operations/2021_05_24_120003_run_on_production.php index 43ae207e..1c77a8af 100644 --- a/tests/fixtures/app/operations/2021_05_24_120003_run_on_production.php +++ b/tests/fixtures/app/operations/2021_05_24_120003_run_on_production.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_05_24_120003_run_on_testing.php b/tests/fixtures/app/operations/2021_05_24_120003_run_on_testing.php index 75879982..84d7a22a 100644 --- a/tests/fixtures/app/operations/2021_05_24_120003_run_on_testing.php +++ b/tests/fixtures/app/operations/2021_05_24_120003_run_on_testing.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_06_07_132849_run_except_production.php b/tests/fixtures/app/operations/2021_06_07_132849_run_except_production.php index 0a17272d..aacf4ac6 100644 --- a/tests/fixtures/app/operations/2021_06_07_132849_run_except_production.php +++ b/tests/fixtures/app/operations/2021_06_07_132849_run_except_production.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_06_07_132917_run_except_testing.php b/tests/fixtures/app/operations/2021_06_07_132917_run_except_testing.php index 7cf0bd0d..1c0ca90d 100644 --- a/tests/fixtures/app/operations/2021_06_07_132917_run_except_testing.php +++ b/tests/fixtures/app/operations/2021_06_07_132917_run_except_testing.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_06_07_134045_run_except_many_environments.php b/tests/fixtures/app/operations/2021_06_07_134045_run_except_many_environments.php index 983563ce..50bb7002 100644 --- a/tests/fixtures/app/operations/2021_06_07_134045_run_except_many_environments.php +++ b/tests/fixtures/app/operations/2021_06_07_134045_run_except_many_environments.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_10_26_143247_run_allow.php b/tests/fixtures/app/operations/2021_10_26_143247_run_allow.php index b1314138..fd6351f2 100644 --- a/tests/fixtures/app/operations/2021_10_26_143247_run_allow.php +++ b/tests/fixtures/app/operations/2021_10_26_143247_run_allow.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_10_26_143304_run_disallow.php b/tests/fixtures/app/operations/2021_10_26_143304_run_disallow.php index 6af56437..56a4a676 100644 --- a/tests/fixtures/app/operations/2021_10_26_143304_run_disallow.php +++ b/tests/fixtures/app/operations/2021_10_26_143304_run_disallow.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_12_23_165047_run_success.php b/tests/fixtures/app/operations/2021_12_23_165047_run_success.php index cfc10c98..537ec651 100644 --- a/tests/fixtures/app/operations/2021_12_23_165047_run_success.php +++ b/tests/fixtures/app/operations/2021_12_23_165047_run_success.php @@ -5,27 +5,27 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function success(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2021_12_23_184029_run_failed.php b/tests/fixtures/app/operations/2021_12_23_184029_run_failed.php index c810204c..c46fc42c 100644 --- a/tests/fixtures/app/operations/2021_12_23_184029_run_failed.php +++ b/tests/fixtures/app/operations/2021_12_23_184029_run_failed.php @@ -5,7 +5,7 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void {} @@ -15,7 +15,7 @@ public function down(): void {} public function failed(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2022_08_17_135147_test_before_enabled.php b/tests/fixtures/app/operations/2022_08_17_135147_test_before_enabled.php index 2cc3c170..47f93d40 100644 --- a/tests/fixtures/app/operations/2022_08_17_135147_test_before_enabled.php +++ b/tests/fixtures/app/operations/2022_08_17_135147_test_before_enabled.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/2022_08_17_135153_test_before_disabled.php b/tests/fixtures/app/operations/2022_08_17_135153_test_before_disabled.php index 161fb286..cea42f9e 100644 --- a/tests/fixtures/app/operations/2022_08_17_135153_test_before_disabled.php +++ b/tests/fixtures/app/operations/2022_08_17_135153_test_before_disabled.php @@ -5,20 +5,20 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } public function down(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/sub_path/2021_12_15_205804_baz.php b/tests/fixtures/app/operations/sub_path/2021_12_15_205804_baz.php index b1a58e47..835b1c22 100644 --- a/tests/fixtures/app/operations/sub_path/2021_12_15_205804_baz.php +++ b/tests/fixtures/app/operations/sub_path/2021_12_15_205804_baz.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations/sub_path/2022_10_27_230732_foo.php b/tests/fixtures/app/operations/sub_path/2022_10_27_230732_foo.php index b1a58e47..835b1c22 100644 --- a/tests/fixtures/app/operations/sub_path/2022_10_27_230732_foo.php +++ b/tests/fixtures/app/operations/sub_path/2022_10_27_230732_foo.php @@ -5,13 +5,13 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations_failed/2021_12_23_165048_run_success_on_failed.php b/tests/fixtures/app/operations_failed/2021_12_23_165048_run_success_on_failed.php index 0f483b4b..2ed752b0 100644 --- a/tests/fixtures/app/operations_failed/2021_12_23_165048_run_success_on_failed.php +++ b/tests/fixtures/app/operations_failed/2021_12_23_165048_run_success_on_failed.php @@ -5,7 +5,7 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void @@ -21,7 +21,7 @@ public function down(): void public function success(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/operations_failed/2021_12_23_184029_run_failed_failure.php b/tests/fixtures/app/operations_failed/2021_12_23_184029_run_failed_failure.php index 73b7c9e1..ae6e833c 100644 --- a/tests/fixtures/app/operations_failed/2021_12_23_184029_run_failed_failure.php +++ b/tests/fixtures/app/operations_failed/2021_12_23_184029_run_failed_failure.php @@ -5,7 +5,7 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void @@ -21,7 +21,7 @@ public function down(): void public function failed(): void { $this->table()->insert([ - 'value' => Uuid::uuid4(), + 'value' => Str::random(4), ]); } diff --git a/tests/fixtures/app/stubs/2021_02_15_124237_test_success_transactions.stub b/tests/fixtures/app/stubs/2021_02_15_124237_test_success_transactions.stub index dc93b6d9..b4d273a0 100644 --- a/tests/fixtures/app/stubs/2021_02_15_124237_test_success_transactions.stub +++ b/tests/fixtures/app/stubs/2021_02_15_124237_test_success_transactions.stub @@ -2,7 +2,7 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void @@ -21,7 +21,7 @@ return new class extends Operation { protected function value(): array { - return ['value' => Uuid::uuid4()]; + return ['value' => Str::random(4)]; } public function withinTransactions(): bool diff --git a/tests/fixtures/app/stubs/2021_02_15_124852_test_failed_transactions.stub b/tests/fixtures/app/stubs/2021_02_15_124852_test_failed_transactions.stub index c7bf0a88..995bdf08 100644 --- a/tests/fixtures/app/stubs/2021_02_15_124852_test_failed_transactions.stub +++ b/tests/fixtures/app/stubs/2021_02_15_124852_test_failed_transactions.stub @@ -2,7 +2,7 @@ use DragonCode\LaravelDeployOperations\Operation; use Illuminate\Support\Facades\DB; -use Ramsey\Uuid\Uuid; +use Illuminate\Support\Str; return new class extends Operation { public function up(): void @@ -23,7 +23,7 @@ return new class extends Operation { protected function value(): array { - return ['value' => Uuid::uuid4()]; + return ['value' => Str::random(4)]; } public function withinTransactions(): bool From cfdece0c7faf5936aff451fff857cd3bf0793726 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 1 Apr 2025 21:54:28 +0300 Subject: [PATCH 2/2] Fixed code-style --- tests/Commands/MutexTest.php | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/Commands/MutexTest.php b/tests/Commands/MutexTest.php index d7ec9d05..a3d5ce7a 100644 --- a/tests/Commands/MutexTest.php +++ b/tests/Commands/MutexTest.php @@ -19,6 +19,26 @@ class MutexTest extends TestCase protected MutexService $mutex; + protected function setUp(): void + { + $this->command = new class extends Command { + public int $ran = 0; + + public function handle(): int + { + ++$this->ran; + + return self::SUCCESS; + } + }; + + $this->mutex = m::mock(MutexService::class); + + $container = Container::getInstance(); + $container->instance(MutexService::class, $this->mutex); + $this->command->setLaravel($container); + } + public function testCanRunIsolatedCommandIfNotBlocked() { $this->mutex->shouldReceive('create') @@ -71,26 +91,6 @@ public function testCanRunCommandAgainNonAutomated() $this->assertEquals(1, $this->command->ran); } - protected function setUp(): void - { - $this->command = new class extends Command { - public int $ran = 0; - - public function handle(): int - { - ++$this->ran; - - return self::SUCCESS; - } - }; - - $this->mutex = m::mock(MutexService::class); - - $container = Container::getInstance(); - $container->instance(MutexService::class, $this->mutex); - $this->command->setLaravel($container); - } - protected function runCommand($withIsolated = true) { $input = new ArrayInput(['--' . Options::Isolated => $withIsolated]);