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

Commit

Permalink
Merge branch 'hotfix/63' into develop
Browse files Browse the repository at this point in the history
Forward port #63
  • Loading branch information
Xerkus committed Apr 7, 2018
2 parents 7d399e5 + 7cc641c commit cf095b7
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 85 deletions.
48 changes: 12 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,14 @@ sudo: false

language: php

branches:
except:
- /^release-.*$/
- /^ghgfk-.*$/

cache:
directories:
- $HOME/.composer/cache
- $HOME/.local
- zf-mkdoc-theme

env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="satooshi/php-coveralls"
- LEGACY_DEPS="phpunit/phpunit"
- SITE_URL: https://zendframework.github.io/zend-test
- GH_USER_NAME: "Matthew Weier O'Phinney"
- GH_USER_EMAIL: matthew@weierophinney.net
- GH_REF: github.com/zendframework/zend-test.git
- secure: "Sc1ia3JTWCQoOs+kTLWSKf3EYQQLHyD5GqFX/YI8+HhBf/b7/GxGYNJ4QC+Xw+XBNbVV0NJ4KsvHdssd7B3WaUjgBSOn6rLY+8WGdbahZstmvnHEuCaYuqnkLdT66L+LHhnH4Pbo0iCPMkpltNCbnM2yw4xcZtOpmd/p/VgNUQK6+L21n/eGx+QWHmBJpkvtWR1uKwsyUf9512tcPNoy9m0gug2SEEeAHYG4J9HVySwmHNhaW7w2Hn4iA8rgKKZ4kBWXawada1KyESDoqebBOwWJr3htuTczvwY+3sv2nkZ3LjxwjReVBJGkOmAXV78AcaLhvTLah05pX9gq02Hxe9BUndrQxHfH6FStOnzcviMOu2eb+3SBXze31pJYAycjGct8LIe0N+2vhUTeNVVaNvSZubcKMRfLvm2+ytg8xQekUhhqQtG5YgTJK7AsP9XwmeocgV0XWgliBhTkiTP2Kd07qUQzBiU1vwbLeDidaQYTyzAXq45BsxFPfWbdfJrkqtlaU+peh0IaFQN1sUJP9CJb/Ekm+GSWWk+YhHhtpyLJhGvbf8dMtITFn8LzJKrO5Fx8Ben9H5+HVdzeNGLY77pzrzeezfGSsegP1y30BwgwIBEMx9gHR58pATI/IP+NtpXKtjD16btarq4mNGKGlbAVjQXsfvhez8S2QnTbFOE="

matrix:
include:
Expand All @@ -32,6 +19,7 @@ matrix:
- php: 5.6
env:
- DEPS=locked
- LEGACY_DEPS="phpunit/phpunit"
- php: 5.6
env:
- DEPS=latest
Expand All @@ -41,9 +29,7 @@ matrix:
- php: 7
env:
- DEPS=locked
- CS_CHECK=true
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
- PATH="$HOME/.local/bin:$PATH"
- LEGACY_DEPS="phpunit/phpunit"
- php: 7
env:
- DEPS=latest
Expand All @@ -52,50 +38,40 @@ matrix:
- DEPS=lowest
- php: 7.1
env:
- TEST_COVERAGE=true
- DEPS=locked
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.1
env:
- DEPS=latest
- php: hhvm
env:
- DEPS=lowest
- php: hhvm
# Disabled because PHPUnit 4.0 is not compatible with PHP 7.2
# - php: 7.2
# env:
# - DEPS=lowest
- php: 7.2
env:
- DEPS=locked
- php: hhvm
- php: 7.2
env:
- DEPS=latest
allow_failures:
- php: hhvm

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- travis_retry composer self-update

install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $TRAVIS_PHP_VERSION =~ ^5.6 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi
- if [[ $LEGACY_DEPS != '' ]]; 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
- composer show
- stty cols 120 && composer show

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi

after_success:
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

notifications:
email: false
slack:
rooms:
- secure: "QbJcG0o3KQbqwXQ9BR1IVd2+nsasZNNo6oWgOm960fYf24ErS5oUQJa7rrzZHADdAbUq/wnnJu4+hMKgeDR0hBznvM6zZfEnOWOWUzhhjaSzCqsUZWv7XxV7ndWtvpXP3k9ur44t4l4Yu7WuKiJh3SdVUxJYOP3pgY8OE1ugfbkkvOP/MAidbynS3OUUHnQfwQhpXnhirAzuPRGbEmhng8w4HXqEv0gbqlcWYtAaRDxCRmDuQfb4tucimKMXa7r41eRmBSBh8XUWzOvqp+Athwmb4Ihv0pJZJfzrvoRVOwf2tG7QnFpDW6GmYk2/FApubQOTZxDYbdnEtILaEmTA/hEDpoSNfcaIH533YXOqS8LSUE8z1VFHz6dZyIrQRjfaHIxmxCPQDpVVevvZL/Bm9yLbCou4g7eRPIQAJPbyyH+pnnj1EsOO6TgBMn6IiY33TuF8VjqmB9p9BlCaag3D56lsFSQq6XgsC47er6Jw93h6UPDJhWMAdMa41HPTx9ofIiM05Jw9NuR0SokLEIw8tbRLNvbpDWxVijI5Uzeb6QWJHgtrO9dZcWkoDOGXsW2eSoWhRKdtzdqcbdCEXxwpX535g9g571Wd4nd1mXU4Hn0d7UPOz1mUZnh4SnaCCWwwtIiTIpYArEQOLcy5g/DEOtzDhKzJvs/8bvRbQiSC21M="
on_success: change
on_failure: always
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#63](https://github.com/zendframework/zend-test/pull/63) Fixed compatibility
with PHP 7.2

## 3.1.1 - 2017-10-29

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"zendframework/zend-mvc-console": "^1.1.8",
"zendframework/zend-mvc-plugin-flashmessenger": "^0.1.0",
"zendframework/zend-serializer": "^2.6.1",
"zendframework/zend-session": "^2.6.2",
"zendframework/zend-session": "^2.8.5",
"zendframework/zend-validator": "^2.8"
},
"suggest": {
Expand Down
27 changes: 14 additions & 13 deletions composer.lock

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

19 changes: 1 addition & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,9 @@
</testsuite>
</testsuites>

<groups>
<exclude>
<group>disable</group>
</exclude>
</groups>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<php>
<ini name="date.timezone" value="UTC"/>

<!-- OB_ENABLED should be enabled for some tests to check if all
functionality works as expected. Such tests include those for
Zend\Soap and Zend\Session, which require that headers not be sent
in order to work. -->
<env name="TESTS_ZEND_OB_ENABLED" value="false" />

</php>
</phpunit>
35 changes: 19 additions & 16 deletions src/PHPUnit/Controller/AbstractControllerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/
namespace Zend\Test\PHPUnit\Controller;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use Zend\Console\Console;
use Zend\EventManager\StaticEventManager;
use Zend\Http\Request as HttpRequest;
Expand Down Expand Up @@ -248,22 +248,25 @@ public function url($url, $method = HttpRequest::METHOD_GET, $params = [])
parse_str($queryString, $query);
}

if ($method == HttpRequest::METHOD_POST) {
if (count($params) != 0) {
$post = $params;
if ($params) {
switch ($method) {
case HttpRequest::METHOD_POST:
$post = $params;
break;
case HttpRequest::METHOD_GET:
$query = array_merge($query, $params);
break;
case HttpRequest::METHOD_PUT:
case HttpRequest::METHOD_PATCH:
$content = http_build_query($params);
$request->setContent($content);
break;
default:
trigger_error(
'Additional params is only supported by GET, POST, PUT and PATCH HTTP method',
E_USER_NOTICE
);
}
} elseif ($method == HttpRequest::METHOD_GET) {
$query = array_merge($query, $params);
} elseif ($method == HttpRequest::METHOD_PUT || $method == HttpRequest::METHOD_PATCH) {
if (count($params) != 0) {
$content = http_build_query($params);
$request->setContent($content);
}
} elseif ($params) {
trigger_error(
'Additional params is only supported by GET, POST, PUT and PATCH HTTP method',
E_USER_NOTICE
);
}

$request->setMethod($method);
Expand Down
20 changes: 20 additions & 0 deletions test/PHPUnit/Controller/AbstractControllerTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,24 @@ public function testResetDoesNotCreateSessionIfNoSessionExists()

$this->assertFalse(array_key_exists('_SESSION', $GLOBALS));
}

public function method()
{
yield 'null' => [null];
yield 'get' => ['GET'];
yield 'post' => ['POST'];
yield 'put' => ['PUT'];
yield 'patch' => ['PATCH'];
}

/**
* @dataProvider method
*
* @param null|string $method
*/
public function testDispatchWithNullParams($method)
{
$this->dispatch('/custom-response', $method, null);
$this->assertResponseStatusCode(999);
}
}

0 comments on commit cf095b7

Please sign in to comment.