Skip to content

Add httpsoft tests #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 19 additions & 0 deletions .github/workflows/httpsoft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: HttpSoft

on:
push:
branches:
- '*.x'
pull_request:

jobs:
latest:
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
uses: ./.github/workflows/integration.yml
with:
php: ${{ matrix.php }}
suite: HttpSoft
package: httpsoft/http-message
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| Slim | [![Slim](https://github.com/php-http/psr7-integration-tests/actions/workflows/slim.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/slim.yml) |
| Nyholm | [![Nyholm](https://github.com/php-http/psr7-integration-tests/actions/workflows/nyholm.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/nyholm.yml) |
| RingCentral | [![RingCentral](https://github.com/php-http/psr7-integration-tests/actions/workflows/ringcentral.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/ringcentral.yml) |

| HttpSoft | [![HttpSoft](https://github.com/php-http/psr7-integration-tests/actions/workflows/httpsoft.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/httpsoft.yml) |

## Install

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"require-dev": {
"guzzlehttp/psr7": "^1.7 || ^2.0",
"httpsoft/http-message": "^1.1",
"laminas/laminas-diactoros": "^2.1",
"nyholm/psr7": "^1.0",
"ringcentral/psr7": "^1.2",
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<testsuite name="Nyholm">
<directory>./vendor/nyholm/psr7/tests/Integration/</directory>
</testsuite>

<testsuite name="HttpSoft">
<directory>./tests/HttpSoft/</directory>
</testsuite>
</testsuites>

<filter>
Expand Down
22 changes: 22 additions & 0 deletions tests/HttpSoft/RequestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\RequestIntegrationTest;
use HttpSoft\Message\Request;
use HttpSoft\Message\Uri;

class RequestTest extends RequestIntegrationTest
{
public function createSubject()
{
return new Request('GET', '/');
}

protected function buildUri($uri)
{
return new Uri($uri);
}
}
16 changes: 16 additions & 0 deletions tests/HttpSoft/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\ResponseIntegrationTest;
use HttpSoft\Message\Response;

class ResponseTest extends ResponseIntegrationTest
{
public function createSubject()
{
return new Response();
}
}
20 changes: 20 additions & 0 deletions tests/HttpSoft/ServerRequestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\ServerRequestIntegrationTest;
use HttpSoft\Message\ServerRequest;
use HttpSoft\Message\Uri;

class ServerRequestTest extends ServerRequestIntegrationTest
{
public function createSubject()
{
return new ServerRequest($_SERVER);
}

protected function buildUri($uri)
{
return new Uri($uri);
}
}
19 changes: 19 additions & 0 deletions tests/HttpSoft/StreamTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\StreamIntegrationTest;
use HttpSoft\Message\Stream;
use Psr\Http\Message\StreamInterface;

class StreamTest extends StreamIntegrationTest
{
public function createStream($data)
{
if ($data instanceof StreamInterface) {
return $data;
}

return new Stream($data);
}
}
18 changes: 18 additions & 0 deletions tests/HttpSoft/UploadedFileTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\UploadedFileIntegrationTest;
use HttpSoft\Message\Stream;
use HttpSoft\Message\UploadedFile;

class UploadedFileTest extends UploadedFileIntegrationTest
{
public function createSubject()
{
$stream = new Stream('php://memory', 'rw');
$stream->write('foobar');

return new UploadedFile($stream, $stream->getSize(), UPLOAD_ERR_OK);
}
}
14 changes: 14 additions & 0 deletions tests/HttpSoft/UriTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Http\Psr7Test\Tests\HttpSoft;

use Http\Psr7Test\UriIntegrationTest;
use HttpSoft\Message\Uri;

class UriTest extends UriIntegrationTest
{
public function createUri($uri)
{
return new Uri($uri);
}
}