diff --git a/tests/cases/extensions/adapter/queue/BeanstalkTest.php b/tests/cases/extensions/adapter/queue/BeanstalkTest.php index 776b654..ee8b151 100644 --- a/tests/cases/extensions/adapter/queue/BeanstalkTest.php +++ b/tests/cases/extensions/adapter/queue/BeanstalkTest.php @@ -9,11 +9,32 @@ namespace li3_queue\tests\cases\extensions\adapter\queue; use li3_queue\extensions\adapter\queue\Beanstalk; +use lithium\core\NetworkException; class BeanstalkTest extends \lithium\test\Unit { public $beanstalk = null; + protected $_testConfig = array( + 'host' => '127.0.0.1', + 'port' => 11300, + 'autoConnect' => true + ); + + public function skip() { + $config = $this->_testConfig; + + try { + $conn = new Beanstalk($config); + } catch (NetworkException $e) { + $message = "A Beanstalk server does not appear to be running on "; + $message .= $config['host'] . ':' . $config['port']; + $hasBeanstalk = ($e->getCode() != 503) ? true : false; + $this->skipIf(!$hasBeanstalk, $message); + } + unset($conn); + } + public function testInitialize() { $beanstalk = new Beanstalk(); $this->assertInternalType('object', $beanstalk); diff --git a/tests/cases/net/beanstalk/ServiceTest.php b/tests/cases/net/beanstalk/ServiceTest.php index 4fb839c..4c8290f 100644 --- a/tests/cases/net/beanstalk/ServiceTest.php +++ b/tests/cases/net/beanstalk/ServiceTest.php @@ -3,11 +3,33 @@ namespace li3_queue\tests\cases\net\beanstalk; use li3_queue\net\beanstalk\Service; +use lithium\core\NetworkException; class ServiceTest extends \lithium\test\Unit { public $service = null; + protected $_testConfig = array( + 'host' => '127.0.0.1', + 'port' => 11300 + ); + + public function skip() { + $config = $this->_testConfig; + + $conn = new Service($config); + + try { + $conn->connect(); + } catch (NetworkException $e) { + $message = "A Beanstalk server does not appear to be running on "; + $message .= $config['host'] . ':' . $config['port']; + $hasBeanstalk = ($e->getCode() != 503) ? true : false; + $this->skipIf(!$hasBeanstalk, $message); + } + unset($conn); + } + public function testConnection() { $service = new Service(); $result = $service->connect();