Skip to content
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

PSR-7 Tests Fix #220

Merged
merged 5 commits into from
Oct 3, 2023
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
},
"require-dev": {
"adriansuter/php-autoload-override": "^1.4",
"laminas/laminas-diactoros": "^2.18.1",
"nyholm/psr7": "^1.7",
"php-http/psr7-integration-tests": "1.1.1",
"laminas/laminas-diactoros": "^3.1.0",
"nyholm/psr7": "^1.8.0",
"php-http/psr7-integration-tests": "^1.3.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"doctrine/instantiator": "^1.3.1",
Expand Down
75 changes: 29 additions & 46 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/Psr7Integration/Laminas/ServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

class ServerRequestTest extends ServerRequestIntegrationTest
{
protected $skippedTests = [
'testUriPreserveHost_NoHost_Host' => 'laminas-diactoros is not compliant.'
];

public static function setUpBeforeClass(): void
{
if (!defined('URI_FACTORY')) {
Expand Down
4 changes: 4 additions & 0 deletions tests/Psr7Integration/Nyholm/ServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

class ServerRequestTest extends ServerRequestIntegrationTest
{
protected $skippedTests = [
'testUriPreserveHost_NoHost_Host' => 'Nyholm Psr-7 is not compliant.'
];

public static function setUpBeforeClass(): void
{
if (!defined('URI_FACTORY')) {
Expand Down
11 changes: 9 additions & 2 deletions tests/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

use InvalidArgumentException;
use Slim\Http\Factory\DecoratedUriFactory;
use Slim\Tests\Http\Providers\LaminasDiactorosPsr17FactoryProvider;
use Slim\Tests\Http\Providers\Psr17FactoryProvider;
use TypeError;

use function property_exists;

Expand Down Expand Up @@ -244,14 +246,19 @@ public function testWithPortInvalidInt()

public function testWithPortInvalidString()
{
$this->expectException(InvalidArgumentException::class);

foreach ($this->factoryProviders as $factoryProvider) {
/** @var Psr17FactoryProvider $provider */
$provider = new $factoryProvider();
$decoratedUriFactory = new DecoratedUriFactory($provider->getUriFactory());

$uri = $decoratedUriFactory->createUri('https://google.com');

if ($factoryProvider === LaminasDiactorosPsr17FactoryProvider::class) {
$this->expectException(TypeError::class);
} else {
$this->expectException(InvalidArgumentException::class);
}

$uri->withPort('invalid');
}
}
Expand Down