Skip to content

Commit 5ce178d

Browse files
committed
refactor(command): Change error variable to warning in TestCommand
- Change the private variable `error` to `warning` in the TestCommand class - Update the `__destruct()` method to use the `warning()` method instead of `error()` - Update the `handle()` method to use the `warning()` method instead of `error()`
1 parent ad17640 commit 5ce178d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Commands/TestCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ class TestCommand extends Command
2626

2727
protected $description = 'Test for exception-notify';
2828

29-
private ?string $error = null;
29+
private ?string $warning = null;
3030

3131
public function __destruct()
3232
{
3333
if (! $this->output instanceof OutputStyle) {
3434
$this->output = new OutputStyle(new ArgvInput, new ConsoleOutput);
3535
}
3636

37-
if ($this->error) {
38-
$this->output->error($this->error);
37+
if ($this->warning) {
38+
$this->output->warning($this->warning);
3939

4040
return;
4141
}
@@ -61,7 +61,7 @@ public function handle(ExceptionNotifyManager $exceptionNotifyManager): void
6161
throw $runtimeException;
6262
}
6363

64-
$this->error = sprintf(
64+
$this->warning = sprintf(
6565
'The exception [%s] should not be reported. Please check the configuration.',
6666
\get_class($runtimeException)
6767
);

tests/FeatureTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
it('can report exception', function (): void {
1616
$this
17-
->post('report-exception?foo=bar&bar=baz', [
18-
'foo' => 'bar',
17+
->post('report-exception?foo=bar', [
1918
'bar' => 'baz',
2019
'password' => 'password',
2120
'file' => new UploadedFile(__FILE__, basename(__FILE__)),
@@ -25,8 +24,7 @@
2524

2625
it('can auto report exception', function (): void {
2726
$this
28-
->post('exception?foo=bar&bar=baz', [
29-
'foo' => 'bar',
27+
->post('exception?foo=bar', [
3028
'bar' => 'baz',
3129
'password' => 'password',
3230
'file' => new UploadedFile(__FILE__, basename(__FILE__)),

0 commit comments

Comments
 (0)