Skip to content

Commit 839ff42

Browse files
committed
Testing: Update MockTarget for consistency with StreamTarget
- Add `MockTarget::__destruct()`
1 parent 4994e2b commit 839ff42

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Toolkit/Testing/Console/MockTarget.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ public function __construct(
4545
$this->Formatter = $formatter ?? new Formatter(null, null, fn() => $this->Width);
4646
}
4747

48+
/**
49+
* @internal
50+
*/
51+
public function __destruct()
52+
{
53+
$this->close();
54+
}
55+
4856
/**
4957
* @inheritDoc
5058
*/
@@ -135,10 +143,7 @@ public function close(): void
135143
$this->IsStdout = false;
136144
$this->IsStderr = false;
137145
$this->IsTty = false;
138-
$this->Width = null;
139146
$this->Stream = null;
140-
unset($this->Formatter);
141-
142147
$this->IsValid = false;
143148
}
144149

0 commit comments

Comments
 (0)