From 4402f93430140b48c014b370e0f06929bd39aa28 Mon Sep 17 00:00:00 2001 From: k Date: Wed, 31 Jan 2024 20:39:40 +0100 Subject: [PATCH 1/3] - feat: add getter for the HttpWorker --- src/PSR7Worker.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PSR7Worker.php b/src/PSR7Worker.php index 8df0338..209beea 100644 --- a/src/PSR7Worker.php +++ b/src/PSR7Worker.php @@ -54,6 +54,11 @@ public function getWorker(): WorkerInterface return $this->httpWorker->getWorker(); } + public function getHttpWorker(): HttpWorker + { + return $this->httpWorker; + } + /** * @throws \JsonException */ From 959262368b7bebdbf373796dc13d15088e69b727 Mon Sep 17 00:00:00 2001 From: k Date: Thu, 1 Feb 2024 17:54:56 +0100 Subject: [PATCH 2/3] - feat: unit test for the new HttpWorker getter --- tests/Unit/PSR7WorkerTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/Unit/PSR7WorkerTest.php diff --git a/tests/Unit/PSR7WorkerTest.php b/tests/Unit/PSR7WorkerTest.php new file mode 100644 index 0000000..603d33d --- /dev/null +++ b/tests/Unit/PSR7WorkerTest.php @@ -0,0 +1,28 @@ +getHttpWorker()); + } +} From 1ca80614f46abca56f68751a5f03271c21481a43 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 2 Feb 2024 00:32:06 +0400 Subject: [PATCH 3/3] Refactor test case --- tests/Unit/PSR7WorkerTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/Unit/PSR7WorkerTest.php b/tests/Unit/PSR7WorkerTest.php index 603d33d..f0e7cb2 100644 --- a/tests/Unit/PSR7WorkerTest.php +++ b/tests/Unit/PSR7WorkerTest.php @@ -21,8 +21,17 @@ public function testHttpWorkerIsAvailable(): void $psrFactory, ); - ob_end_clean(); - self::assertInstanceOf(HttpWorker::class, $psrWorker->getHttpWorker()); } + + protected function tearDown(): void + { + // Clean all extra output buffers + $level = \ob_get_level(); + while (--$level > 0) { + \ob_end_clean(); + } + + parent::tearDown(); // TODO: Change the autogenerated stub + } }