Skip to content

Commit

Permalink
handle possible silent failures
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed May 8, 2022
1 parent 98f30a8 commit 15f7635
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ parameters:
- tests
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
4 changes: 2 additions & 2 deletions src/ChannelFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ public function assertCurrentContext(Closure|array $context, ?string $message =
if ($context instanceof Closure) {
PHPUnit::assertTrue(
(bool) $context($this->currentContext()), /** @phpstan-ignore-line */
$message ?? 'Unexpected context found in the [' . $this->name . '] channel. Found [' . json_encode((object) $this->currentContext()) . '].'
$message ?? 'Unexpected context found in the [' . $this->name . '] channel. Found [' . json_encode((object) $this->currentContext(), JSON_THROW_ON_ERROR) . '].'
);
} else {
PHPUnit::assertSame(
$context,
$this->currentContext(),
'Expected to find the context [' . json_encode($context, JSON_THROW_ON_ERROR) . '] in the [' . $this->name . '] channel. Found [' . json_encode((object) $this->currentContext()) . '] instead.'
'Expected to find the context [' . json_encode($context, JSON_THROW_ON_ERROR) . '] in the [' . $this->name . '] channel. Found [' . json_encode((object) $this->currentContext(), JSON_THROW_ON_ERROR) . '] instead.'
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/LogFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function assertChannelIsCurrentlyForgotten(string $name, ?string $message
public function build(array $config): ChannelFake
{
return $this->driver(
'ondemand::'.json_encode((object) $config)
'ondemand::'.json_encode((object) $config, JSON_THROW_ON_ERROR)
)->clearContext();
}

Expand Down

0 comments on commit 15f7635

Please sign in to comment.