Skip to content

Commit b20e0ab

Browse files
committed
Update v2.x-automation-test for micro/plugin-http-exceptions-dev
1 parent 43da8bc commit b20e0ab

File tree

7 files changed

+20
-28
lines changed

7 files changed

+20
-28
lines changed

Business/Exception/Renderer/RendererFactory.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ public function create(Request $request): RendererInterface
3030
{
3131
$format = $request->get('_format');
3232

33-
switch ($format) {
34-
case 'json':
35-
return new JsonRenderer();
36-
default:
37-
return new HtmlRenderer(
38-
$this->pluginConfiguration->getProjectDir(),
39-
);
40-
}
33+
return match ($format) {
34+
'json' => new JsonRenderer(),
35+
default => new HtmlRenderer(
36+
$this->pluginConfiguration->getProjectDir(),
37+
),
38+
};
4139
}
4240
}

Business/Executor/HttpExceptionPageExecutorDecorator.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Micro\Plugin\HttpExceptionsDev\Business\Executor;
1515

16+
use Micro\Plugin\HttpCore\Business\Executor\RouteExecutorInterface;
1617
use Micro\Plugin\HttpExceptionsDev\Business\Exception\Renderer\RendererFactoryInterface;
1718
use Micro\Plugin\HttpExceptionsDev\Configuration\HttpExceptionResponseDevPluginConfigurationInterface;
1819
use Micro\Plugin\HttpCore\Exception\HttpException;
@@ -59,13 +60,10 @@ public function execute(Request $request, bool $flush = true): Response
5960
}
6061

6162
$contentType = $request->get('_format', 'text/html');
62-
switch ($contentType) {
63-
case 'json':
64-
$contentType = 'application/json';
65-
break;
66-
default:
67-
$contentType = 'text/html';
68-
}
63+
$contentType = match ($contentType) {
64+
'json' => 'application/json',
65+
default => 'text/html',
66+
};
6967

7068
$response = new Response($content, $statusCode, [
7169
'content-type' => $contentType,

Business/Executor/HttpExceptionPageExecutorDecoratorFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Micro\Plugin\HttpExceptionsDev\Business\Executor;
1515

16+
use Micro\Plugin\HttpCore\Business\Executor\RouteExecutorInterface;
1617
use Micro\Plugin\HttpExceptionsDev\Business\Exception\Renderer\RendererFactoryInterface;
1718
use Micro\Plugin\HttpExceptionsDev\Configuration\HttpExceptionResponseDevPluginConfigurationInterface;
1819
use Micro\Plugin\HttpCore\Business\Executor\RouteExecutorFactoryInterface;

Exception/FlattenException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Micro\Plugin\HttpExceptionsDev\Exception;
1515

16+
use Micro\Plugin\HttpCore\Exception\HttpInternalServerException;
1617
use Symfony\Component\HttpFoundation\Response;
1718

1819
/**

Tests/Unit/End2EndTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
use Micro\Plugin\HttpCore\Facade\HttpFacadeInterface;
1818
use Micro\Plugin\HttpExceptionsDev\HttpExceptionResponseDevPlugin;
1919
use Micro\Plugin\HttpExceptions\HttpExceptionResponsePlugin;
20-
use Micro\Plugin\Http\HttpRouterCodePlugin;
21-
use Micro\Plugin\Http\Plugin\RouteProviderPluginInterface;
20+
use Micro\Plugin\HttpRouterCode\HttpRouterCodePlugin;
21+
use Micro\Plugin\HttpRouterCode\Plugin\RouteProviderPluginInterface;
2222
use Symfony\Component\HttpFoundation\Response;
2323

2424
/**

Tests/Unit/HttpExceptionPagePluginTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class HttpExceptionPagePluginTest extends TestCase
2929
{
30-
protected function createKernel(string $env)
30+
protected function createKernel(string $env): AppKernel
3131
{
3232
$kernel = new AppKernel(
3333
new DefaultApplicationConfiguration([
@@ -143,7 +143,7 @@ public function testSuccessResponse(string $env, string $uri, bool $isFlush, mix
143143
$this->assertEquals($result, $response->getContent());
144144
}
145145

146-
public function dataProviderSuccess()
146+
public static function dataProviderSuccess(): array
147147
{
148148
return [
149149
['dev', '/', true, 'Hello, world', 'html'],
@@ -159,7 +159,7 @@ public function dataProviderSuccess()
159159
];
160160
}
161161

162-
public function dataProviderException()
162+
public static function dataProviderException(): array
163163
{
164164
return [
165165
['dev', '/404', true, null, 'html'],

composer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"require": {
1313
"micro/plugin-http-core": "^2.0"
1414
},
15-
"require-dev": {
16-
"ergebnis/composer-normalize": "^2.34"
17-
},
15+
"minimum-stability": "dev",
1816
"autoload": {
1917
"psr-4": {
2018
"Micro\\Plugin\\HttpExceptionsDev\\": "/"
@@ -24,10 +22,6 @@
2422
]
2523
},
2624
"config": {
27-
"allow-plugins": {
28-
"ergebnis/composer-normalize": true
29-
},
3025
"sort-packages": true
31-
},
32-
"minimum-stability": "dev"
26+
}
3327
}

0 commit comments

Comments
 (0)