Skip to content

Commit

Permalink
Merge pull request #220 from l0gicgate/psr7-tests-fix
Browse files Browse the repository at this point in the history
PSR-7 Tests Fix
  • Loading branch information
l0gicgate committed Oct 3, 2023
2 parents 63d3cb0 + 62d617f commit 5903f67
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 51 deletions.
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

0 comments on commit 5903f67

Please sign in to comment.