phpunit-selenium
phpunit-selenium copied to clipboard
fsockopen(): unable to connect to localhost:4444
(I've copied this issue from https://github.com/sebastianbergmann/phpunit/issues/599)
I am running PHPUnit 3.6.11 with Selenium tests included. Sometimes I forget to start the Selenium server. If I run the tests, it fails at the first test with a PHP error:
Looking at the code, it seems that the test should just be skipped but instead it completely quits. Looking at the documentation for fsockopen, I don't think it should result in a PHP error so it may be a bug with PHP itself. I am running PHP 5.3.5.
Description: fsockopen(): unable to connect to localhost:4444 (Connection refused)
Source File: /usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php(738)
Stack Trace: #0 fsockopen('localhost',4444,0,'',10)
/usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php(738) #1 PHPUnit_Extensions_SeleniumTestCase->skipWithNoServerRunning()
/usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php(776) #2 PHPUnit_Extensions_SeleniumTestCase->runTest()
/usr/share/php/PHPUnit/Framework/TestCase.php(804) #3 PHPUnit_Framework_TestCase->runBare()
/usr/share/php/PHPUnit/Framework/TestResult.php(649) #4 PHPUnit_Framework_TestResult->run(SiteTest)
/usr/share/php/PHPUnit/Framework/TestCase.php(751) #5 PHPUnit_Framework_TestCase->run(PHPUnit_Framework_TestResult)
/usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php(643) #6 PHPUnit_Extensions_SeleniumTestCase->run(PHPUnit_Framework_TestResult)
/usr/share/php/PHPUnit/Framework/TestSuite.php(772) #7 PHPUnit_Framework_TestSuite->runTest(SiteTest,PHPUnit_Framework_TestResult)
/usr/share/php/PHPUnit/Framework/TestSuite.php(745) #8 PHPUnit_Framework_TestSuite->run(PHPUnit_Framework_TestResult,,array(0),array(0),)
/usr/share/php/PHPUnit/Framework/TestSuite.php(705) #9 PHPUnit_Framework_TestSuite->run(PHPUnit_Framework_TestResult,,array(0),array(0),)
/usr/share/php/PHPUnit/TextUI/TestRunner.php(325) #10 PHPUnit_TextUI_TestRunner->doRun(PHPUnit_Framework_TestSuite,array(4))
/usr/share/php/PHPUnit/TextUI/Command.php(192) #11 PHPUnit_TextUI_Command->run(array(3),1)
/usr/share/php/PHPUnit/TextUI/Command.php(130) #12 PHPUnit_TextUI_Command::main()
/usr/bin/phpunit(46)
This is what I get:
[13:23:04][giorgio@Desmond:~/code/phpunit-selenium]$ php run-phpunit.php Tests/SeleniumTestCaseTest.php
#!/usr/bin/env php
PHPUnit 3.7.1-10-g54e0ae0 by Sebastian Bergmann.
Configuration read from /home/giorgio/code/phpunit-selenium/phpunit.xml
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Time: 0 seconds, Memory: 10.00Mb
OK, but incomplete or skipped tests!
Tests: 41, Assertions: 0, Skipped: 41.
[13:23:11][giorgio@Desmond:~/code/phpunit-selenium]$ php -v
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans
[13:23:32][giorgio@Desmond:~/code/phpunit-selenium]$ pear info phpunit/PHPUnit_Selenium
About pear.phpunit.de/PHPUnit_Selenium-1.2.9
Which version of PHPUnit_Selenium are you using?
I'm running 1.2.7
Can you try upgrading to the current 1.2.9 to understand if this still needs to be fixed? In case the problem is present with 1.2.9, please include a failing test case (the source code for a class) so that I can debug the issue here.
Upgraded to 1.2.10 and upgraded PHPUnit to 3.7.9 and PHP to 5.3.6. I am still getting the same error.