This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
Add integration tests #325
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9ca94c5
Add integration tests
Nyholm a47aba7
cs
Nyholm 6328ae3
Incorporate feedback
weierophinney ee4bcdc
Ensure that an empty array cannot be provided as a set of headers
weierophinney 4a957e0
Ensure we only store the _values_ of arrays provided as headers
weierophinney 3db54a5
Adds validation to `withParsedBody()`
weierophinney 62124e0
Set password segment of user info if not null
weierophinney e367b20
Removes two invalid tests
weierophinney 5758b2e
Adds CHANGELOG entry for #325
weierophinney File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ cache: | |
env: | ||
global: | ||
- COMPOSER_ARGS="--no-interaction" | ||
- COVERAGE_DEPS="php-coveralls/php-coveralls" | ||
- DEPENDENCIES="" | ||
- LEGACY_DEPS="phpunit/phpunit" | ||
|
||
matrix: | ||
|
@@ -31,6 +31,7 @@ matrix: | |
- DEPS=locked | ||
- CHECK_CS=true | ||
- TEST_COVERAGE=true | ||
- DEPENDENCIES="php-coveralls/php-coveralls" | ||
- php: 7 | ||
env: | ||
- DEPS=latest | ||
|
@@ -52,6 +53,11 @@ matrix: | |
- php: 7.2 | ||
env: | ||
- DEPS=latest | ||
- php: 7.2 | ||
name: Integration tests | ||
env: | ||
- DEPENDENCIES="http-interop/http-factory-diactoros" | ||
|
||
|
||
before_install: | ||
- if [[ $TEST_COVERAGE != 'true' && "$(php --version | grep xdebug -ci)" -ge 1 ]]; then phpenv config-rm xdebug.ini || return 0 ; fi | ||
|
@@ -62,7 +68,7 @@ install: | |
- if [[ $TRAVIS_PHP_VERSION =~ ^5.6 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi | ||
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi | ||
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi | ||
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi | ||
- if ! [ -v "$DEPENDENCIES" ]; then travis_retry composer require --dev $COMPOSER_ARGS $DEPENDENCIES ; fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should become Also, please rename it to |
||
- stty cols 120 && composer show | ||
|
||
script: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this line in all new files to: * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) (Copyright extends from when the file is introduced. Also, updates to use SSL-enabled URL.) |
||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\RequestIntegrationTest; | ||
use Zend\Diactoros\Request; | ||
|
||
class RequestTest extends RequestIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createSubject() | ||
{ | ||
return new Request('/', 'GET'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\ResponseIntegrationTest; | ||
use Zend\Diactoros\Response; | ||
|
||
class ResponseTest extends ResponseIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createSubject() | ||
{ | ||
return new Response(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\ServerRequestIntegrationTest; | ||
use Zend\Diactoros\ServerRequest; | ||
|
||
class ServerRequestTest extends ServerRequestIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createSubject() | ||
{ | ||
return new ServerRequest($_SERVER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\StreamIntegrationTest; | ||
use Psr\Http\Message\StreamInterface; | ||
use Zend\Diactoros\Stream; | ||
|
||
class StreamTest extends StreamIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createStream($data) | ||
{ | ||
if ($data instanceof StreamInterface) { | ||
return $data; | ||
} | ||
|
||
return new Stream($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\UploadedFileIntegrationTest; | ||
use Zend\Diactoros\Stream; | ||
use Zend\Diactoros\UploadedFile; | ||
|
||
class UploadedFileTest extends UploadedFileIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createSubject() | ||
{ | ||
$stream = new Stream('php://memory', 'rw'); | ||
$stream->write('foobar'); | ||
|
||
return new UploadedFile($stream, $stream->getSize(), UPLOAD_ERR_OK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-diactoros for the canonical source repository | ||
* @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Diactoros\Integration; | ||
|
||
use Http\Factory\Diactoros\RequestFactory; | ||
use Http\Psr7Test\UriIntegrationTest; | ||
use Zend\Diactoros\Uri; | ||
|
||
class UriTest extends UriIntegrationTest | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
if (! class_exists(RequestFactory::class)) { | ||
self::markTestSkipped('You need to install http-interop/http-factory-diactoros to run integration tests'); | ||
} | ||
parent::setUpBeforeClass(); | ||
} | ||
|
||
public function createUri($uri) | ||
{ | ||
return new Uri($uri); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we don't need to pre-define globals; the shell will resolve it to
''
if not defined.