Skip to content

Commit cd017fd

Browse files
authored
Move to PHPUnit attributes (#309)
1 parent cad4c51 commit cd017fd

24 files changed

+216
-196
lines changed

tests/Commands/ImportAssetsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Http\UploadedFile;
66
use Illuminate\Support\Facades\Facade;
7+
use PHPUnit\Framework\Attributes\Test;
78
use Statamic\Contracts\Assets\Asset as AssetContract;
89
use Statamic\Contracts\Assets\AssetContainer as AssetContainerContract;
910
use Statamic\Contracts\Assets\AssetContainerRepository as AssetContainerRepositoryContract;
@@ -45,7 +46,7 @@ public function tearDown(): void
4546
parent::tearDown();
4647
}
4748

48-
/** @test */
49+
#[Test]
4950
public function it_imports_asset_containers_and_assets()
5051
{
5152
$container = tap(AssetContainer::make('test')->disk('test'))->save();
@@ -72,7 +73,7 @@ public function it_imports_asset_containers_and_assets()
7273
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
7374
}
7475

75-
/** @test */
76+
#[Test]
7677
public function it_imports_asset_containers_and_assets_with_force_argument()
7778
{
7879
$container = tap(AssetContainer::make('test')->disk('test'))->save();
@@ -97,7 +98,7 @@ public function it_imports_asset_containers_and_assets_with_force_argument()
9798
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
9899
}
99100

100-
/** @test */
101+
#[Test]
101102
public function it_imports_asset_containers_with_only_asset_containers_argument()
102103
{
103104
$container = tap(AssetContainer::make('test')->disk('test'))->save();
@@ -122,7 +123,7 @@ public function it_imports_asset_containers_with_only_asset_containers_argument(
122123
$this->assertDatabaseMissing('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
123124
}
124125

125-
/** @test */
126+
#[Test]
126127
public function it_imports_asset_containers_with_console_question()
127128
{
128129
$container = tap(AssetContainer::make('test')->disk('test'))->save();
@@ -149,7 +150,7 @@ public function it_imports_asset_containers_with_console_question()
149150
$this->assertDatabaseMissing('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
150151
}
151152

152-
/** @test */
153+
#[Test]
153154
public function it_imports_assets_with_only_assets_argument()
154155
{
155156
$container = tap(AssetContainer::make('test')->disk('test'))->save();
@@ -174,7 +175,7 @@ public function it_imports_assets_with_only_assets_argument()
174175
$this->assertDatabaseHas('assets_meta', ['container' => 'test', 'path' => 'subdirectory/other.txt']);
175176
}
176177

177-
/** @test */
178+
#[Test]
178179
public function it_imports_assets_with_console_question()
179180
{
180181
$container = tap(AssetContainer::make('test')->disk('test'))->save();

tests/Commands/ImportBlueprintsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Eloquent\Fields\BlueprintModel;
78
use Statamic\Eloquent\Fields\FieldsetModel;
89
use Statamic\Facades\Blueprint as BlueprintFacade;
@@ -44,7 +45,7 @@ public function setUp(): void
4445
File::withAbsolutePaths()->getFilesByTypeRecursively(resource_path('fieldsets'), 'yaml')->each(fn ($file) => unlink($file));
4546
}
4647

47-
/** @test */
48+
#[Test]
4849
public function it_imports_blueprints_and_fieldsets()
4950
{
5051
BlueprintFacade::make('user')->setContents([
@@ -75,7 +76,7 @@ public function it_imports_blueprints_and_fieldsets()
7576
$this->assertCount(1, FieldsetModel::all());
7677
}
7778

78-
/** @test */
79+
#[Test]
7980
public function it_imports_blueprints_with_console_question()
8081
{
8182
BlueprintFacade::make('user')->setContents([
@@ -105,7 +106,7 @@ public function it_imports_blueprints_with_console_question()
105106
$this->assertCount(0, FieldsetModel::all());
106107
}
107108

108-
/** @test */
109+
#[Test]
109110
public function it_imports_fieldsets_with_console_question()
110111
{
111112
BlueprintFacade::make('user')->setContents([
@@ -135,7 +136,7 @@ public function it_imports_fieldsets_with_console_question()
135136
$this->assertCount(1, FieldsetModel::all());
136137
}
137138

138-
/** @test */
139+
#[Test]
139140
public function it_imports_blueprints_with_only_blueprints_argument()
140141
{
141142
BlueprintFacade::make('user')->setContents([
@@ -163,7 +164,7 @@ public function it_imports_blueprints_with_only_blueprints_argument()
163164
$this->assertCount(0, FieldsetModel::all());
164165
}
165166

166-
/** @test */
167+
#[Test]
167168
public function it_imports_fieldsets_with_only_fieldsets_argument()
168169
{
169170
BlueprintFacade::make('user')->setContents([
@@ -191,7 +192,7 @@ public function it_imports_fieldsets_with_only_fieldsets_argument()
191192
$this->assertCount(1, FieldsetModel::all());
192193
}
193194

194-
/** @test */
195+
#[Test]
195196
public function it_imports_blueprints_and_fieldsets_with_force_argument()
196197
{
197198
BlueprintFacade::make('user')->setContents([

tests/Commands/ImportCollectionsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Contracts\Entries\Collection as CollectionContract;
78
use Statamic\Contracts\Entries\CollectionRepository as CollectionRepositoryContract;
89
use Statamic\Contracts\Entries\Entry as EntryContract;
@@ -37,7 +38,7 @@ public function setUp(): void
3738
app()->bind(EntryContract::class, \Statamic\Entries\Entry::class);
3839
}
3940

40-
/** @test */
41+
#[Test]
4142
public function it_imports_collections_and_collection_trees()
4243
{
4344
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -67,7 +68,7 @@ public function it_imports_collections_and_collection_trees()
6768
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
6869
}
6970

70-
/** @test */
71+
#[Test]
7172
public function it_imports_collections_and_collection_trees_with_force_argument()
7273
{
7374
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -95,7 +96,7 @@ public function it_imports_collections_and_collection_trees_with_force_argument(
9596
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
9697
}
9798

98-
/** @test */
99+
#[Test]
99100
public function it_imports_collections_with_console_question()
100101
{
101102
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -125,7 +126,7 @@ public function it_imports_collections_with_console_question()
125126
$this->assertDatabaseMissing('trees', ['handle' => 'pages', 'type' => 'collection']);
126127
}
127128

128-
/** @test */
129+
#[Test]
129130
public function it_imports_collections_with_only_collections_argument()
130131
{
131132
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -153,7 +154,7 @@ public function it_imports_collections_with_only_collections_argument()
153154
$this->assertDatabaseMissing('trees', ['handle' => 'pages', 'type' => 'collection']);
154155
}
155156

156-
/** @test */
157+
#[Test]
157158
public function it_imports_collection_trees_with_console_question()
158159
{
159160
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -183,7 +184,7 @@ public function it_imports_collection_trees_with_console_question()
183184
$this->assertDatabaseHas('trees', ['handle' => 'pages', 'type' => 'collection']);
184185
}
185186

186-
/** @test */
187+
#[Test]
187188
public function it_imports_collection_trees_with_only_collections_argument()
188189
{
189190
$collection = tap(Collection::make('pages')->title('Pages'))->save();

tests/Commands/ImportEntriesTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Contracts\Entries\Collection as CollectionContract;
78
use Statamic\Contracts\Entries\CollectionRepository as CollectionRepositoryContract;
89
use Statamic\Contracts\Entries\Entry as EntryContract;
@@ -38,7 +39,7 @@ public function setUp(): void
3839
app()->bind(EntryContract::class, \Statamic\Entries\Entry::class);
3940
}
4041

41-
/** @test */
42+
#[Test]
4243
public function it_imports_entries()
4344
{
4445
$collection = tap(Collection::make('pages')->title('Pages'))->save();
@@ -55,7 +56,7 @@ public function it_imports_entries()
5556
$this->assertDatabaseHas('entries', ['collection' => 'pages', 'slug' => 'foo', 'data' => '{"foo":"bar"}']);
5657
}
5758

58-
/** @test */
59+
#[Test]
5960
public function it_imports_localized_entries()
6061
{
6162
Site::setSites([

tests/Commands/ImportFormsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Contracts\Forms\Form as FormContract;
78
use Statamic\Contracts\Forms\FormRepository as FormRepositoryContract;
89
use Statamic\Contracts\Forms\Submission as SubmissionContract;
@@ -31,7 +32,7 @@ public function setUp(): void
3132
app()->bind(\Statamic\Eloquent\Forms\SubmissionQueryBuilder::class, \Statamic\Stache\Query\SubmissionQueryBuilder::class);
3233
}
3334

34-
/** @test */
35+
#[Test]
3536
public function it_imports_forms_and_submissions()
3637
{
3738
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
@@ -57,7 +58,7 @@ public function it_imports_forms_and_submissions()
5758
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
5859
}
5960

60-
/** @test */
61+
#[Test]
6162
public function it_imports_forms_and_submissions_with_force_argument()
6263
{
6364
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
@@ -81,7 +82,7 @@ public function it_imports_forms_and_submissions_with_force_argument()
8182
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
8283
}
8384

84-
/** @test */
85+
#[Test]
8586
public function it_imports_only_forms_with_only_forms_argument()
8687
{
8788
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
@@ -105,7 +106,7 @@ public function it_imports_only_forms_with_only_forms_argument()
105106
$this->assertDatabaseMissing('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
106107
}
107108

108-
/** @test */
109+
#[Test]
109110
public function it_imports_only_forms_with_console_question()
110111
{
111112
$form = tap(\Statamic\Facades\Form::make('contact')->title('Contact')->store(true))->save();
@@ -131,7 +132,7 @@ public function it_imports_only_forms_with_console_question()
131132
$this->assertDatabaseMissing('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
132133
}
133134

134-
/** @test */
135+
#[Test]
135136
public function it_imports_only_submissions_with_only_form_submissions_argument()
136137
{
137138
$form = tap(Form::make('contact')->title('Contact')->store(true))->save();
@@ -155,7 +156,7 @@ public function it_imports_only_submissions_with_only_form_submissions_argument(
155156
$this->assertDatabaseHas('form_submissions', ['form' => 'contact', 'data' => '{"name":"Jesse"}']);
156157
}
157158

158-
/** @test */
159+
#[Test]
159160
public function it_imports_only_form_submissions_with_console_question()
160161
{
161162
$form = tap(\Statamic\Facades\Form::make('contact')->title('Contact')->store(true))->save();

tests/Commands/ImportGlobalsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Contracts\Globals\GlobalRepository as GlobalRepositoryContract;
78
use Statamic\Contracts\Globals\GlobalSet as GlobalSetContract;
89
use Statamic\Contracts\Globals\GlobalVariablesRepository as GlobalVariablesRepositoryContract;
@@ -30,7 +31,7 @@ public function setUp(): void
3031
app()->bind(GlobalVariablesRepositoryContract::class, \Statamic\Stache\Repositories\GlobalVariablesRepository::class);
3132
}
3233

33-
/** @test */
34+
#[Test]
3435
public function it_imports_global_sets_and_variables()
3536
{
3637
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
@@ -53,7 +54,7 @@ public function it_imports_global_sets_and_variables()
5354
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
5455
}
5556

56-
/** @test */
57+
#[Test]
5758
public function it_imports_global_sets_and_variables_with_force_argument()
5859
{
5960
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
@@ -74,7 +75,7 @@ public function it_imports_global_sets_and_variables_with_force_argument()
7475
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
7576
}
7677

77-
/** @test */
78+
#[Test]
7879
public function it_imports_only_global_sets_with_console_question()
7980
{
8081
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
@@ -97,7 +98,7 @@ public function it_imports_only_global_sets_with_console_question()
9798
$this->assertDatabaseMissing('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
9899
}
99100

100-
/** @test */
101+
#[Test]
101102
public function it_imports_only_global_sets_with_only_global_sets_argument()
102103
{
103104
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
@@ -118,7 +119,7 @@ public function it_imports_only_global_sets_with_only_global_sets_argument()
118119
$this->assertDatabaseMissing('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
119120
}
120121

121-
/** @test */
122+
#[Test]
122123
public function it_imports_only_variables_with_console_question()
123124
{
124125
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();
@@ -141,7 +142,7 @@ public function it_imports_only_variables_with_console_question()
141142
$this->assertDatabaseHas('global_set_variables', ['handle' => 'footer', 'locale' => 'en', 'data' => '{"foo":"bar"}']);
142143
}
143144

144-
/** @test */
145+
#[Test]
145146
public function it_imports_only_variables_with_only_global_variables_argument()
146147
{
147148
$globalSet = tap(GlobalSet::make('footer')->title('Footer'))->save();

tests/Commands/ImportNavsTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Commands;
44

55
use Illuminate\Support\Facades\Facade;
6+
use PHPUnit\Framework\Attributes\Test;
67
use Statamic\Contracts\Structures\Nav as NavContract;
78
use Statamic\Contracts\Structures\NavigationRepository as NavigationRepositoryContract;
89
use Statamic\Contracts\Structures\NavTree as NavTreeContract;
@@ -30,7 +31,7 @@ public function setUp(): void
3031
app()->bind(NavTreeRepositoryContract::class, \Statamic\Stache\Repositories\NavTreeRepository::class);
3132
}
3233

33-
/** @test */
34+
#[Test]
3435
public function it_imports_navs_and_nav_trees()
3536
{
3637
$nav = tap(Nav::make('footer')->title('Footer'))->save();
@@ -55,7 +56,7 @@ public function it_imports_navs_and_nav_trees()
5556
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
5657
}
5758

58-
/** @test */
59+
#[Test]
5960
public function it_imports_navs_and_nav_trees_with_force_argument()
6061
{
6162
$nav = tap(Nav::make('footer')->title('Footer'))->save();
@@ -78,7 +79,7 @@ public function it_imports_navs_and_nav_trees_with_force_argument()
7879
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
7980
}
8081

81-
/** @test */
82+
#[Test]
8283
public function it_imports_navs_with_console_question()
8384
{
8485
$nav = tap(Nav::make('footer')->title('Footer'))->save();
@@ -103,7 +104,7 @@ public function it_imports_navs_with_console_question()
103104
$this->assertDatabaseMissing('trees', ['handle' => 'footer', 'type' => 'navigation']);
104105
}
105106

106-
/** @test */
107+
#[Test]
107108
public function it_imports_navs_with_only_navs_argument()
108109
{
109110
$nav = tap(Nav::make('footer')->title('Footer'))->save();
@@ -126,7 +127,7 @@ public function it_imports_navs_with_only_navs_argument()
126127
$this->assertDatabaseMissing('trees', ['handle' => 'footer', 'type' => 'navigation']);
127128
}
128129

129-
/** @test */
130+
#[Test]
130131
public function it_imports_nav_trees_with_console_question()
131132
{
132133
$nav = tap(Nav::make('footer')->title('Footer'))->save();
@@ -151,7 +152,7 @@ public function it_imports_nav_trees_with_console_question()
151152
$this->assertDatabaseHas('trees', ['handle' => 'footer', 'type' => 'navigation']);
152153
}
153154

154-
/** @test */
155+
#[Test]
155156
public function it_imports_nav_trees_with_only_nav_trees_argument()
156157
{
157158
$nav = tap(Nav::make('footer')->title('Footer'))->save();

0 commit comments

Comments
 (0)