danielmewes / php-rql

A PHP client driver for the RethinkDB query language (ReQL).
http://php-rql.dnsalias.net/
339 stars 60 forks source link

Issues running "composer test" #152

Open jimmyadaro opened 7 years ago

jimmyadaro commented 7 years ago

Hi there; I've been with this problem almost all night.

Let me explain my current situation: I'm trying to set PHP-RQL using XAMPP (7.1.1-0) @ Ubuntu 16.04(.4) using PHP 7(.0.15) (cli). I've installed Composer (1.3.2 2017-01-27) and PHPUnit (6.0.8).

I tried set up the port 28015 with this command:

sudo nc -l 28015

I guess that work as expected; that port does nothing until I go to the directory where I've all the .ZIP content of the MASTER branch, this dir is: /opt/lampp/htdocs/rql and execute the following command:

composer test

Then the Terminal where I have the nc command throws something like this:

ý�4{"protocol_version":0,"authentication_method":"SCRAM-SHA-256","authentication":"n,,n=admin,r=PPTNpWBA1a166N4lZm9\/DoXx"}

Then the composer test Terminal outputs this:

tests/phpunit.sh PHP Fatal error: Uncaught RqlDriverError: Unable to read from socket during handshake. Disconnected.

thrown in /opt/lampp/htdocs/rql/rdb/Connection.php on line 490 PHPUnit 4.8.35 by Sebastian Bergmann and contributors.

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 63 / 395 ( 15%) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 126 / 395 ( 31%) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 189 / 395 ( 47%) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 252 / 395 ( 63%) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 315 / 395 ( 79%) EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 378 / 395 ( 95%) EEEEEEEEEEEEEEEEE

Time: 161 ms, Memory: 14.00MB

There were 395 errors:

1) r\Tests\Functional\AggregationsTest::testReduce stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused)

/opt/lampp/htdocs/rql/rdb/Connection.php:455 /opt/lampp/htdocs/rql/rdb/Connection.php:118 /opt/lampp/htdocs/rql/rdb/global.php:87 /opt/lampp/htdocs/rql/tests/TestCase.php:20 /opt/lampp/htdocs/rql/tests/TestCase.php:11

2) r\Tests\Functional\AggregationsTest::testCountVal stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused)

/opt/lampp/htdocs/rql/rdb/Connection.php:455 /opt/lampp/htdocs/rql/rdb/Connection.php:118 /opt/lampp/htdocs/rql/rdb/global.php:87 /opt/lampp/htdocs/rql/tests/TestCase.php:20 /opt/lampp/htdocs/rql/tests/TestCase.php:11

3) r\Tests\Functional\AggregationsTest::testCountRow stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused)

/opt/lampp/htdocs/rql/rdb/Connection.php:455 /opt/lampp/htdocs/rql/rdb/Connection.php:118 /opt/lampp/htdocs/rql/rdb/global.php:87 /opt/lampp/htdocs/rql/tests/TestCase.php:20 /opt/lampp/htdocs/rql/tests/TestCase.php:11

4) r\Tests\Functional\AggregationsTest::testDistinct stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused)

/opt/lampp/htdocs/rql/rdb/Connection.php:455 /opt/lampp/htdocs/rql/rdb/Connection.php:118 /opt/lampp/htdocs/rql/rdb/global.php:87 /opt/lampp/htdocs/rql/tests/TestCase.php:20 /opt/lampp/htdocs/rql/tests/TestCase.php:11

[AND THEN ANOTHER HUNDREDS OF "stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused)"]

FAILURES! Tests: 395, Assertions: 0, Errors: 395. PHP Warning: stream_socket_client(): unable to connect to tcp://127.0.0.1:28015 (Connection refused) in /opt/lampp/htdocs/rql/rdb/Connection.php on line 455 PHP Fatal error: Uncaught RqlDriverError: Unable to connect: Connection refused

thrown in /opt/lampp/htdocs/rql/rdb/Connection.php on line 459 Script tests/phpunit.sh handling the test event returned with error code 2

If I execute netstat -atn I can see this:

tcp 0 0 127.0.0.1:43368 127.0.0.1:28015 ESTABLISHED tcp 0 0 127.0.0.1:28015 127.0.0.1:43368 ESTABLISHED

until the tests/phpunit.sh file is executed (and throw all those errors), then this disappears:

tcp 0 0 127.0.0.1:28015 127.0.0.1:43368 ESTABLISHED

and only have this remaining:

tcp 0 0 127.0.0.1:43368 127.0.0.1:28015 TIME_WAIT

Changing the line 459 of rdb/Connection.php to this:

throw new RqlDriverError("Unable to connect: " . $errstr." Host: ".$this->host." Port: ".$this->port." Errno: ".$errno);

I get this error after run composer test:

Unable to connect: Connection refused Host: 127.0.0.1 Port: 28015 Errno: 111

and http://localhost/rql/tests/TestCase.php shows this:

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /opt/lampp/htdocs/rql/tests/TestCase.php on line 5

What am I doing wrong? Maybe I do need to install something else? Maybe PHP 7 is not supported yet?

Geekimo commented 6 years ago

Maybe you should have a running rethinkdb server installed on the host where you're running the tests. The errors are trigerred regarding a faulty connection to a server.