From c90400b76964e49267c78b9fcaac5bebc227b3eb Mon Sep 17 00:00:00 2001 From: lubiana Date: Wed, 4 Sep 2024 21:42:55 +0200 Subject: [PATCH] fix WriterTest::test_justify with reflection --- tests/Output/WriterTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Output/WriterTest.php b/tests/Output/WriterTest.php index f1de8f0..aaa4390 100644 --- a/tests/Output/WriterTest.php +++ b/tests/Output/WriterTest.php @@ -122,6 +122,15 @@ public function test_justify() { $w = new Writer(static::$ou); + $terminal = $this->createMock(Terminal::class); + $terminal->expects($this->once()) + ->method('width') + ->willReturn(80); + + $reflection = new \ReflectionProperty(Writer::class, 'terminal'); + $reflection->setAccessible(true); + $reflection->setValue($w, $terminal); + $w->justify('PHP Version', PHP_VERSION, [ 'sep' => '-', ]);