8000 test suite compatibility with PHPUnit 6 · symfony/symfony@f5c46f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f5c46f0

Browse files
committed
test suite compatibility with PHPUnit 6
1 parent 66085f2 commit f5c46f0

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

.travis.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sudo: false
55
cache:
66
directories:
77
- $HOME/.composer/cache/files
8+
- $HOME/symfony-bridge/.phpunit
89

910
matrix:
1011
include:
@@ -13,9 +14,9 @@ matrix:
1314
- php: 5.5
1415
- php: 5.6
1516
- php: 5.3
16-
env: deps=low
17+
env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" SYMFONY_DEPRECATIONS_HELPER=weak
1718
- php: 5.6
18-
env: deps=high
19+
env: COMPOSER_OPTIONS="" SYMFONY_DEPRECATIONS_HELPER=weak
1920
- php: 7.0
2021
- php: hhvm
2122
allow_failures:
@@ -25,7 +26,9 @@ matrix:
2526
env:
2627
global:
2728
- deps=no
28-
- SYMFONY_DEPRECATIONS_HELPER=weak
29+
- SYMFONY_DEPRECATIONS_HELPER=strict
30+
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
31+
- COMPOSER_OPTIONS="--prefer-stable"
2932

3033
before_install:
3134
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
@@ -37,10 +40,8 @@ before_install:
3740

3841
install:
3942
- if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then composer require --no-update zendframework/zend-diactoros; fi;
40-
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
41-
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
42-
- if [ "$deps" = "high" ]; then composer --prefer-source update; fi;
43-
- if [ "$deps" = "low" ]; then composer --prefer-source --prefer-lowest --prefer-stable update; fi;
43+
- composer update --prefer-source $COMPOSER_OPTIONS
44+
- vendor/bin/simple-phpunit install
4445

4546
script:
46-
- phpunit
47+
- vendor/bin/simple-phpunit

Tests/Factory/DiactorosFactoryTest.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
1516
use Symfony\Component\HttpFoundation\BinaryFileResponse;
1617
use Symfony\Component\HttpFoundation\Cookie;
@@ -22,7 +23,7 @@
2223
/**
2324
* @author Kévin Dunglas <dunglas@gmail.com>
2425
*/
25-
class DiactorosFactoryTest extends \PHPUnit_Framework_TestCase
26+
class DiactorosFactoryTest extends TestCase
2627
{
2728
private $factory;
2829
private $tmpDir;
@@ -143,7 +144,11 @@ public function testCreateResponse()
143144
$this->assertEquals('Response content.', $psrResponse->getBody()->__toString());
144145
$this->assertEquals(202, $psrResponse->getStatusCode());
145146
$this->assertEquals(array('2.8'), $psrResponse->getHeader('X-Symfony'));
146-
$this->assertEquals(array('city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT; path=/; httponly'), $psrResponse->getHeader('Set-Cookie'));
147+
148+
$cookieHeader = $psrResponse->getHeader('Set-Cookie');
149+
$this->assertInternalType('array', $cookieHeader);
150+
$this->assertCount(1, $cookieHeader);
151+
$this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}', $cookieHeader[0]);
147152
}
148153

149154
public function testCreateResponseFromStreamed()

Tests/Factory/HttpFoundationFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Psr\Http\Message\UploadedFileInterface;
1516
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
1617
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response;
@@ -22,7 +23,7 @@
2223
/**
2324
* @author Kévin Dunglas <dunglas@gmail.com>
2425
*/
25-
class HttpFoundationFactoryTest extends \PHPUnit_Framework_TestCase
26+
class HttpFoundationFactoryTest extends TestCase
2627
{
2728
/** @var HttpFoundationFactory */
2829
private $factory;
@@ -198,7 +199,6 @@ public function testCreateResponse()
198199
'theme=light',
199200
'test',
200201
'ABC=AeD; Domain=dunglas.fr; Path=/kevin; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly',
201-
202202
),
203203
),
204204
new Stream('The response body'),

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/http-foundation": "~2.3|~3.0"
2222
},
2323
"require-dev": {
24-
"symfony/phpunit-bridge": "~2.7|~3.0"
24+
"symfony/phpunit-bridge": "~3.2"
2525
},
2626
"suggest": {
2727
"psr/http-message-implementation": "To use the HttpFoundation factory",

0 commit comments

Comments
 (0)
0