Skip to content

Commit b0593fb

Browse files
Merge pull request #3 from esign/shift-140869
PHPUnit 10 Shift
2 parents 7db1d2c + 44db62d commit b0593fb

7 files changed

+92
-85
lines changed

tests/Feature/Commands/ClearTranslationsCacheCommandTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
namespace Esign\TranslationLoader\Tests\Feature\Commands;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\TranslationLoader\Commands\ClearTranslationsCacheCommand;
67
use Esign\TranslationLoader\Tests\Concerns\InteractsWithTranslator;
78
use Esign\TranslationLoader\Tests\Concerns\MakesQueryCountAssertions;
89
use Esign\TranslationLoader\Tests\TestCase;
910

10-
class ClearTranslationsCacheCommandTest extends TestCase
11+
final class ClearTranslationsCacheCommandTest extends TestCase
1112
{
1213
use InteractsWithTranslator;
1314
use MakesQueryCountAssertions;
1415

15-
/** @test */
16-
public function it_can_clear_the_translations_cache()
16+
#[Test]
17+
public function it_can_clear_the_translations_cache(): void
1718
{
1819
// Request the translation so the database translations get queried and cached.
1920
// This causes the first database query.

tests/Feature/Commands/ImportFileTranslationToDatabaseCommandTest.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
namespace Esign\TranslationLoader\Tests\Feature\Commands;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\TranslationLoader\Commands\ImportFileTranslationsToDatabaseCommand;
67
use Esign\TranslationLoader\Models\Translation;
78
use Esign\TranslationLoader\Tests\TestCase;
89

9-
class ImportFileTranslationToDatabaseCommandTest extends TestCase
10+
final class ImportFileTranslationToDatabaseCommandTest extends TestCase
1011
{
11-
/** @test */
12-
public function it_can_import_translations()
12+
#[Test]
13+
public function it_can_import_translations(): void
1314
{
1415
$this->artisan(ImportFileTranslationsToDatabaseCommand::class, ['--locales' => 'en,nl']);
1516

@@ -21,8 +22,8 @@ public function it_can_import_translations()
2122
]);
2223
}
2324

24-
/** @test */
25-
public function it_can_import_translations_for_specific_locales()
25+
#[Test]
26+
public function it_can_import_translations_for_specific_locales(): void
2627
{
2728
$this->artisan(ImportFileTranslationsToDatabaseCommand::class, ['--locales' => 'en']);
2829

@@ -34,8 +35,8 @@ public function it_can_import_translations_for_specific_locales()
3435
]);
3536
}
3637

37-
/** @test */
38-
public function it_wont_overwrite_existing_translations_when_the_overwrite_flag_was_not_given()
38+
#[Test]
39+
public function it_wont_overwrite_existing_translations_when_the_overwrite_flag_was_not_given(): void
3940
{
4041
Translation::create([
4142
'group' => '*',
@@ -54,8 +55,8 @@ public function it_wont_overwrite_existing_translations_when_the_overwrite_flag_
5455
]);
5556
}
5657

57-
/** @test */
58-
public function it_can_overwrite_existing_translations()
58+
#[Test]
59+
public function it_can_overwrite_existing_translations(): void
5960
{
6061
Translation::create([
6162
'group' => '*',
@@ -74,8 +75,8 @@ public function it_can_overwrite_existing_translations()
7475
]);
7576
}
7677

77-
/** @test */
78-
public function it_wont_overwrite_existing_translations_for_locales_that_were_not_specified()
78+
#[Test]
79+
public function it_wont_overwrite_existing_translations_for_locales_that_were_not_specified(): void
7980
{
8081
Translation::create([
8182
'group' => '*',
@@ -94,17 +95,17 @@ public function it_wont_overwrite_existing_translations_for_locales_that_were_no
9495
]);
9596
}
9697

97-
/** @test */
98-
public function it_can_report_the_affected_records()
98+
#[Test]
99+
public function it_can_report_the_affected_records(): void
99100
{
100101
$command = $this->artisan(ImportFileTranslationsToDatabaseCommand::class, ['--locales' => 'en']);
101102

102103
$command->expectsOutputToContain('Successfully imported translations, affected records: 1.');
103104
$command->assertSuccessful();
104105
}
105106

106-
/** @test */
107-
public function it_can_report_the_affected_records_when_a_translation_is_already_present()
107+
#[Test]
108+
public function it_can_report_the_affected_records_when_a_translation_is_already_present(): void
108109
{
109110
Translation::create([
110111
'group' => '*',
@@ -118,17 +119,17 @@ public function it_can_report_the_affected_records_when_a_translation_is_already
118119
$command->assertSuccessful();
119120
}
120121

121-
/** @test */
122-
public function it_can_report_affected_records_when_the_overwrite_flag_is_given()
122+
#[Test]
123+
public function it_can_report_affected_records_when_the_overwrite_flag_is_given(): void
123124
{
124125
$command = $this->artisan(ImportFileTranslationsToDatabaseCommand::class, ['--locales' => 'en', '--overwrite' => true]);
125126

126127
$command->expectsOutputToContain('Successfully imported translations, affected records: 1.');
127128
$command->assertSuccessful();
128129
}
129130

130-
/** @test */
131-
public function it_can_report_affected_records_when_the_overwrite_flag_is_given_and_a_translation_is_already_present()
131+
#[Test]
132+
public function it_can_report_affected_records_when_the_overwrite_flag_is_given_and_a_translation_is_already_present(): void
132133
{
133134
Translation::create([
134135
'group' => '*',

tests/Feature/CustomAggregateLoaderTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
namespace Esign\TranslationLoader\Tests\Feature;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\TranslationLoader\Tests\Loaders\CustomAggregateLoader;
67
use Esign\TranslationLoader\Tests\TestCase;
78
use Illuminate\Support\Facades\Config;
89

9-
class CustomAggregateLoaderTest extends TestCase
10+
final class CustomAggregateLoaderTest extends TestCase
1011
{
11-
/** @test */
12-
public function it_can_use_a_custom_aggregate_loader()
12+
#[Test]
13+
public function it_can_use_a_custom_aggregate_loader(): void
1314
{
1415
Config::set('translation-loader.aggregate_loader', CustomAggregateLoader::class);
1516

tests/Feature/CustomTranslationModelTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
namespace Esign\TranslationLoader\Tests\Feature;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\TranslationLoader\Exceptions\InvalidConfiguration;
67
use Esign\TranslationLoader\Tests\Models\CustomTranslationModel;
78
use Esign\TranslationLoader\Tests\Models\InvalidTranslationModel;
89
use Esign\TranslationLoader\Tests\TestCase;
910
use Esign\TranslationLoader\TranslationLoaderServiceProvider;
1011
use Illuminate\Support\Facades\Config;
1112

12-
class CustomTranslationModelTest extends TestCase
13+
final class CustomTranslationModelTest extends TestCase
1314
{
14-
/** @test */
15-
public function it_can_use_a_custom_model_to_load_database_translations()
15+
#[Test]
16+
public function it_can_use_a_custom_model_to_load_database_translations(): void
1617
{
1718
Config::set('translation-loader.model', CustomTranslationModel::class);
1819
CustomTranslationModel::create([
@@ -24,8 +25,8 @@ public function it_can_use_a_custom_model_to_load_database_translations()
2425
$this->assertEquals('test en', trans('database.key'));
2526
}
2627

27-
/** @test */
28-
public function it_will_throw_an_exception_when_the_model_does_not_implement_the_redirect_contract()
28+
#[Test]
29+
public function it_will_throw_an_exception_when_the_model_does_not_implement_the_redirect_contract(): void
2930
{
3031
Config::set('translation-loader.model', InvalidTranslationModel::class);
3132
$this->expectException(InvalidConfiguration::class);

tests/Feature/TranslationLoaderServiceProviderTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
namespace Esign\TranslationLoader\Tests\Feature;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\TranslationLoader\Loaders\AggregateLoader;
67
use Esign\TranslationLoader\Tests\TestCase;
78
use Esign\TranslationLoader\Translator;
89

9-
class TranslationLoaderServiceProviderTest extends TestCase
10+
final class TranslationLoaderServiceProviderTest extends TestCase
1011
{
11-
/** @test */
12-
public function it_can_override_the_translator_binding_in_the_container()
12+
#[Test]
13+
public function it_can_override_the_translator_binding_in_the_container(): void
1314
{
1415
$this->assertInstanceOf(Translator::class, $this->app->make('translator'));
1516
}
1617

17-
/** @test */
18-
public function it_can_override_the_translation_loader_biding_in_the_container()
18+
#[Test]
19+
public function it_can_override_the_translation_loader_biding_in_the_container(): void
1920
{
2021
$this->assertInstanceOf(AggregateLoader::class, $this->app->make('translation.loader'));
2122
}

0 commit comments

Comments
 (0)