Skip to content

Commit b268cb2

Browse files
committedOct 3, 2021
update dev dependencies
1 parent 0817b29 commit b268cb2

12 files changed

+36
-76
lines changed
 

‎.php_cs ‎.php-cs-fixer.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
$finder = PhpCsFixer\Finder::create()
66
->files()
77
->name('*.php')
8-
->in(__DIR__ . '/config')
98
->in(__DIR__ . '/src')
109
->in(__DIR__ . '/tests')
1110
;
@@ -15,7 +14,7 @@
1514

1615
unset ($config['rules']['final_class']);
1716

18-
return PhpCsFixer\Config::create()
17+
return (new PhpCsFixer\Config)
1918
->setIndent($config['indent'])
2019
->setLineEnding($config['lineEnding'])
2120
->setRules($config['rules'])

‎composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"require-dev": {
3030
"chubbyphp/chubbyphp-dev-helper": "dev-master",
3131
"chubbyphp/chubbyphp-mock": "^1.6",
32-
"infection/infection": "^0.20.2",
32+
"infection/infection": "^0.25.2",
3333
"php-coveralls/php-coveralls": "^2.4.3",
3434
"phploc/phploc": "^7.0.2",
3535
"phpstan/extension-installer": "^1.1",
36-
"phpstan/phpstan": "^0.12.64",
37-
"phpunit/phpunit": "^9.5"
36+
"phpstan/phpstan": "^0.12.99",
37+
"phpunit/phpunit": "^9.5.10"
3838
},
3939
"autoload": {
4040
"psr-4": { "App\\": "src/" }

‎phpunit.xml

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
34
backupStaticAttributes="false"
45
colors="true"
56
convertErrorsToExceptions="true"
@@ -8,7 +9,17 @@
89
executionOrder="random"
910
processIsolation="false"
1011
stopOnFailure="false"
11-
>
12+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
13+
<coverage>
14+
<include>
15+
<directory>./src</directory>
16+
</include>
17+
<exclude>
18+
<file>./src/console.php</file>
19+
<file>./src/container.php</file>
20+
<file>./src/web.php</file>
21+
</exclude>
22+
</coverage>
1223
<testsuites>
1324
<testsuite name="Integration">
1425
<directory>./tests/Integration</directory>
@@ -20,14 +31,4 @@
2031
<extensions>
2132
<extension class="App\Tests\PhpServerTestHook" />
2233
</extensions>
23-
<filter>
24-
<whitelist>
25-
<directory>./src</directory>
26-
<exclude>
27-
<file>./src/console.php</file>
28-
<file>./src/container.php</file>
29-
<file>./src/web.php</file>
30-
</exclude>
31-
</whitelist>
32-
</filter>
3334
</phpunit>

‎tests/Helper/AssertHelper.php

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
final class AssertHelper
88
{
9-
/**
10-
* @return mixed
11-
*/
129
public static function readProperty(string $property, object $object)
1310
{
1411
$reflectionProperty = new \ReflectionProperty($object, $property);

‎tests/Helper/AssertTrait.php

-34
This file was deleted.

‎tests/Integration/AbstractIntegrationTest.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ abstract class AbstractIntegrationTest extends TestCase
1212
/**
1313
* @var string
1414
*/
15-
const DEFAULT_INTEGRATION_ENDPOINT = 'http://localhost:%d';
15+
public const DEFAULT_INTEGRATION_ENDPOINT = 'http://localhost:%d';
1616

17-
const DATE_PATTERN = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}\:[0-9]{2}\:[0-9]{2}\+[0-9]{2}\:[0-9]{2}$/';
18-
const UUID_PATTERN = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/';
17+
public const DATE_PATTERN = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}\:[0-9]{2}\:[0-9]{2}\+[0-9]{2}\:[0-9]{2}$/';
18+
public const UUID_PATTERN = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/';
1919

2020
/**
2121
* @var resource
@@ -25,7 +25,7 @@ abstract class AbstractIntegrationTest extends TestCase
2525
/**
2626
* @throws \RuntimeException
2727
*/
28-
protected function httpRequest(string $method, string $resource, array $headers = [], string $body = null): array
28+
protected function httpRequest(string $method, string $resource, array $headers = [], ?string $body = null): array
2929
{
3030
$curlHeaders = [];
3131
foreach ($headers as $key => $value) {
@@ -45,6 +45,7 @@ protected function httpRequest(string $method, string $resource, array $headers
4545
if (false === $rawResponse) {
4646
$info = curl_getinfo($this->curl);
4747
$error = curl_error($this->curl);
48+
4849
throw new \RuntimeException('Invalid response from server! '.print_r($info, true).PHP_EOL.$error);
4950
}
5051

@@ -104,7 +105,7 @@ private function geHttpHeaders(array $headerRows): array
104105
continue;
105106
}
106107

107-
$key = strtolower(trim(substr($headerRow, 0, $pos)));
108+
$key = mb_strtolower(trim(substr($headerRow, 0, $pos)));
108109
$value = trim(substr($headerRow, $pos + 1));
109110

110111
if ('' === $value) {

‎tests/Integration/PingRequestHandlerTest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44

55
namespace App\Tests\Integration;
66

7-
use App\Tests\Helper\AssertTrait;
8-
97
/**
108
* @internal
119
* @coversNothing
1210
*/
1311
final class PingRequestHandlerTest extends AbstractIntegrationTest
1412
{
15-
use AssertTrait;
16-
1713
public function testPing(): void
1814
{
19-
$now = \DateTime::createFromFormat(\DateTime::ATOM, date('c'));
15+
$now = \DateTimeImmutable::createFromFormat(\DateTime::ATOM, date('c'));
2016

2117
$response = $this->httpRequest(
2218
'GET',
@@ -36,7 +32,7 @@ public function testPing(): void
3632

3733
self::assertMatchesRegularExpression(self::DATE_PATTERN, $ping['datetime']);
3834

39-
$datetime = new \DateTime($ping['datetime']);
35+
$datetime = new \DateTimeImmutable($ping['datetime']);
4036

4137
self::assertGreaterThanOrEqual($now, $datetime);
4238
}

‎tests/PhpServerTestHook.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
final class PhpServerTestHook implements BeforeTestHook
1010
{
11-
const PHP_SERVER_PORT = 49199;
12-
const ENV_INTEGRATION_ENDPOINT = 'INTEGRATION_ENDPOINT';
11+
public const PHP_SERVER_PORT = 49199;
12+
public const ENV_INTEGRATION_ENDPOINT = 'INTEGRATION_ENDPOINT';
1313

1414
private ?int $serverPid = null;
1515

@@ -68,7 +68,7 @@ private function startServer(): void
6868
$this->serverPid = (int) exec(sprintf('%s > /dev/null 2>&1 & echo $!', $command));
6969

7070
while (true) {
71-
if (is_resource(@fsockopen('localhost', self::PHP_SERVER_PORT))) {
71+
if (\is_resource(@fsockopen('localhost', self::PHP_SERVER_PORT))) {
7272
break;
7373
}
7474

‎tests/Unit/RequestHandler/RequestHandlerTest.php ‎tests/Unit/RequestHandler/PingRequestHandlerTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ final class PingRequestHandlerTest extends TestCase
2626

2727
public function testHandle(): void
2828
{
29-
/** @var ServerRequestInterface|MockObject $request */
29+
/** @var MockObject|ServerRequestInterface $request */
3030
$request = $this->getMockByCalls(ServerRequestInterface::class);
3131

32-
/** @var StreamInterface|MockObject $body */
32+
/** @var MockObject|StreamInterface $body */
3333
$body = $this->getMockByCalls(StreamInterface::class, [
3434
Call::create('write')->with(new ArgumentCallback(static function (string $body): void {
3535
$data = json_decode($body, true);
@@ -38,7 +38,7 @@ public function testHandle(): void
3838
})),
3939
]);
4040

41-
/** @var ResponseInterface|MockObject $response */
41+
/** @var MockObject|ResponseInterface $response */
4242
$response = $this->getMockByCalls(ResponseInterface::class, [
4343
Call::create('withHeader')->with('Content-Type', 'application/json')->willReturnSelf(),
4444
Call::create('withHeader')
@@ -49,7 +49,7 @@ public function testHandle(): void
4949
Call::create('getBody')->with()->willReturn($body),
5050
]);
5151

52-
/** @var ResponseFactoryInterface|MockObject $responseFactory */
52+
/** @var MockObject|ResponseFactoryInterface $responseFactory */
5353
$responseFactory = $this->getMockByCalls(ResponseFactoryInterface::class, [
5454
Call::create('createResponse')->with(200, '')->willReturn($response),
5555
]);

‎tests/Unit/ServiceFactory/Framework/ExceptionMiddlewareFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class ExceptionMiddlewareFactoryTest extends TestCase
2525

2626
public function testInvoke(): void
2727
{
28-
/** @var ResponseFactoryInterface|MockObject $responseFactory */
28+
/** @var MockObject|ResponseFactoryInterface $responseFactory */
2929
$responseFactory = $this->getMockByCalls(ResponseFactoryInterface::class);
3030

3131
/** @var LoggerInterface|MockObject $logger */

‎tests/Unit/ServiceFactory/Framework/RouteMatcherMiddlewareFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ final class RouteMatcherMiddlewareFactoryTest extends TestCase
2626

2727
public function testInvoke(): void
2828
{
29-
/** @var RouteMatcherInterface|MockObject $routeMatcher */
29+
/** @var MockObject|RouteMatcherInterface $routeMatcher */
3030
$routeMatcher = $this->getMockByCalls(RouteMatcherInterface::class);
3131

32-
/** @var ResponseFactoryInterface|MockObject $responseFactory */
32+
/** @var MockObject|ResponseFactoryInterface $responseFactory */
3333
$responseFactory = $this->getMockByCalls(ResponseFactoryInterface::class);
3434

3535
/** @var LoggerInterface|MockObject $logger */

‎tests/Unit/ServiceFactory/RequestHandler/PingRequestHandlerFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class PingRequestHandlerFactoryTest extends TestCase
2424

2525
public function testInvoke(): void
2626
{
27-
/** @var ResponseFactoryInterface|MockObject $responseFactory */
27+
/** @var MockObject|ResponseFactoryInterface $responseFactory */
2828
$responseFactory = $this->getMockByCalls(ResponseFactoryInterface::class);
2929

3030
/** @var ContainerInterface|MockObject $container */

0 commit comments

Comments
 (0)
Please sign in to comment.