Skip to content

Commit ec16f53

Browse files
authored
Upgrade dependencies to support PHP 8.4 (#2)
1 parent 30aeb60 commit ec16f53

File tree

6 files changed

+84
-46
lines changed

6 files changed

+84
-46
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php_version: [8.1, 8.2, 8.3, 8.4]
11+
composer_flags: ['', '--prefer-lowest']
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php_version }}
20+
extensions: xdebug
21+
22+
- name: Install dependencies
23+
uses: php-actions/composer@v5
24+
with:
25+
php_version: ${{ matrix.php_version }}
26+
args: ${{ matrix.composer_flags }}
27+
command: update
28+
29+
- name: Run tests
30+
run: ./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml
31+
env:
32+
XDEBUG_MODE: coverage
33+
34+
- name: Run Codesniffer
35+
run: vendor/bin/phpcs --standard=PSR2 ./src
36+
37+
# - name: Submit coverage to Coveralls
38+
# # We use php-coveralls library for this, as the official Coveralls GitHub Action lacks support for clover reports:
39+
# # https://github.com/coverallsapp/github-action/issues/15
40+
# env:
41+
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
# COVERALLS_PARALLEL: true
43+
# COVERALLS_FLAG_NAME: ${{ github.job }}-PHP-${{ matrix.php_version }} ${{ matrix.composer_flags }}
44+
# run: |
45+
# composer global require php-coveralls/php-coveralls
46+
# ~/.composer/vendor/bin/php-coveralls -v

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
vendor
22
composer.lock
3+
.phpunit.cache
4+
.phpunit.result.cache

composer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"name": "rareloop/psr7-server-request-extension",
33
"require": {
4-
"psr/http-message": "^1.0"
4+
"psr/http-message": "^2",
5+
"php": ">=8.1"
56
},
67
"require-dev": {
7-
"laminas/laminas-diactoros": "^2.4",
8-
"phpunit/phpunit": "^6.0",
9-
"mockery/mockery": "^1.0.0",
10-
"brain/monkey": "^2.0.2",
11-
"satooshi/php-coveralls": "^1.0",
12-
"squizlabs/php_codesniffer": "^3.5",
13-
"codedungeon/phpunit-result-printer": "^0.4.4"
8+
"laminas/laminas-diactoros": "^3.6",
9+
"phpunit/phpunit": "^10.5",
10+
"mockery/mockery": "^1.6",
11+
"brain/monkey": "^2.6.2",
12+
"squizlabs/php_codesniffer": "^3.7.2"
1413
},
1514
"autoload": {
1615
"psr-4": {

phpunit.xml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false"
12-
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
13-
<testsuites>
14-
<testsuite name="Rareloop Lumberjack Validation">
15-
<directory>tests</directory>
16-
</testsuite>
17-
</testsuites>
18-
<filter>
19-
<whitelist>
20-
<directory suffix=".php">src/</directory>
21-
</whitelist>
22-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache" backupGlobals="false" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Rareloop Lumberjack Validation">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<source>
9+
<include>
10+
<directory suffix=".php">src/</directory>
11+
</include>
12+
</source>
2313
</phpunit>

tests/TestDiactorosServerRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Rareloop\Psr7ServerRequestExtension\InteractsWithInput;
66
use Rareloop\Psr7ServerRequestExtension\InteractsWithUri;
7-
use Zend\Diactoros\ServerRequest;
7+
use Laminas\Diactoros\ServerRequest;
88

99
class TestDiactorosServerRequest extends ServerRequest
1010
{

tests/Unit/Psr7ServerRequestExtensionTest.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,45 @@
22

33
namespace Rareloop\Psr7ServerRequestExtension\Test;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use PHPUnit\Framework\TestCase;
67
use Rareloop\Psr7ServerRequestExtension\Test\TestDiactorosServerRequest as ServerRequest;
78

89
class Psr7ServerRequestExtensionTest extends TestCase
910
{
10-
/** @test */
11+
#[Test]
1112
public function can_get_path()
1213
{
1314
$request = new ServerRequest([], [], '/test/123', 'GET');
1415

1516
$this->assertSame('/test/123', $request->path());
1617
}
1718

18-
/** @test */
19+
#[Test]
1920
public function can_get_url_without_query_string()
2021
{
2122
$request = new ServerRequest([], [], 'https://test.com/test/123?foo=bar', 'GET');
2223

2324
$this->assertSame('https://test.com/test/123', $request->url());
2425
}
2526

26-
/** @test */
27+
#[Test]
2728
public function can_get_url_with_query_string()
2829
{
2930
$request = new ServerRequest([], [], 'https://test.com/test/123?foo=bar', 'GET');
3031

3132
$this->assertSame('https://test.com/test/123?foo=bar', $request->fullUrl());
3233
}
3334

34-
/** @test */
35+
#[Test]
3536
public function no_trailing_question_mark_is_added_when_no_query_params_are_present()
3637
{
3738
$request = new ServerRequest([], [], 'https://test.com/test/123', 'GET');
3839

3940
$this->assertSame('https://test.com/test/123', $request->fullUrl());
4041
}
4142

42-
/** @test */
43+
#[Test]
4344
public function can_check_method()
4445
{
4546
$request = new ServerRequest([], [], '/test/123', 'GET');
@@ -50,7 +51,7 @@ public function can_check_method()
5051
$this->assertFalse($request->isMethod('POST'));
5152
}
5253

53-
/** @test */
54+
#[Test]
5455
public function can_get_all_input()
5556
{
5657
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
@@ -61,7 +62,7 @@ public function can_get_all_input()
6162
$this->assertSame('qux', $input['baz']);
6263
}
6364

64-
/** @test */
65+
#[Test]
6566
public function can_get_specific_input_with_key()
6667
{
6768
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
@@ -70,15 +71,15 @@ public function can_get_specific_input_with_key()
7071
$this->assertSame('qux', $request->input('baz'));
7172
}
7273

73-
/** @test */
74+
#[Test]
7475
public function can_get_default_when_key_is_not_found_in_input()
7576
{
7677
$request = new ServerRequest([], [], '/test/123', 'GET');
7778

7879
$this->assertSame('bar', $request->input('foo', 'bar'));
7980
}
8081

81-
/** @test */
82+
#[Test]
8283
public function can_check_if_input_has_a_specific_key()
8384
{
8485
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar']);
@@ -87,15 +88,15 @@ public function can_check_if_input_has_a_specific_key()
8788
$this->assertFalse($request->has('baz'));
8889
}
8990

90-
/** @test */
91+
#[Test]
9192
public function can_check_if_input_has_collection_of_keys()
9293
{
9394
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
9495

9596
$this->assertTrue($request->has(['foo', 'baz']));
9697
}
9798

98-
/** @test */
99+
#[Test]
99100
public function can_get_all_query()
100101
{
101102
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
@@ -106,23 +107,23 @@ public function can_get_all_query()
106107
$this->assertFalse(isset($input['baz']));
107108
}
108109

109-
/** @test */
110+
#[Test]
110111
public function can_get_specific_query_with_key()
111112
{
112113
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
113114

114115
$this->assertSame('bar', $request->query('foo'));
115116
}
116117

117-
/** @test */
118+
#[Test]
118119
public function can_get_default_when_key_is_not_found_in_query()
119120
{
120121
$request = new ServerRequest([], [], '/test/123', 'GET');
121122

122123
$this->assertSame('bar', $request->query('foo', 'bar'));
123124
}
124125

125-
/** @test */
126+
#[Test]
126127
public function can_get_all_post()
127128
{
128129
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
@@ -133,15 +134,15 @@ public function can_get_all_post()
133134
$this->assertFalse(isset($input['foo']));
134135
}
135136

136-
/** @test */
137+
#[Test]
137138
public function can_get_specific_post_with_key()
138139
{
139140
$request = new ServerRequest([], [], '/test/123', 'GET', 'php://input', [], [], ['foo' => 'bar'], ['baz' => 'qux']);
140141

141142
$this->assertSame('qux', $request->post('baz'));
142143
}
143144

144-
/** @test */
145+
#[Test]
145146
public function can_get_default_when_key_is_not_found_in_post()
146147
{
147148
$request = new ServerRequest([], [], '/test/123', 'GET');

0 commit comments

Comments
 (0)