Skip to content

Commit f187504

Browse files
committed
test: Fix Test Case
1 parent ab842cb commit f187504

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/webfiori/framework/test/UploaderTest.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testUpload00() {
9090
$this->assertEquals([
9191
[
9292
'name' => 'testUpload.txt',
93-
'size' => 51,
93+
'size' => '51',
9494
'upload-path' => str_replace('/', DS, str_replace('\\', DS, __DIR__)),
9595
'upload-error' => '',
9696
'mime' => 'text/plain',
@@ -111,16 +111,21 @@ public function testUpload01(FileUploader $u) {
111111
$this->assertTrue($file instanceof UploadedFile);
112112
$this->assertEquals('testUpload.txt',$file->getName());
113113
$this->assertEquals('testUpload',$file->getNameWithNoExt());
114-
$this->assertFalse($file->isUploaded());
114+
$this->assertTrue($file->isUploaded());
115115
$this->assertFalse($file->isReplace());
116116
$this->assertEquals('text/plain',$file->getMIME());
117117
$this->assertEquals(str_replace('/', DS, str_replace('\\', DS, __DIR__)),$file->getDir());
118118
$this->assertEquals(str_replace('/', DS, str_replace('\\', DS, __DIR__)).DS.'testUpload.txt',$file->getAbsolutePath());
119119

120-
$this->assertEquals("temp_file_not_moved",$file->getUploadError());
120+
$this->assertEquals("",$file->getUploadError());
121121
$this->assertEquals("{\"id\":-1,\"mime\":\"text\/plain\",\"name\":\"testUpload.txt\""
122-
. ",\"directory\":\"".Json::escapeJSONSpecialChars($file->getDir())."\",\"sizeInBytes\":0,"
123-
. "\"sizeInKBytes\":0,\"sizeInMBytes\":0,\"uploaded\":false,\"isReplace\":false,\"uploadError\":\"temp_file_not_moved\"}", $file.'');
122+
. ",\"directory\":\"".Json::escapeJSONSpecialChars($file->getDir())."\",\"sizeInBytes\":51,"
123+
. "\"sizeInKBytes\":0.0498046875,"
124+
. "\"sizeInMBytes\":4.8637390136719E-5,"
125+
. "\"uploaded\":true,"
126+
. "\"isReplace\":false,"
127+
. "\"uploadError\":\"\"}", $file.'');
128+
$file->remove();
124129
}
125130
public function testUpload02() {
126131
$this->expectException(FileException::class);

0 commit comments

Comments
 (0)