Skip to content

Commit

Permalink
Add last missing unit test for Api\Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Jun 13, 2024
1 parent 9894d8a commit f990b2b
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/Api/UploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,43 @@ public function testProcessException()
], $data);
}

/**
* @covers ::process
*/
public function testProcessWithChunk()
{
$source = static::TMP . '/test.md';
F::write($source, 'abcdef');

$upload = $this->upload([
'requestMethod' => 'POST',
'requestData' => [
'headers' => [
'Upload-Length' => 3000,
'Upload-Offset' => 0,
'Upload-Id' => 'abcd'
],
'files' => [
[
'name' => 'test.md',
'tmp_name' => $source,
'size' => F::size($source),
'error' => 0
]
]
]
], false, true);

$dir = static::TMP . '/site/cache/.uploads';
$this->assertSame([
'status' => 'ok',
'data' => null
], $upload->process(function () {
}));
$this->assertFileDoesNotExist($dir . '/test.md');
$this->assertFileExists($dir . '/abcd-test.md');
}

/**
* @covers ::processChunk
*/
Expand Down

0 comments on commit f990b2b

Please sign in to comment.