Skip to content

Commit 3ce369d

Browse files
committed
minor symfony#57668 [Filesystem][Messenger][PsrHttpMessageBridge] do not use uniqid() in tests (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- [Filesystem][Messenger][PsrHttpMessageBridge] do not use uniqid() in tests | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | part of symfony#57588 | License | MIT updates the remaining tests that were not covered by symfony#57665 Commits ------- ee7ffbd do not use uniqid() in tests
2 parents fe7f3af + ee7ffbd commit 3ce369d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ public function testCreateUploadedFile()
172172
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
173173
$size = $symfonyUploadedFile->getSize();
174174

175-
$uniqid = uniqid();
176-
$symfonyUploadedFile->move($this->tmpDir, $uniqid);
175+
$filename = 'upload';
176+
$symfonyUploadedFile->move($this->tmpDir, $filename);
177177

178178
$this->assertEquals($uploadedFile->getSize(), $size);
179179
$this->assertEquals(\UPLOAD_ERR_OK, $symfonyUploadedFile->getError());
180180
$this->assertEquals('myfile.txt', $symfonyUploadedFile->getClientOriginalName());
181181
$this->assertEquals('txt', $symfonyUploadedFile->getClientOriginalExtension());
182182
$this->assertEquals('text/plain', $symfonyUploadedFile->getClientMimeType());
183-
$this->assertEquals('An uploaded file.', file_get_contents($this->tmpDir.'/'.$uniqid));
183+
$this->assertEquals('An uploaded file.', file_get_contents($this->tmpDir.'/'.$filename));
184184
}
185185

186186
public function testCreateUploadedFileWithError()

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists()
863863
public function testRenameThrowsExceptionOnError()
864864
{
865865
$this->expectException(IOException::class);
866-
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
866+
$file = $this->workspace.\DIRECTORY_SEPARATOR.'does-not-exist';
867867
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
868868

869869
$this->filesystem->rename($file, $newPath);

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public function testInvalidSentinelMasterName()
413413
}
414414

415415
$master = getenv('MESSENGER_REDIS_DSN');
416-
$uid = uniqid('sentinel_');
416+
$uid = random_int(1, PHP_INT_MAX);
417417

418418
$exp = explode('://', $master, 2)[1];
419419
$this->expectException(\InvalidArgumentException::class);

0 commit comments

Comments
 (0)