Skip to content

Commit 23f45ef

Browse files
committed
Upgrade phpunit to version ^10.5
1 parent adaa18b commit 23f45ef

6 files changed

Lines changed: 74 additions & 69 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
DB_HOST: 127.0.0.1
7575
MEMCACHED_HOST: 127.0.0.1
7676
REDIS_HOST: 127.0.0.1
77-
run: vendor/bin/phpunit --verbose
77+
run: vendor/bin/phpunit
7878

7979
- name: Upload coverage results to Coveralls
8080
env:
@@ -136,4 +136,4 @@ jobs:
136136
DB_HOST: 127.0.0.1
137137
MEMCACHED_HOST: 127.0.0.1
138138
REDIS_HOST: 127.0.0.1
139-
run: vendor/bin/phpunit --verbose
139+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build/
44
raw-tests/
55
vendor/
66
.php-cs-fixer.cache
7+
.phpunit.cache
78
.phpunit.result.cache
89
composer.lock
910
composer.phar

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"jetbrains/phpstorm-attributes": "^1.0",
4848
"phpmd/phpmd": "^2.13",
4949
"phpstan/phpstan": "^1.5",
50-
"phpunit/phpunit": "^9.5"
50+
"phpunit/phpunit": "^10.5"
5151
},
5252
"minimum-stability": "dev",
5353
"prefer-stable": true,

phpunit.xml.dist

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
3-
bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true"
4-
convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false"
5-
stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false"
6-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
7-
<coverage processUncoveredFiles="true">
8-
<include>
9-
<directory suffix=".php">src</directory>
10-
</include>
3+
bootstrap="vendor/autoload.php" colors="true" stopOnError="false" stopOnFailure="false"
4+
stopOnIncomplete="false" stopOnSkipped="false"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache">
7+
<coverage>
118
<report>
129
<clover outputFile="build/coverage/clover.xml"/>
1310
<html outputDirectory="build/coverage"/>
@@ -30,4 +27,9 @@
3027
<env name="DB_TABLE" value="Sessions"/>
3128
<env name="XDEBUG_MODE" value="coverage"/>
3229
</php>
30+
<source>
31+
<include>
32+
<directory suffix=".php">src</directory>
33+
</include>
34+
</source>
3335
</phpunit>

tests/Debug/SessionCollectorTest.php

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -161,61 +161,6 @@ public function testAutoRegenerateId() : void
161161
);
162162
}
163163

164-
/**
165-
* @return Generator<array<SaveHandler>>
166-
*/
167-
public function saveHandlerProvider() : Generator
168-
{
169-
$directory = \sys_get_temp_dir() . '/sessions';
170-
if (!\is_dir($directory)) {
171-
\mkdir($directory);
172-
}
173-
yield [
174-
new FilesHandler([
175-
'directory' => $directory,
176-
]),
177-
];
178-
yield [
179-
new MemcachedHandler([
180-
'servers' => [
181-
[
182-
'host' => \getenv('MEMCACHED_HOST'),
183-
],
184-
[
185-
// @phpstan-ignore-next-line
186-
'host' => \gethostbyname(\getenv('MEMCACHED_HOST')),
187-
],
188-
],
189-
]),
190-
];
191-
yield [
192-
new RedisHandler([
193-
'host' => \getenv('REDIS_HOST'),
194-
]),
195-
];
196-
$config = [
197-
'username' => \getenv('DB_USERNAME'),
198-
'password' => \getenv('DB_PASSWORD'),
199-
'schema' => \getenv('DB_SCHEMA'),
200-
'host' => \getenv('DB_HOST'),
201-
'port' => \getenv('DB_PORT'),
202-
'table' => \getenv('DB_TABLE'),
203-
];
204-
$database = new Database($config);
205-
$database->dropTable($config['table'])->ifExists()->run(); // @phpstan-ignore-line
206-
// @phpstan-ignore-next-line
207-
$database->createTable($config['table'])
208-
->definition(static function (TableDefinition $definition) : void {
209-
$definition->column('id')->varchar(128)->primaryKey();
210-
$definition->column('timestamp')->timestamp();
211-
$definition->column('data')->blob();
212-
$definition->index('timestamp')->key('timestamp');
213-
})->run();
214-
yield [
215-
new DatabaseHandler($config),
216-
];
217-
}
218-
219164
/**
220165
* @dataProvider saveHandlerProvider
221166
*
@@ -284,4 +229,59 @@ protected function unlock() : bool
284229
$this->collector->getContents()
285230
);
286231
}
232+
233+
/**
234+
* @return Generator<array<SaveHandler>>
235+
*/
236+
public static function saveHandlerProvider() : Generator
237+
{
238+
$directory = \sys_get_temp_dir() . '/sessions';
239+
if (!\is_dir($directory)) {
240+
\mkdir($directory);
241+
}
242+
yield [
243+
new FilesHandler([
244+
'directory' => $directory,
245+
]),
246+
];
247+
yield [
248+
new MemcachedHandler([
249+
'servers' => [
250+
[
251+
'host' => \getenv('MEMCACHED_HOST'),
252+
],
253+
[
254+
// @phpstan-ignore-next-line
255+
'host' => \gethostbyname(\getenv('MEMCACHED_HOST')),
256+
],
257+
],
258+
]),
259+
];
260+
yield [
261+
new RedisHandler([
262+
'host' => \getenv('REDIS_HOST'),
263+
]),
264+
];
265+
$config = [
266+
'username' => \getenv('DB_USERNAME'),
267+
'password' => \getenv('DB_PASSWORD'),
268+
'schema' => \getenv('DB_SCHEMA'),
269+
'host' => \getenv('DB_HOST'),
270+
'port' => \getenv('DB_PORT'),
271+
'table' => \getenv('DB_TABLE'),
272+
];
273+
$database = new Database($config);
274+
$database->dropTable($config['table'])->ifExists()->run(); // @phpstan-ignore-line
275+
// @phpstan-ignore-next-line
276+
$database->createTable($config['table'])
277+
->definition(static function (TableDefinition $definition) : void {
278+
$definition->column('id')->varchar(128)->primaryKey();
279+
$definition->column('timestamp')->timestamp();
280+
$definition->column('data')->blob();
281+
$definition->index('timestamp')->key('timestamp');
282+
})->run();
283+
yield [
284+
new DatabaseHandler($config),
285+
];
286+
}
287287
}

tests/SaveHandlers/MemcachedHandlerTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ public function testRepeatedServer() : void
9898
public function testInvalidOption() : void
9999
{
100100
$this->session->stop();
101-
$this->expectWarning();
102-
$this->expectWarningMessage('Memcached::setOptions(): invalid configuration option');
103-
(new MemcachedHandler([
101+
@(new MemcachedHandler([
104102
'servers' => [
105103
[
106104
'host' => \getenv('MEMCACHED_HOST'),
@@ -110,6 +108,10 @@ public function testInvalidOption() : void
110108
'foo' => 'bar',
111109
],
112110
], $this->logger))->open('', 'session_id');
111+
self::assertSame(
112+
'Memcached::setOptions(): invalid configuration option',
113+
\error_get_last()['message']
114+
);
113115
}
114116

115117
public function testFailToRead() : void

0 commit comments

Comments
 (0)