Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Add integration tests #325

Merged
merged 9 commits into from Sep 5, 2018
Merged

Conversation

Nyholm
Copy link
Contributor

@Nyholm Nyholm commented Aug 12, 2018

I noticed that this library does not fully comply with psr7.

I’ve added integration test to show where it is failing.

(I’m at the airport atm, will complete this PR later)

@Nyholm
Copy link
Contributor Author

Nyholm commented Aug 12, 2018

Oh. It looks like this PR is working as expected. There are just some cs fixes needed

@Ocramius Ocramius self-assigned this Aug 12, 2018
@Ocramius Ocramius added this to the 1.8.6 milestone Aug 12, 2018
@Ocramius
Copy link
Member

Picking this up for checking while I'm on travel tomorrow 👍

@Ocramius Ocramius added the bug label Aug 12, 2018
Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted a few minor changes for consistency.

.travis.yml Outdated
@@ -9,7 +9,7 @@ cache:
env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="php-coveralls/php-coveralls"
- DEPENDENCIES=""
Copy link
Member

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.

.travis.yml Outdated
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should become if [[ $DEPENDENCIES != '' ]] to be consistent with our other checks.

Also, please rename it to INTEGRATION_DEPS so we know what kind of dependencies we're defining and using here.

<?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)
Copy link
Member

Choose a reason for hiding this comment

The 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.)

- Changes `$DEPENDENCIES` to `$INTEGRATION_DEPS` in `.travis.yml`, and
  changes conditional in `install` script to check for a non-empty value.
- Updates license docblock in new files.
@weierophinney
Copy link
Member

@Nyholm I've pushed the changes I requested, and am now working on fixes for the flagged errors.

@Nyholm
Copy link
Contributor Author

Nyholm commented Sep 5, 2018

Awesome. Thanks!

PSR-7 requires a string or array of strings; if an array is provided, it
cannot be empty.
Doing so ensures that when we merge values via `withAddedHeader()`, we
retain the original values when key collissions might normally occur.

Fixes compatibility with PSR-7.
Per the PSR-7 spec, should only allow arrays, objects, or null values.
Previously, a lazy `if ($password)` check meant that a value of `0`
would be ignored; it now checks more specifically for `if (null !==
$password)`.
`MessageTraitTest` had two tests that were for behavior not supported by
PSR-7:

- `testHeaderExistsIfWithNoValues`
- `testHeaderWithNoValues`

As the integration tests demonstrate, these were not valid scenarios. As
such, the tests are removed.
@weierophinney weierophinney merged commit 5758b2e into zendframework:master Sep 5, 2018
weierophinney added a commit that referenced this pull request Sep 5, 2018
weierophinney added a commit that referenced this pull request Sep 5, 2018
@Nyholm
Copy link
Contributor Author

Nyholm commented Sep 5, 2018

You are great. Thank you!

@Nyholm Nyholm deleted the integration-test branch September 5, 2018 20:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants