Skip to content

Commit 4f1078b

Browse files
committed
Finish fixing tests implementations
1 parent 673379e commit 4f1078b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/src/ResumableTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,13 @@ public function testProcessHandleChunk(): void
8282
]
8383
);
8484

85+
$tempFolder = $this->resumable->tempFolder . '/' . $resumableParams['resumableIdentifier'] . '/';
8586
$this->refreshResumable();
8687
$this->assertNotNull($this->resumable->process());
87-
unlink($uploadedFile);
88+
$this->assertFileDoesNotExist($uploadedFile);// It got moved
89+
$this->assertFileExists($tempFolder . 'example-file.png.0003');// It got moved
90+
$this->assertTrue(unlink($tempFolder . 'example-file.png.0003'));
91+
$this->assertTrue(rmdir($tempFolder . '/'));// It should be empty
8892
}
8993

9094
public function testProcessHandleTestChunk(): void
@@ -263,14 +267,15 @@ public function testResumableSanitizeFileName(string $filename, string $filename
263267
$this->refreshResumable();
264268
$this->resumable->uploadFolder = 'upld';
265269

270+
$this->assertFileExists($uploadedFile);
266271
$this->assertNotNull($this->resumable->handleChunk());
267-
unlink($uploadedFile);
272+
$this->assertFileDoesNotExist($uploadedFile);
268273
$this->assertTrue($this->resumable->isUploadComplete());
269274
$this->assertSame($filename, $this->resumable->getOriginalFilename());
270275
$this->assertSame($filenameSanitized, $this->resumable->getFilename());
271-
$this->assertFileExists('upld/' . $filenameSanitized);
272-
$this->assertSame('upld/' . $filenameSanitized, $this->resumable->getFilepath());
273-
unlink('upld/' . $filenameSanitized);
276+
$this->assertFileExists($this->resumable->uploadFolder . '/' . $filenameSanitized);
277+
$this->assertSame($this->resumable->uploadFolder . '/' . $filenameSanitized, $this->resumable->getFilepath());
278+
$this->assertTrue(unlink($this->resumable->uploadFolder . '/' . $filenameSanitized));
274279
}
275280

276281
public static function isFileUploadCompleteProvider(): array

0 commit comments

Comments
 (0)