Skip to content

Commit 290e632

Browse files
committed
feat: update kylekatarnls/multi-tester 1 => 2,
update PHPUnit 10 => 11
1 parent e591278 commit 290e632

12 files changed

+146
-140
lines changed

.github/workflows/tests.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ jobs:
3838

3939
- name: Install dependencies
4040
if: steps.composer-cache.outputs.cache-hit != 'true'
41-
run: |
42-
${{ matrix.php >= 8.1 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction;' || '' }}
43-
composer update --prefer-dist --no-progress --no-suggest --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8 && '--ignore-platform-req=php' || '' }}
41+
run: composer update --prefer-dist --no-progress --no-suggest --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8 && '--ignore-platform-req=php' || '' }}
4442

4543
- name: Run test suite
4644
run: vendor/bin/phpunit --no-coverage

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"php": "^8.2"
2828
},
2929
"require-dev": {
30-
"kylekatarnls/multi-tester": "^1.4",
31-
"phpunit/phpunit": "^10.4.2"
30+
"kylekatarnls/multi-tester": "^2.5",
31+
"phpunit/phpunit": "^11.2"
3232
},
3333
"autoload": {
3434
"psr-4": {

tests/ArrTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace Spatie\OpeningHours\Test;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use PHPUnit\Framework\TestCase;
67
use Spatie\OpeningHours\Helpers\Arr;
78

89
class ArrTest extends TestCase
910
{
10-
/** @test */
11+
#[Test]
1112
public function it_can_flat_and_map_array()
1213
{
1314
$this->assertSame([-1, 2, [3, 4], -5, 6], Arr::flatMap([1, [2, [3, 4]], 5, [6]], function ($value) {

tests/OpeningHoursCustomClassTest.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
use DateTimeImmutable;
66
use DateTimeZone;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\TestCase;
89
use Spatie\OpeningHours\Exceptions\InvalidDateTimeClass;
910
use Spatie\OpeningHours\OpeningHours;
1011

1112
class OpeningHoursCustomClassTest extends TestCase
1213
{
13-
/** @test */
14+
#[Test]
1415
public function it_can_use_immutable_date_time()
1516
{
1617
$openingHours = OpeningHours::create([
@@ -24,7 +25,7 @@ public function it_can_use_immutable_date_time()
2425
$this->assertSame('2021-10-11 09:00:00', $date->format('Y-m-d H:i:s'));
2526
}
2627

27-
/** @test */
28+
#[Test]
2829
public function it_can_use_timezones()
2930
{
3031
$openingHours = OpeningHours::create([
@@ -103,7 +104,7 @@ public function it_can_use_timezones()
103104
$this->assertSame('2022-08-01 03:00:00 America/New_York', $date->format('Y-m-d H:i:s e'));
104105
}
105106

106-
/** @test */
107+
#[Test]
107108
public function it_can_use_mocked_time()
108109
{
109110
$mock1 = new class extends DateTimeImmutable
@@ -136,7 +137,7 @@ public function __construct($datetime = 'now', DateTimeZone $timezone = null)
136137
$this->assertTrue($openingHours->isOpen());
137138
}
138139

139-
/** @test */
140+
#[Test]
140141
public function it_should_refuse_invalid_date_time_class()
141142
{
142143
$this->expectException(InvalidDateTimeClass::class);

tests/OpeningHoursFillTest.php

+13-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use DateTime;
66
use DateTimeImmutable;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\TestCase;
89
use Spatie\OpeningHours\Day;
910
use Spatie\OpeningHours\Exceptions\InvalidDate;
@@ -14,7 +15,7 @@
1415

1516
class OpeningHoursFillTest extends TestCase
1617
{
17-
/** @test */
18+
#[Test]
1819
public function it_fills_opening_hours()
1920
{
2021
$openingHours = OpeningHours::create([
@@ -49,7 +50,7 @@ public function it_fills_opening_hours()
4950
$this->assertCount(0, $openingHours->forDate(new DateTimeImmutable('2016-09-26 11:00:00')));
5051
}
5152

52-
/** @test */
53+
#[Test]
5354
public function it_can_map_week_with_a_callback()
5455
{
5556
$openingHours = OpeningHours::create([
@@ -76,7 +77,7 @@ public function it_can_map_week_with_a_callback()
7677
}));
7778
}
7879

79-
/** @test */
80+
#[Test]
8081
public function it_can_map_exceptions_with_a_callback()
8182
{
8283
$openingHours = OpeningHours::create([
@@ -99,7 +100,7 @@ public function it_can_map_exceptions_with_a_callback()
99100
}));
100101
}
101102

102-
/** @test */
103+
#[Test]
103104
public function it_can_handle_empty_input()
104105
{
105106
$openingHours = OpeningHours::create([]);
@@ -109,7 +110,7 @@ public function it_can_handle_empty_input()
109110
}
110111
}
111112

112-
/** @test */
113+
#[Test]
113114
public function it_handles_day_names_in_a_case_insensitive_manner()
114115
{
115116
$openingHours = OpeningHours::create([
@@ -125,15 +126,15 @@ public function it_handles_day_names_in_a_case_insensitive_manner()
125126
$this->assertSame((string) $openingHours->forDay('Monday')[0], '09:00-18:00');
126127
}
127128

128-
/** @test */
129+
#[Test]
129130
public function it_will_throw_an_exception_when_using_an_invalid_day_name()
130131
{
131132
$this->expectExceptionObject(InvalidDayName::invalidDayName('mmmmonday'));
132133

133134
OpeningHours::create(['mmmmonday' => ['09:00-18:00']]);
134135
}
135136

136-
/** @test */
137+
#[Test]
137138
public function it_will_throw_an_exception_when_using_an_invalid_exception_date()
138139
{
139140
$this->expectException(InvalidDate::class);
@@ -145,7 +146,7 @@ public function it_will_throw_an_exception_when_using_an_invalid_exception_date(
145146
]);
146147
}
147148

148-
/** @test */
149+
#[Test]
149150
public function it_store_meta_data()
150151
{
151152
$hours = OpeningHours::create([
@@ -223,7 +224,7 @@ public function it_store_meta_data()
223224
$this->assertSame('Extra on Tuesday evening', $hours->forDay('tuesday')[2]->data);
224225
}
225226

226-
/** @test */
227+
#[Test]
227228
public function it_handle_filters()
228229
{
229230
$typicalDay = [
@@ -276,7 +277,7 @@ function (DateTimeImmutable $date) use ($typicalDay) {
276277
$this->assertSame('Month equals day', $hours->forDate(new DateTimeImmutable('2018-12-12'))->data);
277278
}
278279

279-
/** @test */
280+
#[Test]
280281
public function it_should_merge_ranges_on_explicitly_create_from_overlapping_ranges()
281282
{
282283
$hours = OpeningHours::createAndMergeOverlappingRanges([
@@ -313,7 +314,7 @@ public function it_should_merge_ranges_on_explicitly_create_from_overlapping_ran
313314
], $dump['tuesday']);
314315
}
315316

316-
/** @test */
317+
#[Test]
317318
public function it_should_merge_ranges_including_explicit_24_00()
318319
{
319320
$hours = OpeningHours::createAndMergeOverlappingRanges([
@@ -332,7 +333,7 @@ public function it_should_merge_ranges_including_explicit_24_00()
332333
], $dump);
333334
}
334335

335-
/** @test */
336+
#[Test]
336337
public function it_should_reorder_ranges()
337338
{
338339
$hours = OpeningHours::createAndMergeOverlappingRanges([

tests/OpeningHoursForDayTest.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Spatie\OpeningHours\Test;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use PHPUnit\Framework\TestCase;
67
use Spatie\OpeningHours\Exceptions\NonMutableOffsets;
78
use Spatie\OpeningHours\Exceptions\OverlappingTimeRanges;
@@ -11,7 +12,7 @@
1112

1213
class OpeningHoursForDayTest extends TestCase
1314
{
14-
/** @test */
15+
#[Test]
1516
public function it_can_be_created_from_an_array_of_time_range_strings()
1617
{
1718
$openingHoursForDay = OpeningHoursForDay::fromStrings(['09:00-12:00', '13:00-18:00']);
@@ -25,15 +26,15 @@ public function it_can_be_created_from_an_array_of_time_range_strings()
2526
$this->assertSame('13:00-18:00', (string) $openingHoursForDay[1]);
2627
}
2728

28-
/** @test */
29+
#[Test]
2930
public function it_cant_be_created_when_time_ranges_overlap()
3031
{
3132
$this->expectException(OverlappingTimeRanges::class);
3233

3334
OpeningHoursForDay::fromStrings(['09:00-18:00', '14:00-20:00']);
3435
}
3536

36-
/** @test */
37+
#[Test]
3738
public function it_can_determine_whether_its_open_at_a_time()
3839
{
3940
$openingHoursForDay = OpeningHoursForDay::fromStrings(['09:00-18:00']);
@@ -43,15 +44,15 @@ public function it_can_determine_whether_its_open_at_a_time()
4344
$this->assertFalse($openingHoursForDay->isOpenAt(Time::fromString('18:00')));
4445
}
4546

46-
/** @test */
47+
#[Test]
4748
public function it_casts_to_string()
4849
{
4950
$openingHoursForDay = OpeningHoursForDay::fromStrings(['09:00-12:00', '13:00-18:00']);
5051

5152
$this->assertSame('09:00-12:00,13:00-18:00', (string) $openingHoursForDay);
5253
}
5354

54-
/** @test */
55+
#[Test]
5556
public function it_can_offset_is_existed()
5657
{
5758
$openingHoursForDay = OpeningHoursForDay::fromStrings(['09:00-12:00', '13:00-18:00']);
@@ -61,7 +62,7 @@ public function it_can_offset_is_existed()
6162
$this->assertFalse($openingHoursForDay->offsetExists(2));
6263
}
6364

64-
/** @test */
65+
#[Test]
6566
public function it_can_unset_offset()
6667
{
6768
$this->expectException(NonMutableOffsets::class);
@@ -71,15 +72,15 @@ public function it_can_unset_offset()
7172
$openingHoursForDay->offsetUnset(0);
7273
}
7374

74-
/** @test */
75+
#[Test]
7576
public function it_can_get_iterator()
7677
{
7778
$openingHoursForDay = OpeningHoursForDay::fromStrings(['09:00-12:00', '13:00-18:00']);
7879

7980
$this->assertCount(2, $openingHoursForDay->getIterator()->getArrayCopy());
8081
}
8182

82-
/** @test */
83+
#[Test]
8384
public function it_cant_set_iterator_item()
8485
{
8586
$this->expectException(NonMutableOffsets::class);

tests/OpeningHoursOverflowTest.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
use DateTime;
66
use DateTimeImmutable;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\TestCase;
89
use Spatie\OpeningHours\OpeningHours;
910
use Spatie\OpeningHours\TimeRange;
1011

1112
class OpeningHoursOverflowTest extends TestCase
1213
{
13-
/** @test */
14+
#[Test]
1415
public function it_fills_opening_hours_with_overflow()
1516
{
1617
$openingHours = OpeningHours::create([
@@ -22,7 +23,7 @@ public function it_fills_opening_hours_with_overflow()
2223
$this->assertSame((string) $openingHours->forDay('monday')[0], '09:00-02:00');
2324
}
2425

25-
/** @test */
26+
#[Test]
2627
public function check_open_with_overflow()
2728
{
2829
$openingHours = OpeningHours::create([
@@ -60,7 +61,7 @@ public function check_open_with_overflow()
6061
$this->assertTrue($openingHours->isOpenAt($shouldBeOpen));
6162
}
6263

63-
/** @test */
64+
#[Test]
6465
public function check_open_with_overflow_immutable()
6566
{
6667
$openingHours = OpeningHours::create([
@@ -72,7 +73,7 @@ public function check_open_with_overflow_immutable()
7273
$this->assertTrue($openingHours->isOpenAt($shouldBeOpen));
7374
}
7475

75-
/** @test */
76+
#[Test]
7677
public function next_close_with_overflow()
7778
{
7879
$openingHours = OpeningHours::create([
@@ -84,7 +85,7 @@ public function next_close_with_overflow()
8485
$this->assertSame('2019-04-23 02:00:00', $openingHours->nextClose($shouldBeOpen)->format('Y-m-d H:i:s'));
8586
}
8687

87-
/** @test */
88+
#[Test]
8889
public function next_close_with_overflow_immutable()
8990
{
9091
$openingHours = OpeningHours::create([
@@ -141,7 +142,7 @@ public function next_close_with_overflow_immutable()
141142
$this->assertSame('2019-04-22 02:00:00', $previousTimeOpen);
142143
}
143144

144-
/** @test */
145+
#[Test]
145146
public function overflow_on_simple_ranges()
146147
{
147148
//Tuesday 4th of June 2019, 11.35 am

tests/OpeningHoursStructuredDataTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
namespace Spatie\OpeningHours\Test;
44

55
use DateTimeZone;
6+
use PHPUnit\Framework\Attributes\Test;
67
use PHPUnit\Framework\TestCase;
78
use Spatie\OpeningHours\OpeningHours;
89

910
class OpeningHoursStructuredDataTest extends TestCase
1011
{
11-
/** @test */
12+
#[Test]
1213
public function it_can_render_opening_hours_as_an_array_of_structured_data()
1314
{
1415
$openingHours = OpeningHours::create([

0 commit comments

Comments
 (0)