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

Run tests on PHP 8.3, fix dynamic property for PHP 8.2 and update test suite #40

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
jobs:
PHPUnit:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
php:
- 8.3
- 8.2
- 8.1
- 8.0
Expand All @@ -24,7 +25,7 @@ jobs:
- 5.4
- 5.3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand All @@ -39,13 +40,16 @@ jobs:

PHPUnit-hhvm:
name: PHPUnit (HHVM)
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: azjezz/setup-hhvm@v1
- uses: actions/checkout@v4
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
- name: Run hhvm composer.phar install
uses: docker://hhvm/hhvm:3.30-lts-latest
with:
version: lts-3.30
- run: composer self-update --2.2 # downgrade Composer for HHVM
- run: hhvm $(which composer) install
- run: hhvm vendor/bin/phpunit
args: hhvm composer.phar install
- name: Run hhvm vendor/bin/phpunit
uses: docker://hhvm/hhvm:3.30-lts-latest
with:
args: hhvm vendor/bin/phpunit
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,22 @@
"react/stream": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4 || ^3 || ^2",
"react/http": "^1.5",
"react/mysql": "^0.5.5"
},
"autoload": {
"psr-4": { "Clue\\React\\SshProxy\\": "src/" },
"files": [ "src/Io/functions.php" ]
"psr-4": {
"Clue\\React\\SshProxy\\": "src/"
},
"files": [
"src/Io/functions.php"
]
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\React\\SshProxy\\": "tests/"}
"psr-4": {
"Clue\\Tests\\React\\SshProxy\\": "tests/"
}
}
}
9 changes: 6 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
<!-- PHPUnit configuration file with new format for PHPUnit 9.6+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
Expand All @@ -17,4 +17,7 @@
<directory>./src/</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1" />
</php>
Comment on lines +20 to +22
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests for PHP 8.2 and PHP 8.3 are currently running infinitely and I narrowed it down to these three lines being the cause of this. For other pull requests these changes ran smoothly, any idea what is happening here @clue?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks strange. Can you reproduce this locally? Can you try excluding some tests to see which test is causing this? Using groups or excludes or filters might be useful.

Copy link
Author

@yadaiio yadaiio Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @clue, I tried debugging the code to find the cause of this issue and after seeing a new error thrown in line 76 in the CompositeConnection.php file I ended up looking in the changes made in PHP 8.2 and saw that the dynamic properties are deprecated, see https://www.php.net/releases/8.2/en.php#deprecate_dynamic_properties. I decided to add a new class variable private $remote after discussing the new situation with @SimonFrings. Tests are running green now. 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also updated my comment and explain the situation. Thank you @clue for giving me the hint to exclude groups. It was definitely faster for narrowing it down. 👍

</phpunit>
5 changes: 4 additions & 1 deletion phpunit.xml.legacy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with old format for PHPUnit 9.2 or older -->
<!-- PHPUnit configuration file with old format for legacy PHPUnit -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="vendor/autoload.php"
Expand All @@ -15,4 +15,7 @@
<directory>./src/</directory>
</whitelist>
</filter>
<php>
<ini name="error_reporting" value="-1" />
</php>
</phpunit>
1 change: 1 addition & 0 deletions src/Io/CompositeConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/** @internal */
class CompositeConnection extends EventEmitter implements ConnectionInterface
{
private $remote;
private $read;
private $write;
private $closed = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionalSshSocksConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function setUpConnector()
public function tearDownSSHClientProcess()
{
// run loop in order to shut down SSH client process again
\React\Async\await(\React\Promise\Timer\sleep(0.001));
\React\Async\await(\React\Async\delay(0.001));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested, invalid code. delay() returns a void and can't be passed to await(). Also, delay() requires correct Async package version.

}

public function testConnectInvalidProxyUriWillReturnRejectedPromise()
Expand Down