Skip to content

Commit

Permalink
Update: 修复测试
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Mar 18, 2024
1 parent 1c0c53d commit 31631a1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Components/database/tests/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
'Database' => 'Imi\Db',
],

'beans' => [
'ErrorLog' => [
'catchLevel' => \E_ALL,
'exceptionLevel' => \E_ALL,
'errorEventHandlers' => [
\Imi\Test\Component\ErrorEventHandler::class,
],
],
],

// 日志配置
'logger' => [
'channels' => [
Expand Down
2 changes: 2 additions & 0 deletions src/Components/redis/src/Handler/PhpRedisClusterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function flushdbEx(): bool
{
foreach ($this->getNodes() as $node)
{
// @phpstan-ignore-next-line
$this->client->flushDB($node);
}

Expand All @@ -61,6 +62,7 @@ public function flushallEx(): bool
{
foreach ($this->getNodes() as $node)
{
// @phpstan-ignore-next-line
$this->client->flushAll($node);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Components/redis/src/Handler/PredisClusterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function flushdbEx(): bool
return false;
}
}

return true;
}

Expand All @@ -83,6 +84,7 @@ public function flushallEx(): bool
return false;
}
}

return true;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/Component/ErrorEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class ErrorEventHandler extends AbstractErrorEventHandler
{
public function handleError(int $errNo, string $errStr, string $errFile, int $errLine): void
{
// 解决 idea 单文件测试引发异常情况
// 解决 idea 单文件测试引发异常
// 解决部分情况下不应该把错误转换为异常
if (str_contains($errFile, '/phpunit/src/'))
{
$this->stopPropagation();
Expand Down

0 comments on commit 31631a1

Please sign in to comment.