Skip to content

Commit 054a77e

Browse files
committed
fix tests
1 parent 27a332b commit 054a77e

File tree

10 files changed

+32
-34
lines changed

10 files changed

+32
-34
lines changed

tests/Casts/MetaValueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected function setUp(): void
1818
{
1919
parent::setUp();
2020

21-
$this->cast = new MetaValue();
21+
$this->cast = new MetaValue;
2222

2323
$this->model = new class extends Model
2424
{

tests/Jobs/MoveFileTest.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,41 @@ public function test_move_file_job_can_be_dispatched(): void
2828

2929
public function test_move_file_job_moves_file_to_storage(): void
3030
{
31-
Storage::fake('public');
32-
3331
$file = UploadedFile::fake()->image('test.jpg');
3432
$tempPath = $file->getRealPath();
3533

3634
$medium = Medium::factory()->make([
3735
'disk' => 'public',
38-
'path' => 'media/test.jpg',
36+
'file_name' => 'test.jpg',
3937
]);
4038

4139
$job = new MoveFile($medium, $tempPath, true);
4240
$job->handle();
4341

44-
Storage::disk('public')->assertExists('media/test.jpg');
42+
Storage::disk('public')->assertExists('test.jpg');
43+
44+
Storage::disk('public')->delete('test.jpg');
4545
}
4646

4747
public function test_move_file_job_deletes_original_when_not_preserved(): void
4848
{
49-
Storage::fake('public');
50-
5149
$tempDir = Storage::disk('local')->path('root-tmp');
5250
$tempPath = $tempDir.'/test-file.jpg';
5351
File::ensureDirectoryExists($tempDir);
5452
File::put($tempPath, 'test content');
5553

5654
$medium = Medium::factory()->make([
5755
'disk' => 'public',
58-
'path' => 'media/test.jpg',
56+
'file_name' => 'test.jpg',
5957
]);
6058

6159
$job = new MoveFile($medium, $tempPath, false);
6260
$job->handle();
6361

64-
Storage::disk('public')->assertExists('media/test.jpg');
62+
Storage::disk('public')->assertExists('test.jpg');
6563
$this->assertFalse(File::exists($tempPath));
64+
65+
Storage::disk('public')->delete('test.jpg');
6666
}
6767

6868
public function test_move_file_job_preserves_original_when_preserve_is_true(): void
@@ -76,13 +76,15 @@ public function test_move_file_job_preserves_original_when_preserve_is_true(): v
7676

7777
$medium = Medium::factory()->make([
7878
'disk' => 'public',
79-
'path' => 'media/test.jpg',
79+
'file_name' => 'test.jpg',
8080
]);
8181

8282
$job = new MoveFile($medium, $tempPath, true);
8383
$job->handle();
8484

85-
Storage::disk('public')->assertExists('media/test.jpg');
85+
Storage::disk('public')->assertExists('test.jpg');
8686
$this->assertTrue(File::exists($tempPath));
87+
88+
Storage::disk('public')->delete('test.jpg');
8789
}
8890
}

tests/Listeners/FormatRootStubsTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Cone\Root\Tests\TestCase;
99
use Illuminate\Foundation\Events\VendorTagPublished;
1010
use Illuminate\Support\Facades\App;
11-
use Illuminate\Support\Facades\File;
1211

1312
final class FormatRootStubsTest extends TestCase
1413
{
@@ -19,7 +18,7 @@ public function test_listener_formats_root_stubs(): void
1918

2019
$event = new VendorTagPublished('root-stubs', [$tempFile]);
2120

22-
$listener = new FormatRootStubs();
21+
$listener = new FormatRootStubs;
2322
$listener->handle($event);
2423

2524
$contents = file_get_contents($tempFile);
@@ -37,7 +36,7 @@ public function test_listener_ignores_non_root_stubs_tag(): void
3736

3837
$event = new VendorTagPublished('other-tag', [$tempFile]);
3938

40-
$listener = new FormatRootStubs();
39+
$listener = new FormatRootStubs;
4140
$listener->handle($event);
4241

4342
$contents = file_get_contents($tempFile);
@@ -57,7 +56,7 @@ public function test_listener_handles_multiple_files(): void
5756

5857
$event = new VendorTagPublished('root-stubs', [$tempFile1, $tempFile2]);
5958

60-
$listener = new FormatRootStubs();
59+
$listener = new FormatRootStubs;
6160
$listener->handle($event);
6261

6362
$contents1 = file_get_contents($tempFile1);

tests/Notifications/RootChannelTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public function test_root_channel_sends_notification(): void
1919

2020
$user = User::factory()->create();
2121

22-
$notification = new TestRootNotification();
22+
$notification = new TestRootNotification;
2323

24-
(new RootChannel())->send($user, $notification);
24+
(new RootChannel)->send($user, $notification);
2525

2626
$this->assertDatabaseHas('root_notifications', [
2727
'notifiable_type' => User::class,
@@ -35,9 +35,9 @@ public function test_root_channel_includes_notification_type(): void
3535
{
3636
$user = User::factory()->create();
3737

38-
$notification = new TestRootNotification();
38+
$notification = new TestRootNotification;
3939

40-
(new RootChannel())->send($user, $notification);
40+
(new RootChannel)->send($user, $notification);
4141

4242
$this->assertDatabaseHas('root_notifications', [
4343
'type' => TestRootNotification::class,
@@ -49,7 +49,7 @@ class TestRootNotification extends RootNotification
4949
{
5050
public function toRoot(object $notifiable): RootMessage
5151
{
52-
return (new RootMessage())
52+
return (new RootMessage)
5353
->subject('Test Subject')
5454
->message('Test Message');
5555
}

tests/Notifications/RootMessageTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ public function test_root_message_can_be_created(): void
1818

1919
public function test_root_message_can_set_subject(): void
2020
{
21-
$message = new RootMessage();
21+
$message = new RootMessage;
2222
$message->subject('Test Subject');
2323

2424
$this->assertSame('Test Subject', $message->toArray()['subject']);
2525
}
2626

2727
public function test_root_message_can_set_message(): void
2828
{
29-
$message = new RootMessage();
29+
$message = new RootMessage;
3030
$message->message('Test Message');
3131

3232
$this->assertSame('Test Message', $message->toArray()['message']);
3333
}
3434

3535
public function test_root_message_can_set_data(): void
3636
{
37-
$message = new RootMessage();
37+
$message = new RootMessage;
3838
$message->data(['key' => 'value']);
3939

4040
$this->assertSame(['key' => 'value'], $message->toArray()['data']);
@@ -54,7 +54,7 @@ public function test_root_message_can_be_converted_to_array(): void
5454

5555
public function test_root_message_methods_are_fluent(): void
5656
{
57-
$message = new RootMessage();
57+
$message = new RootMessage;
5858

5959
$result = $message->subject('Test')
6060
->message('Message')

tests/Policies/MediumPolicyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function setUp(): void
2121
{
2222
parent::setUp();
2323

24-
$this->policy = new MediumPolicy();
24+
$this->policy = new MediumPolicy;
2525
$this->user = User::factory()->create();
2626
$this->medium = Medium::factory()->create();
2727
}

tests/Support/ClassListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function test_a_class_list_can_be_created_with_classes(): void
1818

1919
public function test_a_class_list_can_add_classes(): void
2020
{
21-
$classList = new ClassList();
21+
$classList = new ClassList;
2222

2323
$classList->add('foo');
2424
$this->assertSame(['foo'], $classList->toArray());

tests/Traits/MakeableTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ class TestMakeable
3333
public function __construct(
3434
public string $param1,
3535
public string $param2
36-
) {
37-
}
36+
) {}
3837
}
3938

4039
class TestMakeableNoParams
4140
{
4241
use Makeable;
4342

44-
public function __construct()
45-
{
46-
}
43+
public function __construct() {}
4744
}

tests/View/Components/AlertComponentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ final class AlertComponentTest extends TestCase
1111
{
1212
public function test_alert_component_can_be_instantiated(): void
1313
{
14-
$component = new AlertComponent();
14+
$component = new AlertComponent;
1515

1616
$this->assertInstanceOf(AlertComponent::class, $component);
1717
}
1818

1919
public function test_alert_component_renders(): void
2020
{
21-
$component = new AlertComponent();
21+
$component = new AlertComponent;
2222

2323
$view = $component->render();
2424

tests/View/Components/ChartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class ChartTest extends TestCase
1111
{
1212
public function test_chart_component_renders(): void
1313
{
14-
$component = new Chart();
14+
$component = new Chart;
1515

1616
$view = $component->render();
1717

0 commit comments

Comments
 (0)