Skip to content

Commit 82d94f6

Browse files
authored
Adapt configuration group names to Yii conventions (#72)
1 parent 879e7d1 commit 82d94f6

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Yii Error Handler Change Log
22

3-
## 2.2.0 under development
3+
## 3.0.0 under development
44

55
- Enh #65: Explicitly add transitive dependencies `ext-mbstring`, `psr/http-factory` and
66
`psr/http-server-handler` (@vjik)
77
- Chg #64: Raise PHP version to `^8.0` (@vjik, @xepozz)
8+
- Chg #72: Adapt configuration group names to Yii conventions (@vjik)
89

910
## 2.1.1 January 26, 2023
1011

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"roave/infection-static-analysis-plugin": "^1.16",
4646
"spatie/phpunit-watcher": "^1.23",
4747
"vimeo/psalm": "^4.30|^5.6",
48+
"yiisoft/di": "^1.1",
4849
"yiisoft/test-support": "^1.3"
4950
},
5051
"autoload": {
@@ -62,7 +63,7 @@
6263
"source-directory": "config"
6364
},
6465
"config-plugin": {
65-
"web": "web.php"
66+
"di-web": "di-web.php"
6667
}
6768
},
6869
"config": {
File renamed without changes.

tests/ConfigTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yiisoft\ErrorHandler\Tests;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Yiisoft\Di\Container;
9+
use Yiisoft\Di\ContainerConfig;
10+
use Yiisoft\ErrorHandler\Renderer\HtmlRenderer;
11+
use Yiisoft\ErrorHandler\ThrowableRendererInterface;
12+
13+
final class ConfigTest extends TestCase
14+
{
15+
public function testDiWeb(): void
16+
{
17+
$container = $this->createContainer('web');
18+
19+
$throwableRenderer = $container->get(ThrowableRendererInterface::class);
20+
21+
$this->assertInstanceOf(HtmlRenderer::class, $throwableRenderer);
22+
}
23+
24+
private function createContainer(?string $postfix = null): Container
25+
{
26+
return new Container(
27+
ContainerConfig::create()->withDefinitions(
28+
$this->getDiConfig($postfix)
29+
)
30+
);
31+
}
32+
33+
private function getDiConfig(?string $postfix = null): array
34+
{
35+
return require dirname(__DIR__) . '/config/di' . ($postfix !== null ? '-' . $postfix : '') . '.php';
36+
}
37+
}

0 commit comments

Comments
 (0)