Skip to content

Commit d558dcd

Browse files
committed
minor #97 Inline $tmpDir (derrabus)
This PR was merged into the 2.1-dev branch. Discussion ---------- Inline $tmpDir This PR fixes an issue where the variable `$tmpDir` of `CovertTest` is used in a data provider before it is initialized through the `setUp()` method. Inlining the variable avoids this trap and makes the whole code a bit clearer. I spotted this while running the tests with PHP 8.1 where passing `null` to `tempnam()` triggers a deprecation warning. Commits ------- d152649 Inline $tmpDir
2 parents f12a9e6 + d152649 commit d558dcd

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Tests/Functional/CovertTest.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@
3434
*/
3535
class CovertTest extends TestCase
3636
{
37-
private $tmpDir;
38-
3937
protected function setUp(): void
4038
{
4139
if (!class_exists(Psr7Request::class)) {
4240
$this->markTestSkipped('nyholm/psr7 is not installed.');
4341
}
44-
45-
$this->tmpDir = sys_get_temp_dir();
4642
}
4743

4844
/**
@@ -233,7 +229,7 @@ public function responseProvider()
233229

234230
private function createUploadedFile($content, $originalName, $mimeType, $error)
235231
{
236-
$path = tempnam($this->tmpDir, uniqid());
232+
$path = tempnam(sys_get_temp_dir(), uniqid());
237233
file_put_contents($path, $content);
238234

239235
return new UploadedFile($path, $originalName, $mimeType, $error, true);

0 commit comments

Comments
 (0)