4
4
5
5
use DateTime ;
6
6
use DateTimeImmutable ;
7
+ use PHPUnit \Framework \Attributes \Test ;
7
8
use PHPUnit \Framework \TestCase ;
8
9
use Spatie \OpeningHours \Day ;
9
10
use Spatie \OpeningHours \Exceptions \InvalidDate ;
14
15
15
16
class OpeningHoursFillTest extends TestCase
16
17
{
17
- /** @test */
18
+ #[Test]
18
19
public function it_fills_opening_hours ()
19
20
{
20
21
$ openingHours = OpeningHours::create ([
@@ -49,7 +50,7 @@ public function it_fills_opening_hours()
49
50
$ this ->assertCount (0 , $ openingHours ->forDate (new DateTimeImmutable ('2016-09-26 11:00:00 ' )));
50
51
}
51
52
52
- /** @test */
53
+ #[Test]
53
54
public function it_can_map_week_with_a_callback ()
54
55
{
55
56
$ openingHours = OpeningHours::create ([
@@ -76,7 +77,7 @@ public function it_can_map_week_with_a_callback()
76
77
}));
77
78
}
78
79
79
- /** @test */
80
+ #[Test]
80
81
public function it_can_map_exceptions_with_a_callback ()
81
82
{
82
83
$ openingHours = OpeningHours::create ([
@@ -99,7 +100,7 @@ public function it_can_map_exceptions_with_a_callback()
99
100
}));
100
101
}
101
102
102
- /** @test */
103
+ #[Test]
103
104
public function it_can_handle_empty_input ()
104
105
{
105
106
$ openingHours = OpeningHours::create ([]);
@@ -109,7 +110,7 @@ public function it_can_handle_empty_input()
109
110
}
110
111
}
111
112
112
- /** @test */
113
+ #[Test]
113
114
public function it_handles_day_names_in_a_case_insensitive_manner ()
114
115
{
115
116
$ openingHours = OpeningHours::create ([
@@ -125,15 +126,15 @@ public function it_handles_day_names_in_a_case_insensitive_manner()
125
126
$ this ->assertSame ((string ) $ openingHours ->forDay ('Monday ' )[0 ], '09:00-18:00 ' );
126
127
}
127
128
128
- /** @test */
129
+ #[Test]
129
130
public function it_will_throw_an_exception_when_using_an_invalid_day_name ()
130
131
{
131
132
$ this ->expectExceptionObject (InvalidDayName::invalidDayName ('mmmmonday ' ));
132
133
133
134
OpeningHours::create (['mmmmonday ' => ['09:00-18:00 ' ]]);
134
135
}
135
136
136
- /** @test */
137
+ #[Test]
137
138
public function it_will_throw_an_exception_when_using_an_invalid_exception_date ()
138
139
{
139
140
$ this ->expectException (InvalidDate::class);
@@ -145,7 +146,7 @@ public function it_will_throw_an_exception_when_using_an_invalid_exception_date(
145
146
]);
146
147
}
147
148
148
- /** @test */
149
+ #[Test]
149
150
public function it_store_meta_data ()
150
151
{
151
152
$ hours = OpeningHours::create ([
@@ -223,7 +224,7 @@ public function it_store_meta_data()
223
224
$ this ->assertSame ('Extra on Tuesday evening ' , $ hours ->forDay ('tuesday ' )[2 ]->data );
224
225
}
225
226
226
- /** @test */
227
+ #[Test]
227
228
public function it_handle_filters ()
228
229
{
229
230
$ typicalDay = [
@@ -276,7 +277,7 @@ function (DateTimeImmutable $date) use ($typicalDay) {
276
277
$ this ->assertSame ('Month equals day ' , $ hours ->forDate (new DateTimeImmutable ('2018-12-12 ' ))->data );
277
278
}
278
279
279
- /** @test */
280
+ #[Test]
280
281
public function it_should_merge_ranges_on_explicitly_create_from_overlapping_ranges ()
281
282
{
282
283
$ hours = OpeningHours::createAndMergeOverlappingRanges ([
@@ -313,7 +314,7 @@ public function it_should_merge_ranges_on_explicitly_create_from_overlapping_ran
313
314
], $ dump ['tuesday ' ]);
314
315
}
315
316
316
- /** @test */
317
+ #[Test]
317
318
public function it_should_merge_ranges_including_explicit_24_00 ()
318
319
{
319
320
$ hours = OpeningHours::createAndMergeOverlappingRanges ([
@@ -332,7 +333,7 @@ public function it_should_merge_ranges_including_explicit_24_00()
332
333
], $ dump );
333
334
}
334
335
335
- /** @test */
336
+ #[Test]
336
337
public function it_should_reorder_ranges ()
337
338
{
338
339
$ hours = OpeningHours::createAndMergeOverlappingRanges ([
0 commit comments