walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.17k stars 2.27k forks source link

Update tests version libs to fix warnings and deprecations #1065

Closed joanhey closed 1 week ago

joanhey commented 1 week ago

v1.6.x work OK with PHP 8.4 (without deprecations)

And add ansi color output to composer in the workflow.

Updated workflow actions.

joanhey commented 1 week ago

Mockery before image

Before composer ansi output

image

After image

Js actions deprecated image

joanhey commented 1 week ago

When I have free time, I'll add the tests from testman with Workerman v4. Are functional tests that work with any runtime. https://github.com/joanhey/TestMan

Actually fail with Windows and need a bit of work (WIP) https://github.com/joanhey/TestMan/actions/runs/11721591418/job/32649342860

Workerman server to return the tests https://github.com/joanhey/TestMan/blob/main/tests/Servers/Workerman4.php

walkor commented 1 week ago

Thank you very much @joanhey . I'm not sure how much work it will be to add tests for Workerman v4, and since Workerman v5 is about to be released, I don't want the testing for Workerman v4 to take up too much of your time.

joanhey commented 1 week ago

Are functional tests that work with any runtime. The same tests are for workerman (any version), adapterman, php-cli-server, .... And if we add the server file with swoole, reactphp, php-runtime (symfony), ... Also with the PHP CLI Server (than have more fails than Workerman or Adapterman, I'll create an issue to php-src). For Workerman v4 are ready.

~But you can help to create it for Workerma v5 Only create it changing this to v5 https://github.com/joanhey/TestMan/blob/main/tests/Servers/Workerman4.php~

It's working both versions with the same server file !!

Thank you !!

~PD: I think that the same will work with Workerman v5 (without or minimal changes) I'll try it later.~ It's working OK

joanhey commented 1 week ago

With this tests, I fixed some problems in Adapterman, Workerman v4 and v5.

walkor commented 1 week ago

Thank you for your efforts and contributions! I'm glad to see that these feature tests can work in multiple runtime environments. That's great!

joanhey commented 1 week ago

@walkor ~Please try to name the RCs correctly, so it'll be easier to test.~

In Composer, RC versions are denoted by a suffix -RC (e.g., 1.1-RC1, 2.0-RC2).

PD: I'll try with the actual names

EDIT: It's working OK with that names without any change.

joanhey commented 1 week ago

The same server file from v4 it's working with Workerman v5. I need some time, and I'll add to both versions.

https://github.com/joanhey/TestMan/actions/runs/11727346885/job/32668200387?pr=2

joanhey commented 1 week ago

The people are crazy about unit tests, but are only for domain (app) logic. Any runtime (or server) need to meet the same http rules.

joanhey commented 1 week ago

Later we need to run that functional tests with any event loop system. It's more important that with different OSs.

joanhey commented 1 week ago

One question??

------------------------------------------------ WORKERMAN -------------------------------------------------
Workerman version:5.0.0-rc.2    PHP version:8.1.30 (Jit off)
------------------------------------------------- WORKERS --------------------------------------------------

We can change that for RFC3875 compliance https://php.watch/versions/8.3/cli-server-server-software-changes

------------------------------------------------ WORKERMAN -------------------------------------------------
Workerman/5.0.0-rc.2    PHP/8.1.30 (Jit off)
------------------------------------------------- WORKERS --------------------------------------------------

So we have more space to add extra information.

Actually Adapterman use it too. Adapterman/0.6.1 (Workerman/4.2.0) OK

PD: Adapterman it's using also $_SERVER['SERVER_SOFTWARE'] that I think will be good for Workerman

PD: added as issue

walkor commented 1 week ago

1066

Done

joanhey commented 1 week ago

Added Workerman v4 and v5 to Testman. Both using the same server file.

But v5 fail in one test (session delete) and perhaps it's a bug in v5, as both use the same server file.

Workerman/4 OK https://github.com/joanhey/TestMan/actions/runs/11732788915/job/32685757726

Workerman/5 Fail https://github.com/joanhey/TestMan/actions/runs/11732788887/job/32685757580

Workerman session code in server https://github.com/joanhey/TestMan/blob/main/tests/Servers/Workerman.php#L185-L213

Pest code for session delete https://github.com/joanhey/TestMan/blob/main/tests/Functional/Session/SessionTest.php#L76

@walkor can you check it ?

Thank you

PD: It's working in the session set, and fail in session delete (in the part of setting the session) perhaps is a problem with the cache.

PD: Just added Testman in packagist (WIP) for easier testing. Still we need to create a bin

walkor commented 1 week ago

Okay, I will fix it right away.

walkor commented 1 week ago

Fixed.

joanhey commented 1 week ago

Working OK !! Using dev-master https://github.com/joanhey/TestMan/actions/runs/11746572674

PD: :+1: create a new version. Like I said these tests work better than the unit tests !!

joanhey commented 1 week ago

mm still another problem. It's easy to fix: image

Fixed: #1069