Skip to content

Commit 008627e

Browse files
committed
updated to minimum symfony 4.4 and php 7.1, fixed tests and removed deprecations
1 parent 81ae86d commit 008627e

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

Tests/Factory/AbstractHttpMessageFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AbstractHttpMessageFactoryTest extends TestCase
3434
*/
3535
abstract protected function buildHttpMessageFactory();
3636

37-
public function setup()
37+
public function setUp(): void
3838
{
3939
$this->factory = $this->buildHttpMessageFactory();
4040
$this->tmpDir = sys_get_temp_dir();
@@ -158,7 +158,7 @@ public function testCreateResponse()
158158
$this->assertEquals(['3.4'], $psrResponse->getHeader('X-Symfony'));
159159

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

Tests/Factory/HttpFoundationFactoryTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
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;
2324

2425
/**
2526
* @author Kévin Dunglas <[email protected]>
@@ -32,7 +33,7 @@ class HttpFoundationFactoryTest extends TestCase
3233
/** @var string */
3334
private $tmpDir;
3435

35-
public function setup()
36+
public function setUp(): void
3637
{
3738
$this->factory = new HttpFoundationFactory();
3839
$this->tmpDir = sys_get_temp_dir();
@@ -80,7 +81,7 @@ public function testCreateRequest()
8081
$this->assertEquals('France', $symfonyRequest->server->get('country'));
8182
$this->assertEquals('The body', $symfonyRequest->getContent());
8283
$this->assertEquals('1.0', $symfonyRequest->headers->get('X-Dunglas-API-Platform'));
83-
$this->assertEquals(['a', 'b'], $symfonyRequest->headers->get('X-data', null, false));
84+
$this->assertEquals(['a', 'b'], $symfonyRequest->headers->all('X-data'));
8485
}
8586

8687
public function testCreateRequestWithNullParsedBody()
@@ -160,12 +161,11 @@ public function testCreateUploadedFile()
160161
$this->assertEquals('An uploaded file.', file_get_contents($this->tmpDir.'/'.$uniqid));
161162
}
162163

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

Tests/Functional/CovertTest.php

Lines 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

Lines 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

Lines 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)