Skip to content

Commit 31631a1

Browse files
committed
Update: 修复测试
1 parent 1c0c53d commit 31631a1

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/Components/database/tests/config/config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
'Database' => 'Imi\Db',
1111
],
1212

13+
'beans' => [
14+
'ErrorLog' => [
15+
'catchLevel' => \E_ALL,
16+
'exceptionLevel' => \E_ALL,
17+
'errorEventHandlers' => [
18+
\Imi\Test\Component\ErrorEventHandler::class,
19+
],
20+
],
21+
],
22+
1323
// 日志配置
1424
'logger' => [
1525
'channels' => [

src/Components/redis/src/Handler/PhpRedisClusterHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function flushdbEx(): bool
5151
{
5252
foreach ($this->getNodes() as $node)
5353
{
54+
// @phpstan-ignore-next-line
5455
$this->client->flushDB($node);
5556
}
5657

@@ -61,6 +62,7 @@ public function flushallEx(): bool
6162
{
6263
foreach ($this->getNodes() as $node)
6364
{
65+
// @phpstan-ignore-next-line
6466
$this->client->flushAll($node);
6567
}
6668

src/Components/redis/src/Handler/PredisClusterHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function flushdbEx(): bool
7070
return false;
7171
}
7272
}
73+
7374
return true;
7475
}
7576

@@ -83,6 +84,7 @@ public function flushallEx(): bool
8384
return false;
8485
}
8586
}
87+
8688
return true;
8789
}
8890

tests/unit/Component/ErrorEventHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class ErrorEventHandler extends AbstractErrorEventHandler
1212
{
1313
public function handleError(int $errNo, string $errStr, string $errFile, int $errLine): void
1414
{
15-
// 解决 idea 单文件测试引发异常情况
15+
// 解决 idea 单文件测试引发异常
16+
// 解决部分情况下不应该把错误转换为异常
1617
if (str_contains($errFile, '/phpunit/src/'))
1718
{
1819
$this->stopPropagation();

0 commit comments

Comments
 (0)