Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] hyperf/testing 库 使用 $this->client->file() 方法上传文件测试存在问题 #6612

Open
vleij opened this issue Mar 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@vleij
Copy link

vleij commented Mar 22, 2024

Linux 6e27fffa858f 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 Linux
PHP 8.1.26 (cli) (built: Nov 24 2023 02:23:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.26, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.26, Copyright (c), by Zend Technologies
friendsofhyperf/pest-plugin-hyperf  v3.1.17   The Pest Hyperf Plugin.
hyperf/amqp                         v3.1.9    A amqplib for hyperf.
hyperf/cache                        v3.1.10   A cache component for hyperf.
hyperf/code-parser                  v3.1.4    A code parser component for Hyperf.
hyperf/codec                        v3.1.10   A codec component for Hyperf.
hyperf/collection                   v3.1.7    Hyperf Collection package which come from illuminate/collections
hyperf/command                      v3.1.7    Command for hyperf
hyperf/conditionable                v3.1.0    Hyperf Macroable package which come from illuminate/conditionable
hyperf/config                       v3.1.2    An independent component that provides configuration container.
hyperf/constants                    v3.1.0    A constants component for hyperf.
hyperf/context                      v3.1.0    A coroutine/application context library.
hyperf/contract                     v3.1.2    The contracts of Hyperf.
hyperf/coordinator                  v3.1.7    Hyperf Coordinator
hyperf/coroutine                    v3.1.1    Hyperf Coroutine
hyperf/database                     v3.1.10   A flexible database library.
hyperf/db                           v3.1.0   
hyperf/db-connection                v3.1.7    A hyperf db connection handler for hyperf/database.
hyperf/devtool                      v3.1.5    A Devtool for Hyperf.
hyperf/di                           v3.1.6    A DI for Hyperf.
hyperf/dispatcher                   v3.1.0    A HTTP Server for Hyperf.
hyperf/engine                       v2.10.4   Coroutine engine provided by swoole.
hyperf/engine-contract              v1.9.1    Contract for Coroutine Engine
hyperf/event                        v3.1.0    an event manager that implements PSR-14.
hyperf/exception-handler            v3.1.5    Exception handler for hyperf
hyperf/framework                    v3.1.0    A coroutine framework that focuses on hyperspeed and flexible, specifically use for bu...
hyperf/guzzle                       v3.1.0    Swoole coroutine handler for guzzle
hyperf/http-message                 v3.1.0    microservice framework base on swoole
hyperf/http-server                  v3.1.6    A HTTP Server for Hyperf.
hyperf/logger                       v3.1.9    A logger component for hyperf.
hyperf/macroable                    v3.1.0    Hyperf Macroable package which come from illuminate/macroable
hyperf/memory                       v3.1.0    An independent component that use to operate and manage memory.
hyperf/model-listener               v3.1.10   A model listener for Hyperf.
hyperf/paginator                    v3.1.2    A paginator component for hyperf.
hyperf/pipeline                     v3.1.0    Hyperf Macroable package which come from illuminate/pipeline
hyperf/pool                         v3.1.0    An independent universal connection pool component.
hyperf/process                      v3.1.0    A process component for hyperf.
hyperf/redis                        v3.1.0    A redis component for hyperf.
hyperf/serializer                   v3.1.0    A serializer component for Hyperf.
hyperf/server                       v3.1.9    A base server library for Hyperf.
hyperf/stdlib                       v3.1.0    A stdlib component for Hyperf.
hyperf/stringable                   v3.1.0    Hyperf Stringable package which come from illuminate/support
hyperf/support                      v3.1.10   A support component for Hyperf.
hyperf/tappable                     v3.1.0    Hyperf Macroable package which come from illuminate/tappable
hyperf/testing                      v3.1.3    Testing for hyperf
hyperf/translation                  v3.1.0    An independent translation component, forked by illuminate/translation.
hyperf/utils                        v3.1.0    A tools package that could help developer solved the problem quickly.
hyperf/validation                   v3.1.9    hyperf validation

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.1.2
Built => Feb 18 2024 03:04:42
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.4 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
async_redis => enabled
coroutine_pgsql => enabled
coroutine_odbc => enabled
coroutine_sqlite => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

Description:

image
image
image

通过 $extension = $file->getExtension(); 获取文件后缀为 photo

@vleij vleij added the bug Something isn't working label Mar 22, 2024
@lazychanger
Copy link
Contributor

你在test那边,通过$this->client->file()里面name参数,改为photo.png看看?这是文件名修改问题,extension只是对文件名做操作,没有通过fileinfo库去读取文件mime

@lazychanger
Copy link
Contributor

如果想要标准的无视文件名,通过文件获取mime的,用ext-fileinfo去读取。

@limingxinleo
Copy link
Member

直接上传这个 clientFilename 就有后缀了么?我以为你要用 fileName 或者 pathName 来读取后缀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants