From 371b38899143709e2c56f0b7cbcf8956cb95b0b2 Mon Sep 17 00:00:00 2001 From: smiley Date: Wed, 6 Mar 2024 13:11:43 +0100 Subject: [PATCH] :shower: --- tests/Common/CurlHandleTest.php | 3 ++- tests/Common/FactoryUtilsTest.php | 4 ++++ tests/Common/MultipartStreamBuilderTest.php | 4 +++- tests/FactoryTrait.php | 6 +----- tests/Psr15/PriorityQueueRequestHandlerTest.php | 4 ++++ tests/Psr15/QueueRequestHandlerTest.php | 6 +++++- tests/Psr7/DummyStreamTest.php | 4 ++++ tests/Psr7/StreamTest.php | 4 ++++ tests/Psr7/UploadedFileTest.php | 4 +++- 9 files changed, 30 insertions(+), 9 deletions(-) diff --git a/tests/Common/CurlHandleTest.php b/tests/Common/CurlHandleTest.php index e20e4c2e..4f05da33 100644 --- a/tests/Common/CurlHandleTest.php +++ b/tests/Common/CurlHandleTest.php @@ -34,7 +34,8 @@ class CurlHandleTest extends TestCase{ protected ClientInterface $http; // called from FactoryTrait - protected function _setUp_():void{ + protected function setUp():void{ + $this->initFactories(); $options = new HTTPOptions([ 'ca_info' => __DIR__.'/../cacert.pem', diff --git a/tests/Common/FactoryUtilsTest.php b/tests/Common/FactoryUtilsTest.php index ecd5d821..be6c814b 100644 --- a/tests/Common/FactoryUtilsTest.php +++ b/tests/Common/FactoryUtilsTest.php @@ -26,6 +26,10 @@ class FactoryUtilsTest extends TestCase{ use FactoryTrait; + protected function setUp():void{ + $this->initFactories(); + } + public function testCreateStream():void{ $stream = FactoryUtils::createStream('test'); diff --git a/tests/Common/MultipartStreamBuilderTest.php b/tests/Common/MultipartStreamBuilderTest.php index 646055c9..71ae6239 100644 --- a/tests/Common/MultipartStreamBuilderTest.php +++ b/tests/Common/MultipartStreamBuilderTest.php @@ -26,7 +26,9 @@ class MultipartStreamBuilderTest extends TestCase{ protected MultipartStreamBuilder $multipartStreamBuilder; - protected function _setUp_():void{ + protected function setUp():void{ + $this->initFactories(); + $this->multipartStreamBuilder = new MultipartStreamBuilder(); } diff --git a/tests/FactoryTrait.php b/tests/FactoryTrait.php index 2154572c..ed77c686 100644 --- a/tests/FactoryTrait.php +++ b/tests/FactoryTrait.php @@ -45,7 +45,7 @@ trait FactoryTrait{ /** * @throws \Exception */ - protected function setUp():void{ + protected function initFactories():void{ foreach($this->FACTORIES as $property => $const){ @@ -69,10 +69,6 @@ protected function setUp():void{ $this->streamFactory ); - if(method_exists($this, '_setUp_')){ - $this->_setUp_(); - } - } } diff --git a/tests/Psr15/PriorityQueueRequestHandlerTest.php b/tests/Psr15/PriorityQueueRequestHandlerTest.php index 2adb3376..7155080e 100644 --- a/tests/Psr15/PriorityQueueRequestHandlerTest.php +++ b/tests/Psr15/PriorityQueueRequestHandlerTest.php @@ -25,6 +25,10 @@ class PriorityQueueRequestHandlerTest extends TestCase{ use FactoryTrait; + protected function setUp():void{ + $this->initFactories(); + } + public function testHandler():void{ $middlewareStack = [ diff --git a/tests/Psr15/QueueRequestHandlerTest.php b/tests/Psr15/QueueRequestHandlerTest.php index 4f5a581b..04a2799f 100644 --- a/tests/Psr15/QueueRequestHandlerTest.php +++ b/tests/Psr15/QueueRequestHandlerTest.php @@ -25,7 +25,11 @@ class QueueRequestHandlerTest extends TestCase{ use FactoryTrait; - protected function getDispatcher():RequestHandlerInterface{ + protected function setUp():void{ + $this->initFactories(); + } + + protected function getDispatcher():RequestHandlerInterface{ // Create request handler instance: $dispatcher = new QueueDispatcher($this->getTestMiddlewareStack(), $this->getTestFallbackHandler()); diff --git a/tests/Psr7/DummyStreamTest.php b/tests/Psr7/DummyStreamTest.php index 777e78ea..5b7ecd37 100644 --- a/tests/Psr7/DummyStreamTest.php +++ b/tests/Psr7/DummyStreamTest.php @@ -24,6 +24,10 @@ class DummyStreamTest extends TestCase{ use FactoryTrait; + protected function setUp():void{ + $this->initFactories(); + } + public function testDefaultStream():void{ $dummy = new DummyStream; diff --git a/tests/Psr7/StreamTest.php b/tests/Psr7/StreamTest.php index 22327118..6894bba4 100644 --- a/tests/Psr7/StreamTest.php +++ b/tests/Psr7/StreamTest.php @@ -27,6 +27,10 @@ class StreamTest extends TestCase{ use FactoryTrait; + protected function setUp():void{ + $this->initFactories(); + } + public function testConstructorThrowsExceptionOnInvalidArgument():void{ $this->expectException(InvalidArgumentException::class); diff --git a/tests/Psr7/UploadedFileTest.php b/tests/Psr7/UploadedFileTest.php index 191a6470..0382359a 100644 --- a/tests/Psr7/UploadedFileTest.php +++ b/tests/Psr7/UploadedFileTest.php @@ -32,7 +32,9 @@ class UploadedFileTest extends TestCase{ protected array $cleanup; // called from FactoryTrait - protected function _setUp_():void{ + protected function setUp():void{ + $this->initFactories(); + $this->cleanup = []; }