Skip to content

Commit fc7fd08

Browse files
committed
Fix tests and update for PHP 8.5
1 parent b919b82 commit fc7fd08

3 files changed

Lines changed: 29 additions & 21 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ jobs:
2626
- "8.1"
2727
- "8.2"
2828
- "8.3"
29+
- "8.4"
2930
os: [ubuntu-latest]
3031
experimental: [false]
3132
include:
3233
- php-version: "7.2"
3334
os: windows-latest
3435
experimental: false
35-
- php-version: "8.3"
36+
- php-version: "8.4"
3637
os: windows-latest
3738
experimental: false
38-
- php-version: "8.4"
39+
- php-version: "8.5"
3940
os: ubuntu-latest
4041
experimental: true
4142

@@ -55,7 +56,7 @@ jobs:
5556
if: ${{ !matrix.experimental }}
5657
run: vendor/bin/phpunit
5758

58-
# Show deprecations on PHP 8.4
59+
# Show deprecations on latest PHP
5960
- name: Run tests (experimental)
6061
if: ${{ matrix.experimental }}
6162
run: vendor/bin/phpunit --display-deprecations

.github/workflows/functional.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ jobs:
2020
matrix:
2121
php-version:
2222
- "7.2"
23-
- "8.3"
23+
- "8.4"
2424
os: [ubuntu-latest]
2525
experimental: [false]
2626
include:
2727
- php-version: "7.2"
2828
os: windows-latest
2929
experimental: false
30-
- php-version: "8.3"
30+
- php-version: "8.4"
3131
os: windows-latest
3232
experimental: false
33-
- php-version: "8.4"
33+
- php-version: "8.5"
3434
os: ubuntu-latest
3535
experimental: true
3636

@@ -48,9 +48,10 @@ jobs:
4848

4949
- name: Run tests
5050
if: ${{ !matrix.experimental }}
51+
# Include --fail-on-skipped when min PHP is > 7.2.5
5152
run: vendor/bin/phpunit --group functional
5253

53-
# Show deprecations on PHP 8.4
54+
# Show deprecations on latest PHP
5455
- name: Run tests (experimental)
5556
if: ${{ matrix.experimental }}
56-
run: vendor/bin/phpunit --group functional --display-deprecations
57+
run: vendor/bin/phpunit --group functional --fail-on-skipped --display-deprecations

tests/Mocks/CoreMock.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static function createAndCheck($loaded, ?self $parentProcess = null, arra
9797
static::$settings = $settings;
9898

9999
$xdebug->check();
100-
return $xdebug->childProcess !==null ? $xdebug->childProcess : $xdebug;
100+
return $xdebug->childProcess !== null ? $xdebug->childProcess : $xdebug;
101101
}
102102

103103
final public function __construct(bool $loaded, ?string $mode)
@@ -108,24 +108,16 @@ final public function __construct(bool $loaded, ?string $mode)
108108
$this->parentXdebugVersion = $loaded ? static::TEST_VERSION : null;
109109

110110
// Set private static xdebugVersion
111-
$prop = $this->refClass->getProperty('xdebugVersion');
112-
$prop->setAccessible(true);
113-
$prop->setValue($this, $this->parentXdebugVersion);
111+
$this->setProperty('xdebugVersion', $this->parentXdebugVersion);
114112

115113
// Set private static xdebugMode
116-
$prop = $this->refClass->getProperty('xdebugMode');
117-
$prop->setAccessible(true);
118-
$prop->setValue($this, $mode);
114+
$this->setProperty('xdebugMode', $mode);
119115

120116
// Set private static xdebugActive
121-
$prop = $this->refClass->getProperty('xdebugActive');
122-
$prop->setAccessible(true);
123-
$prop->setValue($this, $loaded && $mode !== 'off');
117+
$this->setProperty('xdebugActive', $loaded && $mode !== 'off');
124118

125119
// Ensure static private skipped is unset
126-
$prop = $this->refClass->getProperty('skipped');
127-
$prop->setAccessible(true);
128-
$prop->setValue($this, null);
120+
$this->setProperty('skipped', null);
129121

130122
$this->restarted = false;
131123
}
@@ -156,6 +148,20 @@ protected function restart(array $command): void
156148
static::createAndCheck(false, $this, static::$settings);
157149
}
158150

151+
/**
152+
* @param string|null|bool $value
153+
*/
154+
private function setProperty(string $name, $value): void
155+
{
156+
$prop = $this->refClass->getProperty($name);
157+
158+
if (PHP_VERSION_ID < 80100) {
159+
$prop->setAccessible(true);
160+
}
161+
162+
$prop->setValue($this, $value);
163+
}
164+
159165
private static function updateServerEnvironment(): void
160166
{
161167
$names = [

0 commit comments

Comments
 (0)