99use Makeable \SqlCheck \DiskSpace ;
1010use Makeable \SqlCheck \HealthySqlDump ;
1111use Makeable \SqlCheck \Tests \TestCase ;
12+ use PHPUnit \Framework \Attributes \Test ;
1213use Spatie \Backup \Events \HealthyBackupWasFound ;
1314use Spatie \Backup \Events \UnhealthyBackupWasFound ;
1415
@@ -29,51 +30,47 @@ public function setUp(): void
2930 ]);
3031 }
3132
32- /** @test */
33+ #[Test]
3334 public function it_succeeds_when_file_is_healthy ()
3435 {
3536 Event::fake (HealthyBackupWasFound::class);
3637 Event::listen (UnhealthyBackupWasFound::class, function ($ event ) {
3738 throw $ event ->backupDestinationStatus ->getHealthCheckFailure ()->exception ();
3839 });
3940
40- $ this -> artisan ('backup:monitor ' )-> assertExitCode ( 0 );
41-
41+ $ exitCode = Artisan:: call ('backup:monitor ' );
42+ $ this -> assertEquals ( 0 , $ exitCode );
4243 Event::assertDispatched (HealthyBackupWasFound::class);
4344 }
4445
45- /** @test */
46+ #[Test]
4647 public function it_fails_when_backup_is_corrupt ()
4748 {
4849 config ()->set ('backup.monitor_backups.0.name ' , 'unhealthy ' );
4950
5051 Event::fake ();
5152
5253 Artisan::call ('backup:monitor ' );
53-
54+ $ this -> assertStringContainsString ( ' are considered unhealthy! ' , Artisan:: output ());
5455 Event::assertDispatched (UnhealthyBackupWasFound::class);
55-
56- $ this ->assertStringContainsString ('unhealthy! ' , Artisan::output ());
5756 }
5857
59- /** @test */
58+ #[Test]
6059 public function it_fails_when_sql_process_exceed_the_timeout_limit ()
6160 {
6261 config ()->set ('backup.monitor_backups.0.health_checks ' , [HealthySqlDump::class => 0.01 ]);
6362
6463 Event::fake (UnhealthyBackupWasFound::class);
6564
6665 Artisan::call ('backup:monitor ' );
67-
66+ $ this -> assertStringContainsString ( ' are considered unhealthy! ' , Artisan:: output ());
6867 Event::assertDispatched (UnhealthyBackupWasFound::class);
6968
70- $ this ->assertStringContainsString ('unhealthy! ' , Artisan::output ());
71-
7269 // Manually remove database, because error exited code before deleting it
73- DB ::select ('DROP DATABASE `healthy-sql-dump--backup--mysite-2019-09-16-08-00-07` ' );
70+ DB ::statement ('DROP DATABASE `healthy-sql-dump--backup--mysite-2019-09-16-08-00-07` ' );
7471 }
7572
76- /** @test */
73+ #[Test]
7774 public function it_fails_on_insufficient_disk_space ()
7875 {
7976 app ()->bind (DiskSpace::class, function () {
0 commit comments