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

Test against psr7-integration-tests #1

Merged
merged 1 commit into from
Oct 22, 2018
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
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"phpunit/phpunit": "^7.0",
"phpstan/phpstan": "^0.10.3",
"squizlabs/php_codesniffer": "^3.3.2",
"zendframework/zend-diactoros": "^2.0"
"zendframework/zend-diactoros": "^2.0",
"php-http/psr7-integration-tests": "dev-master"
},
"provide": {
"php-http/message-factory": "^1.0"
Expand All @@ -57,7 +58,7 @@
"@phpcs",
"@phpstan"
],
"phpunit": "php vendor/bin/phpunit",
"phpunit": "php vendor/bin/phpunit --process-isolation",
"phpcs": "php vendor/bin/phpcs",
"phpstan": "php -d memory_limit=-1 vendor/bin/phpstan analyse src tests"
}
Expand Down
34 changes: 34 additions & 0 deletions tests/Psr7Integration/Nyholm/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Nyholm;

use Http\Psr7Test\ResponseIntegrationTest;
use Nyholm\Psr7\Factory\Psr17Factory;
use Slim\Http\Factory\DecoratedResponseFactory;
use Slim\Tests\Http\Providers\NyholmPsr17FactoryProvider;

class ResponseTest extends ResponseIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', Psr17Factory::class);
}
}
public function createSubject()
{
$provider = new NyholmPsr17FactoryProvider();
$decoratedResponseFactory = new DecoratedResponseFactory(
$provider->getResponseFactory(),
$provider->getStreamFactory()
);

return $decoratedResponseFactory->createResponse();
}
}
32 changes: 32 additions & 0 deletions tests/Psr7Integration/Nyholm/ServerRequestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Nyholm;

use Http\Psr7Test\ServerRequestIntegrationTest;
use Nyholm\Psr7\Factory\Psr17Factory;
use Slim\Http\Factory\DecoratedServerRequestFactory;
use Slim\Tests\Http\Providers\NyholmPsr17FactoryProvider;
use Slim\Tests\Http\Providers\Psr17FactoryProvider;

class ServerRequestTest extends ServerRequestIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', Psr17Factory::class);
}
}
public function createSubject()
{
$provider = new NyholmPsr17FactoryProvider;
$decoratedServerRequestFactory = new DecoratedServerRequestFactory($provider->getServerRequestFactory());

return $decoratedServerRequestFactory->createServerRequest('GET', 'http://foo.com', $_SERVER);
}
}
32 changes: 32 additions & 0 deletions tests/Psr7Integration/Nyholm/UriTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Nyholm;

use Http\Psr7Test\UriIntegrationTest;
use Nyholm\Psr7\Factory\Psr17Factory;
use Slim\Http\Factory\DecoratedUriFactory;
use Slim\Tests\Http\Providers\NyholmPsr17FactoryProvider;
use Slim\Tests\Http\Providers\Psr17FactoryProvider;

class UriTest extends UriIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', Psr17Factory::class);
}
}
public function createUri($uri)
{
$provider = new NyholmPsr17FactoryProvider;
$decoratedUriFactory = new DecoratedUriFactory($provider->getUriFactory());

return $decoratedUriFactory->createUri($uri);
}
}
34 changes: 34 additions & 0 deletions tests/Psr7Integration/Zend/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Zend;

use Http\Psr7Test\ResponseIntegrationTest;
use Slim\Http\Factory\DecoratedResponseFactory;
use Slim\Tests\Http\Providers\ZendDiactorosPsr17FactoryProvider;
use Zend\Diactoros\StreamFactory;

class ResponseTest extends ResponseIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', StreamFactory::class);
}
}
public function createSubject()
{
$provider = new ZendDiactorosPsr17FactoryProvider();
$decoratedResponseFactory = new DecoratedResponseFactory(
$provider->getResponseFactory(),
$provider->getStreamFactory()
);

return $decoratedResponseFactory->createResponse();
}
}
31 changes: 31 additions & 0 deletions tests/Psr7Integration/Zend/ServerRequestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Zend;

use Http\Psr7Test\ServerRequestIntegrationTest;
use Slim\Http\Factory\DecoratedServerRequestFactory;
use Slim\Tests\Http\Providers\ZendDiactorosPsr17FactoryProvider;
use Zend\Diactoros\StreamFactory;

class ServerRequestTest extends ServerRequestIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', StreamFactory::class);
}
}
public function createSubject()
{
$provider = new ZendDiactorosPsr17FactoryProvider;
$decoratedServerRequestFactory = new DecoratedServerRequestFactory($provider->getServerRequestFactory());

return $decoratedServerRequestFactory->createServerRequest('GET', 'http://foo.com', $_SERVER);
}
}
31 changes: 31 additions & 0 deletions tests/Psr7Integration/Zend/UriTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim-Http
* @copyright Copyright (c) 2011-2018 Josh Lockhart
* @license https://github.com/slimphp/Slim-Http/blob/master/LICENSE (MIT License)
*/
namespace Slim\Tests\Http\Psr7Integration\Zend;

use Http\Psr7Test\UriIntegrationTest;
use Slim\Http\Factory\DecoratedUriFactory;
use Slim\Tests\Http\Providers\ZendDiactorosPsr17FactoryProvider;
use Zend\Diactoros\StreamFactory;

class UriTest extends UriIntegrationTest
{
public static function setUpBeforeClass()
{
if (!defined('STREAM_FACTORY')) {
define('STREAM_FACTORY', StreamFactory::class);
}
}
public function createUri($uri)
{
$provider = new ZendDiactorosPsr17FactoryProvider;
$decoratedUriFactory = new DecoratedUriFactory($provider->getUriFactory());

return $decoratedUriFactory->createUri($uri);
}
}