Skip to content

Commit b42e8dd

Browse files
authored
feat: add php 8.3 for github workflow test (#166)
1 parent b3deea4 commit b42e8dd

2 files changed

Lines changed: 33 additions & 10 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- '8.0'
1919
- '8.1'
2020
- '8.2'
21+
- '8.3'
2122

2223
steps:
2324
- name: Checkout

‎tests/SessionTest.php‎

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,47 @@ protected function setUp(): void
2222
$class = new ReflectionClass(Session::class);
2323
$propHasStarted = $class->getProperty('hasStarted');
2424
$propHasStarted->setAccessible(true);
25-
$propHasStarted->setValue(false);
25+
if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) {
26+
$class->setStaticPropertyValue('hasStarted', false);
27+
} else {
28+
$propHasStarted->setValue(false);
29+
}
2630

2731
$propDriver = $class->getProperty('driver');
2832
$propDriver->setAccessible(true);
29-
$propDriver->setValue(null);
33+
if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) {
34+
$class->setStaticPropertyValue('driver', null);
35+
} else {
36+
$propDriver->setValue(null);
37+
}
3038

3139
$propHasChanged = $class->getProperty('hasChanged');
3240
$propHasChanged->setAccessible(true);
33-
$propHasChanged->setValue(true);
41+
if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) {
42+
$class->setStaticPropertyValue('hasChanged', true);
43+
} else {
44+
$propHasChanged->setValue(true);
45+
}
3446

3547
$propOptions = $class->getProperty('options');
3648
$propOptions->setAccessible(true);
37-
$propOptions->setValue([
38-
'read_and_close' => true,
39-
'cookie_httponly' => '1',
40-
'use_only_cookies' => '1',
41-
'use_trans_sid' => '0',
42-
'use_strict_mode' => '1'
43-
]);
49+
if (\PHP_MAJOR_VERSION === 8 && \PHP_MINOR_VERSION >= 3) {
50+
$class->setStaticPropertyValue('options', [
51+
'read_and_close' => true,
52+
'cookie_httponly' => '1',
53+
'use_only_cookies' => '1',
54+
'use_trans_sid' => '0',
55+
'use_strict_mode' => '1'
56+
]);
57+
} else {
58+
$propOptions->setValue([
59+
'read_and_close' => true,
60+
'cookie_httponly' => '1',
61+
'use_only_cookies' => '1',
62+
'use_trans_sid' => '0',
63+
'use_strict_mode' => '1'
64+
]);
65+
}
4466

4567
$path = \ini_get('session.save_path');
4668
if (empty($path)) {

0 commit comments

Comments
 (0)