summaryrefslogtreecommitdiffstats
path: root/php-symfony-psr-http-message-bridge-upstream-pull-31.patch
blob: 9d0ca3c58b8f9f4441c4d04d473b6292ca71d12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
From f5c46f0ff42ac4cd2557a48a14bdb85c6f48d65f Mon Sep 17 00:00:00 2001
From: Christian Flothmann <christian.flothmann@sensiolabs.de>
Date: Thu, 4 May 2017 21:07:18 +0200
Subject: [PATCH] test suite compatibility with PHPUnit 6

---
 .travis.yml                                 | 17 +++++++++--------
 Tests/Factory/DiactorosFactoryTest.php      |  9 +++++++--
 Tests/Factory/HttpFoundationFactoryTest.php |  4 ++--
 composer.json                               |  2 +-
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3008471..da2f48c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,7 @@ sudo: false
 cache:
     directories:
         - $HOME/.composer/cache/files
+        - $HOME/symfony-bridge/.phpunit
 
 matrix:
     include:
@@ -13,9 +14,9 @@ matrix:
         - php: 5.5
         - php: 5.6
         - php: 5.3
-          env: deps=low
+          env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" SYMFONY_DEPRECATIONS_HELPER=weak
         - php: 5.6
-          env: deps=high
+          env: COMPOSER_OPTIONS="" SYMFONY_DEPRECATIONS_HELPER=weak
         - php: 7.0
         - php: hhvm
     allow_failures:
@@ -25,7 +26,9 @@ matrix:
 env:
     global:
         - deps=no
-        - SYMFONY_DEPRECATIONS_HELPER=weak
+        - SYMFONY_DEPRECATIONS_HELPER=strict
+        - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
+        - COMPOSER_OPTIONS="--prefer-stable"
 
 before_install:
     - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
@@ -37,10 +40,8 @@ before_install:
 
 install:
     - if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then composer require --no-update zendframework/zend-diactoros; fi;
-    - if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
-    - if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
-    - if [ "$deps" = "high" ]; then composer --prefer-source update; fi;
-    - if [ "$deps" = "low" ]; then composer --prefer-source --prefer-lowest --prefer-stable update; fi;
+    - composer update --prefer-source $COMPOSER_OPTIONS
+    - vendor/bin/simple-phpunit install
 
 script:
-    - phpunit
+    - vendor/bin/simple-phpunit
diff --git a/Tests/Factory/DiactorosFactoryTest.php b/Tests/Factory/DiactorosFactoryTest.php
index ddf0806..fbc1ce8 100644
--- a/Tests/Factory/DiactorosFactoryTest.php
+++ b/Tests/Factory/DiactorosFactoryTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
 
+use PHPUnit\Framework\TestCase;
 use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
 use Symfony\Component\HttpFoundation\BinaryFileResponse;
 use Symfony\Component\HttpFoundation\Cookie;
@@ -22,7 +23,7 @@
 /**
  * @author Kévin Dunglas <dunglas@gmail.com>
  */
-class DiactorosFactoryTest extends \PHPUnit_Framework_TestCase
+class DiactorosFactoryTest extends TestCase
 {
     private $factory;
     private $tmpDir;
@@ -143,7 +144,11 @@ public function testCreateResponse()
         $this->assertEquals('Response content.', $psrResponse->getBody()->__toString());
         $this->assertEquals(202, $psrResponse->getStatusCode());
         $this->assertEquals(array('2.8'), $psrResponse->getHeader('X-Symfony'));
-        $this->assertEquals(array('city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT; path=/; httponly'), $psrResponse->getHeader('Set-Cookie'));
+
+        $cookieHeader = $psrResponse->getHeader('Set-Cookie');
+        $this->assertInternalType('array', $cookieHeader);
+        $this->assertCount(1, $cookieHeader);
+        $this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}', $cookieHeader[0]);
     }
 
     public function testCreateResponseFromStreamed()
diff --git a/Tests/Factory/HttpFoundationFactoryTest.php b/Tests/Factory/HttpFoundationFactoryTest.php
index 47ef4e3..8790a20 100644
--- a/Tests/Factory/HttpFoundationFactoryTest.php
+++ b/Tests/Factory/HttpFoundationFactoryTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
 
+use PHPUnit\Framework\TestCase;
 use Psr\Http\Message\UploadedFileInterface;
 use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
 use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response;
@@ -22,7 +23,7 @@
 /**
  * @author Kévin Dunglas <dunglas@gmail.com>
  */
-class HttpFoundationFactoryTest extends \PHPUnit_Framework_TestCase
+class HttpFoundationFactoryTest extends TestCase
 {
     /** @var HttpFoundationFactory */
     private $factory;
@@ -198,7 +199,6 @@ public function testCreateResponse()
                     'theme=light',
                     'test',
                     'ABC=AeD; Domain=dunglas.fr; Path=/kevin; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly',
-
                 ),
             ),
             new Stream('The response body'),
diff --git a/composer.json b/composer.json
index ad25080..90412ac 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
         "symfony/http-foundation": "~2.3|~3.0"
     },
     "require-dev": {
-        "symfony/phpunit-bridge": "~2.7|~3.0"
+        "symfony/phpunit-bridge": "~3.2"
     },
     "suggest": {
         "psr/http-message-implementation": "To use the HttpFoundation factory",