amphp / beanstalk

Asynchronous Beanstalk Client for PHP.

Home Page:https://amphp.org/beanstalk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Increase test coverage

kelunik opened this issue · comments

There should be more unit and integration tests.

I can do some unit tests to increase your tests coverage :)

Cool!

@Weysan I've added some integration tests recently, maybe you can extend those. 👍

I will update my fork @kelunik thanks

@kelunik I tried to run the test locally with my command line :

AMP_TEST_BEANSTALK_INTEGRATION=1 phpunit --coverage-text

But I have that error on my console :

Amp\Beanstalk\Test\IntegrationTest::testPut
Amp\Beanstalk\ConnectException: Connection attempt failed

/var/www/html/perso/beanstalk/src/Connection.php:98
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Failure.php:26
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:118
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:147
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Coroutine.php:93
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:41
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:118
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Deferred.php:48
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/functions.php:208
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:123
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Deferred.php:48
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/NativeDriver.php:203
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/NativeDriver.php:68
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/Driver.php:130
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/Driver.php:70
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop.php:53
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/functions.php:158
/var/www/html/perso/beanstalk/test/IntegrationTest.php:43
/root/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:206
/root/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:135

Caused by
Amp\Socket\ConnectException: Connection to tcp://127.0.0.1:11300 refused

/var/www/html/perso/beanstalk/vendor/amphp/socket/lib/functions.php:122
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Coroutine.php:74
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:41
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:118
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Deferred.php:48
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/functions.php:208
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Internal/Placeholder.php:123
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Deferred.php:48
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/NativeDriver.php:203
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/NativeDriver.php:68
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/Driver.php:130
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop/Driver.php:70
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/Loop.php:53
/var/www/html/perso/beanstalk/vendor/amphp/amp/lib/functions.php:158
/var/www/html/perso/beanstalk/test/IntegrationTest.php:43
/root/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:206
/root/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:135

Any clue what could happen?

I will open the pull request, I have a coverage of 100% on the parser. If I manage to run the integration test, would be easier for me to add more tests for the other classes (difficult to do unit tests on Connection.php)

You need a running BeanstalkD instance for running it.

Okay, it works :) Will extends integration tests