Skip to content

Commit

Permalink
🚿
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Mar 6, 2024
1 parent 979d2a0 commit 371b388
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 9 deletions.
3 changes: 2 additions & 1 deletion tests/Common/CurlHandleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions tests/Common/FactoryUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
class FactoryUtilsTest extends TestCase{
use FactoryTrait;

protected function setUp():void{
$this->initFactories();
}

public function testCreateStream():void{
$stream = FactoryUtils::createStream('test');

Expand Down
4 changes: 3 additions & 1 deletion tests/Common/MultipartStreamBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
6 changes: 1 addition & 5 deletions tests/FactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trait FactoryTrait{
/**
* @throws \Exception
*/
protected function setUp():void{
protected function initFactories():void{

foreach($this->FACTORIES as $property => $const){

Expand All @@ -69,10 +69,6 @@ protected function setUp():void{
$this->streamFactory
);

if(method_exists($this, '_setUp_')){
$this->_setUp_();
}

}

}
4 changes: 4 additions & 0 deletions tests/Psr15/PriorityQueueRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
class PriorityQueueRequestHandlerTest extends TestCase{
use FactoryTrait;

protected function setUp():void{
$this->initFactories();
}

public function testHandler():void{

$middlewareStack = [
Expand Down
6 changes: 5 additions & 1 deletion tests/Psr15/QueueRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 4 additions & 0 deletions tests/Psr7/DummyStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
class DummyStreamTest extends TestCase{
use FactoryTrait;

protected function setUp():void{
$this->initFactories();
}

public function testDefaultStream():void{
$dummy = new DummyStream;

Expand Down
4 changes: 4 additions & 0 deletions tests/Psr7/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
class StreamTest extends TestCase{
use FactoryTrait;

protected function setUp():void{
$this->initFactories();
}

public function testConstructorThrowsExceptionOnInvalidArgument():void{
$this->expectException(InvalidArgumentException::class);

Expand Down
4 changes: 3 additions & 1 deletion tests/Psr7/UploadedFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down

0 comments on commit 371b388

Please sign in to comment.