Skip to content

Commit 6d25776

Browse files
committed
fix: test factory initialization
1 parent 542fba2 commit 6d25776

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/BaseTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Http\Psr7Test;
44

5+
use F3\Http\Factory\Psr17Factory as FatfreeFactory;
56
use GuzzleHttp\Psr7\Stream as GuzzleStream;
67
use GuzzleHttp\Psr7\UploadedFile as GuzzleUploadedFile;
78
use GuzzleHttp\Psr7\Uri as GuzzleUri;
@@ -84,6 +85,10 @@ protected function buildUri($uri)
8485
return new RingCentralUri($uri);
8586
}
8687

88+
if (class_exists(FatfreeFactory::class)) {
89+
return (new FatfreeFactory())->createUri($uri);
90+
}
91+
8792
throw new \RuntimeException('Could not create URI. Check your config');
8893
}
8994

@@ -123,6 +128,9 @@ protected function buildStream($data)
123128
if (class_exists(SlimStreamFactory::class)) {
124129
$factory = new SlimStreamFactory();
125130
}
131+
if (class_exists(FatfreeFactory::class)) {
132+
$factory = new FatfreeFactory();
133+
}
126134
if ($factory) {
127135
if (is_string($data)) {
128136
return $factory->createStream($data);
@@ -176,6 +184,12 @@ protected function buildUploadableFile($data)
176184
return (new SlimUploadedFileFactory())->createUploadedFile($stream);
177185
}
178186

187+
if (class_exists(FatfreeFactory::class)) {
188+
$stream = $this->buildStream($data);
189+
190+
return (new FatfreeFactory())->createUploadedFile($stream);
191+
}
192+
179193
throw new \RuntimeException('Could not create Stream. Check your config');
180194
}
181195
}

0 commit comments

Comments
 (0)