2024-05-22 20:49:05 +04:00
|
|
|
<?php
|
|
|
|
namespace nulib\web;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class uploadsTest extends TestCase {
|
|
|
|
const _FILES = [
|
2024-07-19 16:38:19 +04:00
|
|
|
# name="simple"
|
2024-05-22 20:49:05 +04:00
|
|
|
'simple' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=multiple[], name=multiple[]
|
2024-05-22 20:49:05 +04:00
|
|
|
'multiple' => [
|
|
|
|
'name' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'type' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'tmp_name' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'error' => [
|
|
|
|
0 => 4,
|
|
|
|
1 => 4,
|
|
|
|
],
|
|
|
|
'size' => [
|
|
|
|
0 => 0,
|
|
|
|
1 => 0,
|
|
|
|
],
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=onelevel[a], name=onelevel[b]
|
2024-05-22 20:49:05 +04:00
|
|
|
'onelevel' => [
|
|
|
|
'name' => [
|
|
|
|
'a' => '',
|
|
|
|
'b' => '',
|
|
|
|
],
|
|
|
|
'type' => [
|
|
|
|
'a' => '',
|
|
|
|
'b' => '',
|
|
|
|
],
|
|
|
|
'tmp_name' => [
|
|
|
|
'a' => '',
|
|
|
|
'b' => '',
|
|
|
|
],
|
|
|
|
'error' => [
|
|
|
|
'a' => 4,
|
|
|
|
'b' => 4,
|
|
|
|
],
|
|
|
|
'size' => [
|
|
|
|
'a' => 0,
|
|
|
|
'b' => 0,
|
|
|
|
],
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=multiplelevel[a][], name=multiplelevel[a][], name=multiplelevel[b][], name=multiplelevel[b][]
|
2024-05-22 20:49:05 +04:00
|
|
|
'multiplelevel' => [
|
|
|
|
'name' => [
|
|
|
|
'a' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'type' => [
|
|
|
|
'a' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'tmp_name' => [
|
|
|
|
'a' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => '',
|
|
|
|
1 => '',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'error' => [
|
|
|
|
'a' => [
|
|
|
|
0 => 4,
|
|
|
|
1 => 4,
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => 4,
|
|
|
|
1 => 4,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'size' => [
|
|
|
|
'a' => [
|
|
|
|
0 => 0,
|
|
|
|
1 => 0,
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => 0,
|
|
|
|
1 => 0,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
const PARSED = [
|
2024-07-19 16:38:19 +04:00
|
|
|
# name="simple"
|
2024-05-22 20:49:05 +04:00
|
|
|
'simple' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=multiple[], name=multiple[]
|
2024-05-22 20:49:05 +04:00
|
|
|
'multiple' => [
|
|
|
|
0 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
1 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=onelevel[a], name=onelevel[b]
|
2024-05-22 20:49:05 +04:00
|
|
|
'onelevel' => [
|
|
|
|
'a' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
],
|
2024-07-19 16:38:19 +04:00
|
|
|
# name=multiplelevel[a][], name=multiplelevel[a][], name=multiplelevel[b][], name=multiplelevel[b][]
|
2024-05-22 20:49:05 +04:00
|
|
|
'multiplelevel' => [
|
|
|
|
'a' => [
|
|
|
|
0 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
1 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'b' => [
|
|
|
|
0 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
1 => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => '',
|
|
|
|
'tmp_name' => '',
|
|
|
|
'error' => 4,
|
|
|
|
'size' => 0,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
function test_files() {
|
|
|
|
self::assertSame(self::PARSED, uploads::_files(self::_FILES));
|
|
|
|
}
|
|
|
|
}
|