nur-sery/tests/web/uploadsTest.php

193 lines
3.2 KiB
PHP
Raw Normal View History

2024-05-20 20:15:38 +04:00
<?php
namespace nur\sery\web;
use PHPUnit\Framework\TestCase;
class uploadsTest extends TestCase {
const _FILES = [
'simple' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
'multiple' => [
'name' => [
0 => '',
1 => '',
],
'type' => [
0 => '',
1 => '',
],
'tmp_name' => [
0 => '',
1 => '',
],
'error' => [
0 => 4,
1 => 4,
],
'size' => [
0 => 0,
1 => 0,
],
],
'onelevel' => [
'name' => [
'a' => '',
'b' => '',
],
'type' => [
'a' => '',
'b' => '',
],
'tmp_name' => [
'a' => '',
'b' => '',
],
'error' => [
'a' => 4,
'b' => 4,
],
'size' => [
'a' => 0,
'b' => 0,
],
],
'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 = [
'simple' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
'multiple' => [
0 => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
1 => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
],
'onelevel' => [
'a' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
'b' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
],
],
'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));
}
}