Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
PHPUnit:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
php:
Expand All @@ -23,30 +23,31 @@ jobs:
- 5.5
- 5.4
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-file: development
- run: composer install
- run: docker run -d --name mysql --net=host -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=test -e MYSQL_USER=test -e MYSQL_PASSWORD=test mysql:5
- run: bash tests/wait-for-mysql.sh
- run: MYSQL_USER=test MYSQL_PASSWORD=test vendor/bin/phpunit --coverage-text
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
- run: MYSQL_USER=test MYSQL_PASSWORD=test vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
if: ${{ matrix.php < 7.3 }}

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@v3
- 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) require phpunit/phpunit:^5 --dev --no-interaction
args: hhvm composer.phar install
- run: docker run -d --name mysql --net=host -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=test -e MYSQL_USER=test -e MYSQL_PASSWORD=test mysql:5
- run: bash tests/wait-for-mysql.sh
- run: MYSQL_USER=test MYSQL_PASSWORD=test hhvm vendor/bin/phpunit
- run: docker run -i --rm --workdir=/data -v "$(pwd):/data" --net=host hhvm/hhvm:3.30-lts-latest hhvm vendor/bin/phpunit
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"react/socket": "^1.12"
},
"require-dev": {
"react/async": "^4 || ^3 || ^2",
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.35",
"react/async": "^4 || ^3 || ^2"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 8 additions & 2 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 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.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
Expand All @@ -23,5 +23,11 @@
<env name="DB_USER" value="test"/>
<env name="DB_PASSWD" value="test"/>
<env name="DB_DBNAME" value="test"/>
<ini name="error_reporting" value="-1" />
<!-- Evaluate assertions, requires running with "php -d zend.assertions=1 vendor/bin/phpunit" -->
<!-- <ini name="zend.assertions" value="1" /> -->
<ini name="assert.active" value="1" />
<ini name="assert.exception" value="1" />
<ini name="assert.bail" value="0" />
</php>
</phpunit>
8 changes: 7 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 @@ -21,5 +21,11 @@
<env name="DB_USER" value="test"/>
<env name="DB_PASSWD" value="test"/>
<env name="DB_DBNAME" value="test"/>
<ini name="error_reporting" value="-1" />
<!-- Evaluate assertions, requires running with "php -d zend.assertions=1 vendor/bin/phpunit" -->
<!-- <ini name="zend.assertions" value="1" /> -->
<ini name="assert.active" value="1" />
<ini name="assert.exception" value="1" />
<ini name="assert.bail" value="0" />
</php>
</phpunit>
2 changes: 1 addition & 1 deletion src/Io/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function query($sql, array $params = [])
});
$command->on('end', function () use ($command, $deferred, &$rows) {
$result = new QueryResult();
$result->resultFields = $command->resultFields;
$result->resultFields = $command->fields;
$result->resultRows = $rows;
$result->warningCount = $command->warningCount;

Expand Down
4 changes: 2 additions & 2 deletions src/Io/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ protected function onResultDone()
$command = $this->currCommand;
$this->currCommand = null;

$command->resultFields = $this->resultFields;
assert($command instanceof QueryCommand);
$command->fields = $this->resultFields;
$command->emit('end');

$this->rsState = self::RS_STATE_HEADER;
Expand All @@ -353,7 +354,6 @@ protected function onSuccess()
$command->affectedRows = $this->affectedRows;
$command->insertId = $this->insertId;
$command->warningCount = $this->warningCount;
$command->message = $this->message;
}
$command->emit('success');
}
Expand Down
2 changes: 0 additions & 2 deletions src/Io/QueryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/
class QueryStream extends EventEmitter implements ReadableStreamInterface
{
private $query;
private $connection;
private $started = false;
private $closed = false;
private $paused = false;

public function __construct(QueryCommand $command, ConnectionInterface $connection)
{
$this->command = $command;
$this->connection = $connection;

// forward result set rows until result set end
Expand Down