77use Illuminated \Console \Tests \App \Console \Commands \MysqlStrategyCommand ;
88use Illuminated \Console \Tests \App \Console \Commands \NullTimeoutCommand ;
99use Illuminated \Console \Tests \App \Console \Commands \TimeoutCommand ;
10+ use PHPUnit \Framework \Attributes \PreserveGlobalState ;
11+ use PHPUnit \Framework \Attributes \RunInSeparateProcess ;
12+ use PHPUnit \Framework \Attributes \Test ;
1013
1114class WithoutOverlappingTraitTest extends TestCase
1215{
13- /** @test */
14- public function it_adds_mutex_strategy_which_is_file_by_default ()
16+ #[Test]
17+ public function it_adds_mutex_strategy_which_is_file_by_default (): void
1518 {
1619 $ this ->assertEquals ('file ' , (new GenericCommand )->getMutexStrategy ());
1720 }
1821
19- /** @test */
20- public function mutex_strategy_can_be_overloaded_by_protected_field ()
22+ #[Test]
23+ public function mutex_strategy_can_be_overloaded_by_protected_field (): void
2124 {
2225 $ this ->assertEquals ('mysql ' , (new MysqlStrategyCommand )->getMutexStrategy ());
2326 }
2427
25- /** @test */
26- public function mutex_strategy_can_be_set_by_the_public_method ()
28+ #[Test]
29+ public function mutex_strategy_can_be_set_by_the_public_method (): void
2730 {
2831 $ command = new GenericCommand ;
2932 $ command ->setMutexStrategy ('redis ' );
3033
3134 $ this ->assertEquals ('redis ' , $ command ->getMutexStrategy ());
3235 }
3336
34- /** @test */
35- public function it_adds_mutex_timeout_which_is_zero_by_default ()
37+ #[Test]
38+ public function it_adds_mutex_timeout_which_is_zero_by_default (): void
3639 {
3740 $ this ->assertEquals (0 , (new GenericCommand )->getMutexTimeout ());
3841 }
3942
40- /** @test */
41- public function mutex_timeout_can_be_overloaded_by_protected_field ()
43+ #[Test]
44+ public function mutex_timeout_can_be_overloaded_by_protected_field (): void
4245 {
4346 $ this ->assertEquals (3000 , (new TimeoutCommand )->getMutexTimeout ());
4447 }
4548
46- /** @test */
47- public function mutex_timeout_can_be_set_to_null_by_protected_field ()
49+ #[Test]
50+ public function mutex_timeout_can_be_set_to_null_by_protected_field (): void
4851 {
4952 $ this ->assertNull ((new NullTimeoutCommand )->getMutexTimeout ());
5053 }
5154
52- /** @test */
53- public function mutex_timeout_can_be_set_by_the_public_method ()
55+ #[Test]
56+ public function mutex_timeout_can_be_set_by_the_public_method (): void
5457 {
5558 $ command = new GenericCommand ;
5659 $ command ->setMutexTimeout (5000 );
5760
5861 $ this ->assertEquals (5000 , $ command ->getMutexTimeout ());
5962 }
6063
61- /** @test */
62- public function mutex_timeout_can_be_set_to_null_by_the_public_method ()
64+ #[Test]
65+ public function mutex_timeout_can_be_set_to_null_by_the_public_method (): void
6366 {
6467 $ command = new GenericCommand ;
6568 $ command ->setMutexTimeout (null );
6669
6770 $ this ->assertNull ($ command ->getMutexTimeout ());
6871 }
6972
70- /** @test */
71- public function it_generates_mutex_name_based_on_the_command_name_and_arguments ()
73+ #[Test]
74+ public function it_generates_mutex_name_based_on_the_command_name_and_arguments (): void
7275 {
7376 /** @var \Mockery\Mock|\Illuminated\Console\WithoutOverlapping $command */
7477 $ command = mock (GenericCommand::class)->makePartial ();
@@ -79,12 +82,8 @@ public function it_generates_mutex_name_based_on_the_command_name_and_arguments(
7982 $ this ->assertEquals ("icmutex-icm:generic- {$ hash }" , $ command ->getMutexName ());
8083 }
8184
82- /**
83- * @test
84- * @runInSeparateProcess
85- * @preserveGlobalState disabled
86- */
87- public function it_allows_to_run_command_if_there_is_no_other_running_instances ()
85+ #[Test] #[RunInSeparateProcess] #[PreserveGlobalState(false )]
86+ public function it_allows_to_run_command_if_there_is_no_other_running_instances (): void
8887 {
8988 $ mutex = mock ('overload:Illuminated\Console\Mutex ' );
9089 $ mutex ->expects ('acquireLock ' )->with (0 )->andReturn (true );
@@ -93,12 +92,8 @@ public function it_allows_to_run_command_if_there_is_no_other_running_instances(
9392 $ this ->artisan ('icm:generic ' );
9493 }
9594
96- /**
97- * @test
98- * @runInSeparateProcess
99- * @preserveGlobalState disabled
100- */
101- public function it_blocks_if_trying_to_run_another_instance_of_the_command ()
95+ #[Test] #[RunInSeparateProcess] #[PreserveGlobalState(false )]
96+ public function it_blocks_if_trying_to_run_another_instance_of_the_command (): void
10297 {
10398 $ this ->expectException (MutexRuntimeException::class);
10499 $ this ->expectExceptionMessage ('Command is running now! ' );
@@ -109,12 +104,8 @@ public function it_blocks_if_trying_to_run_another_instance_of_the_command()
109104 $ this ->artisan ('icm:generic ' );
110105 }
111106
112- /**
113- * @test
114- * @runInSeparateProcess
115- * @preserveGlobalState disabled
116- */
117- public function it_is_releasing_the_lock_after_command_execution ()
107+ #[Test] #[RunInSeparateProcess] #[PreserveGlobalState(false )]
108+ public function it_is_releasing_the_lock_after_command_execution (): void
118109 {
119110 /** @var \Mockery\Mock|\Illuminated\Console\Mutex $mutex */
120111 $ mutex = mock ('overload:Illuminated\Console\Mutex ' );
0 commit comments