Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
/.github/ export-ignore
.gitignore export-ignore
/.php_cs.dist export-ignore
/phpspec.ci.yml export-ignore
/phpspec.yml.dist export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/spec/ export-ignore
/tests/ export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Composer normalize
uses: docker://ergebnis/composer-normalize-action
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Expand All @@ -28,7 +28,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ jobs:
name: PHP ${{ matrix.php }} Latest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Emulate PHP 8.3
run: composer config platform.php 8.3.999
if: matrix.php == '8.4'
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -30,6 +27,9 @@ jobs:
coverage: none

- name: Install dependencies
env:
# laminas/laminas-diactoros only has releases with known advisories for PHP < 8.1
COMPOSER_NO_SECURITY_BLOCKING: 1
run: composer update --prefer-dist --no-interaction --no-progress

- name: Execute tests
Expand All @@ -41,7 +41,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -52,7 +52,7 @@ jobs:

- name: Install dependencies
run: |
rm src/MessageFactory/SlimMessageFactory.php src/StreamFactory/SlimStreamFactory.php src/UriFactory/SlimUriFactory.php spec/MessageFactory/SlimMessageFactorySpec.php spec/StreamFactory/SlimStreamFactorySpec.php spec/UriFactory/SlimUriFactorySpec.php
rm src/MessageFactory/SlimMessageFactory.php src/StreamFactory/SlimStreamFactory.php src/UriFactory/SlimUriFactory.php tests/MessageFactory/SlimMessageFactoryTest.php tests/StreamFactory/SlimStreamFactoryTest.php tests/UriFactory/SlimUriFactoryTest.php
composer remove --dev "slim/slim" --no-interaction --no-update
composer require "psr/http-message:^2.0" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --no-interaction --no-progress
Expand All @@ -64,12 +64,13 @@ jobs:
name: PHP ${{ matrix.php }} Lowest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4']

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -79,9 +80,9 @@ jobs:
coverage: none

- name: Install dependencies
run: |
composer require "sebastian/comparator:^3.0.2" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
env:
COMPOSER_NO_SECURITY_BLOCKING: 1
run: composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress

- name: Execute tests
run: composer test
Expand All @@ -92,19 +93,17 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.6
tools: composer
coverage: xdebug
coverage: pcov

- name: Install dependencies
run: |
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress
run: composer update --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: composer test-ci
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
.php-cs-fixer.cache
/build/
/composer.lock
/phpspec.yml
/.phpunit.cache/
/.phpunit.result.cache
/phpstan.neon
/phpunit.xml
/vendor/
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/spec')
->in(__DIR__.'/tests')
->name('*.php')
;

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Migrated the test suite from phpspec to PHPUnit.

## [1.16.2] - 2024-10-02

- Avoid error when reading 0 bytes from BufferedStream.
Expand Down
17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"ext-zlib": "*",
"ergebnis/composer-normalize": "^2.6",
"guzzlehttp/psr7": "^1.0 || ^2.0",
"laminas/laminas-diactoros": "^2.0 || ^3.0",
"php-http/message-factory": "^1.0.2",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"slim/slim": "^3.0",
"laminas/laminas-diactoros": "^2.0 || ^3.0"
"phpunit/phpunit": "^8.5.40 || ^9.6.22 || ^10.5.45 || ^11.5.20 || ^12.4 || ^13.0",
"slim/slim": "^3.0"
},
"suggest": {
"ext-zlib": "Used with compressor/decompressor streams",
Expand All @@ -53,11 +53,14 @@
},
"autoload-dev": {
"psr-4": {
"spec\\Http\\Message\\": "spec/"
}
"Http\\Message\\Tests\\": "tests/"
},
"files": [
"tests/functions.php"
]
},
"scripts": {
"test": "vendor/bin/phpspec run",
"test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
"test": "vendor/bin/phpunit",
"test-ci": "vendor/bin/phpunit --coverage-filter src --coverage-text --coverage-clover build/coverage.xml"
}
}
11 changes: 0 additions & 11 deletions phpspec.ci.yml

This file was deleted.

6 changes: 0 additions & 6 deletions phpspec.yml.dist

This file was deleted.

22 changes: 5 additions & 17 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ parameters:
count: 1
path: src/Builder/ResponseBuilder.php

-
message: "#^Result of \\|\\| is always true\\.$#"
count: 1
path: src/Builder/ResponseBuilder.php

-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: src/Builder/ResponseBuilder.php

-
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:createWithoutValidation\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -101,14 +91,14 @@ parameters:
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return type specified\\.$#"
count: 1
message: "#^Cannot call method .* on mixed\\.$#"
count: 4
path: src/CookieJar.php

-
message: "#^Property Http\\\\Message\\\\CookieUtil\\:\\:\\$dateFormats type has no value type specified in iterable type array\\.$#"
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return type specified\\.$#"
count: 1
path: src/CookieUtil.php
path: src/CookieJar.php

-
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\DiactorosMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
Expand Down Expand Up @@ -181,6 +171,4 @@ parameters:
path: src/UriFactory/SlimUriFactory.php

-
message: "#^Call to function array_key_exists\\(\\) with 'chunk' and array<int, string> will always evaluate to false\\.$#"
count: 1
path: src/filters.php
message: '#Trait .* is used zero times and is not analysed#'
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ includes:
- phpstan-baseline.neon

parameters:
treatPhpDocTypesAsCertain: false
level: max
paths:
- src
Expand Down
19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Kept free of version specific elements: this file must work with PHPUnit 8.5 up to the latest release. -->
<phpunit
bootstrap="vendor/autoload.php"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1"/>
</php>

<testsuites>
<testsuite name="php-http/message">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>
83 changes: 0 additions & 83 deletions spec/Authentication/AutoBasicAuthSpec.php

This file was deleted.

Loading