public function testDispatchCommandSuccessful() { $connection = new Pheanstalk_Connection(self::SERVER_HOST, self::SERVER_PORT); $command = new Pheanstalk_Command_UseCommand('test'); $response = $connection->dispatchCommand($command); $this->assertIsA($response, 'Pheanstalk_Response'); }
public function testConnectionFailsToIncorrectPort() { $connection = new Pheanstalk_Connection(self::SERVER_HOST, self::SERVER_PORT + 1); $this->_expectDeprecatedConnectionMethod('useTube'); $this->expectException('Pheanstalk_Exception_ConnectionException'); $connection->useTube('test'); }
/** * A connection with a mock socket, configured to return the given line. * @return Pheanstalk_Connection */ private function _connection($line) { $socket = new MockSocket(); $socket->setReturnValue('getLine', $line); $connection = new Pheanstalk_Connection(null, null); $connection->setSocket($socket); return $connection; }