Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1158149

Browse filesBrowse files
rbaarsmanicolas-grekas
authored andcommitted
Allow Symfony 5.0
1 parent 81ae86d commit 1158149
Copy full SHA for 1158149

7 files changed

+19
-20
lines changed

‎Tests/Factory/AbstractHttpMessageFactoryTest.php

Copy file name to clipboardExpand all lines: Tests/Factory/AbstractHttpMessageFactoryTest.php
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ abstract class AbstractHttpMessageFactoryTest extends TestCase
2929
private $factory;
3030
private $tmpDir;
3131

32-
/**
33-
* @return HttpMessageFactoryInterface
34-
*/
35-
abstract protected function buildHttpMessageFactory();
32+
abstract protected function buildHttpMessageFactory(): HttpMessageFactoryInterface;
3633

37-
public function setup()
34+
public function setUp(): void
3835
{
3936
$this->factory = $this->buildHttpMessageFactory();
4037
$this->tmpDir = sys_get_temp_dir();
@@ -158,7 +155,7 @@ public function testCreateResponse()
158155
$this->assertEquals(['3.4'], $psrResponse->getHeader('X-Symfony'));
159156

160157
$cookieHeader = $psrResponse->getHeader('Set-Cookie');
161-
$this->assertInternalType('array', $cookieHeader);
158+
$this->assertIsArray($cookieHeader);
162159
$this->assertCount(1, $cookieHeader);
163160
$this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}i', $cookieHeader[0]);
164161
}

‎Tests/Factory/DiactorosFactoryTest.php

Copy file name to clipboardExpand all lines: Tests/Factory/DiactorosFactoryTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory;
1313

1414
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
15+
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
1516

1617
/**
1718
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -21,7 +22,7 @@
2122
*/
2223
class DiactorosFactoryTest extends AbstractHttpMessageFactoryTest
2324
{
24-
protected function buildHttpMessageFactory()
25+
protected function buildHttpMessageFactory(): HttpMessageFactoryInterface
2526
{
2627
if (!class_exists('Zend\Diactoros\ServerRequestFactory')) {
2728
$this->markTestSkipped('Zend Diactoros is not installed.');

‎Tests/Factory/HttpFoundationFactoryTest.php

Copy file name to clipboardExpand all lines: Tests/Factory/HttpFoundationFactoryTest.php
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\UploadedFile;
2121
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Uri;
2222
use Symfony\Component\HttpFoundation\Cookie;
23+
use Symfony\Component\HttpFoundation\File\Exception\FileException;
24+
use Symfony\Component\HttpFoundation\File\UploadedFile as HttpFoundationUploadedFile;
2325

2426
/**
2527
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -32,7 +34,7 @@ class HttpFoundationFactoryTest extends TestCase
3234
/** @var string */
3335
private $tmpDir;
3436

35-
public function setup()
37+
public function setUp(): void
3638
{
3739
$this->factory = new HttpFoundationFactory();
3840
$this->tmpDir = sys_get_temp_dir();
@@ -80,7 +82,7 @@ public function testCreateRequest()
8082
$this->assertEquals('France', $symfonyRequest->server->get('country'));
8183
$this->assertEquals('The body', $symfonyRequest->getContent());
8284
$this->assertEquals('1.0', $symfonyRequest->headers->get('X-Dunglas-API-Platform'));
83-
$this->assertEquals(['a', 'b'], $symfonyRequest->headers->get('X-data', null, false));
85+
$this->assertEquals(['a', 'b'], $symfonyRequest->headers->all('X-data'));
8486
}
8587

8688
public function testCreateRequestWithNullParsedBody()
@@ -160,12 +162,11 @@ public function testCreateUploadedFile()
160162
$this->assertEquals('An uploaded file.', file_get_contents($this->tmpDir.'/'.$uniqid));
161163
}
162164

163-
/**
164-
* @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException
165-
* @expectedExceptionMessage The file "e" could not be written on disk.
166-
*/
167165
public function testCreateUploadedFileWithError()
168166
{
167+
$this->expectException(FileException::class);
168+
$this->expectExceptionMessage('The file "e" could not be written on disk.');
169+
169170
$uploadedFile = $this->createUploadedFile('Error.', UPLOAD_ERR_CANT_WRITE, 'e', 'text/plain');
170171
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
171172

@@ -174,15 +175,15 @@ public function testCreateUploadedFileWithError()
174175
$symfonyUploadedFile->move($this->tmpDir, 'shouldFail.txt');
175176
}
176177

177-
private function createUploadedFile($content, $error, $clientFileName, $clientMediaType)
178+
private function createUploadedFile($content, $error, $clientFileName, $clientMediaType): UploadedFile
178179
{
179180
$filePath = tempnam($this->tmpDir, uniqid());
180181
file_put_contents($filePath, $content);
181182

182183
return new UploadedFile($filePath, filesize($filePath), $error, $clientFileName, $clientMediaType);
183184
}
184185

185-
private function callCreateUploadedFile(UploadedFileInterface $uploadedFile)
186+
private function callCreateUploadedFile(UploadedFileInterface $uploadedFile): HttpFoundationUploadedFile
186187
{
187188
$reflection = new \ReflectionClass($this->factory);
188189
$createUploadedFile = $reflection->getMethod('createUploadedFile');

‎Tests/Factory/PsrHttpFactoryTest.php

Copy file name to clipboardExpand all lines: Tests/Factory/PsrHttpFactoryTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313

1414
use Nyholm\Psr7\Factory\Psr17Factory;
1515
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
16+
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
1617

1718
/**
1819
* @author Kévin Dunglas <dunglas@gmail.com>
1920
* @author Antonio J. García Lagar <aj@garcialagar.es>
2021
*/
2122
class PsrHttpFactoryTest extends AbstractHttpMessageFactoryTest
2223
{
23-
protected function buildHttpMessageFactory()
24+
protected function buildHttpMessageFactory(): HttpMessageFactoryInterface
2425
{
2526
$factory = new Psr17Factory();
2627

‎Tests/Functional/CovertTest.php

Copy file name to clipboardExpand all lines: Tests/Functional/CovertTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CovertTest extends TestCase
3636
{
3737
private $tmpDir;
3838

39-
public function setup()
39+
public function setUp(): void
4040
{
4141
if (!class_exists('Nyholm\Psr7\ServerRequest')) {
4242
$this->markTestSkipped('nyholm/psr7 is not installed.');

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"require": {
1919
"php": "^7.1",
2020
"psr/http-message": "^1.0",
21-
"symfony/http-foundation": "^3.4 || ^4.0"
21+
"symfony/http-foundation": "^4.4 || ^5.0"
2222
},
2323
"require-dev": {
24-
"symfony/phpunit-bridge": "^3.4.20 || ^4.0",
24+
"symfony/phpunit-bridge": "^4.4 || ^5.0",
2525
"nyholm/psr7": "^1.1",
2626
"zendframework/zend-diactoros": "^1.4.1 || ^2.0"
2727
},

‎phpunit.xml.dist

Copy file name to clipboardExpand all lines: phpunit.xml.dist
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
bootstrap="vendor/autoload.php"
1312
>
1413
<testsuites>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.