1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
--TEST--
SolrClient::__construct() - Test options
--SKIPIF--
<?php require_once 'skip.if.server_not_configured.inc'; ?>
--FILE--
<?php
require_once "bootstrap.inc";
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'port' => SOLR_SERVER_PORT,
'password' => SOLR_SERVER_PASSWORD,
'path' => SOLR_SERVER_PATH,
'timeout' => 400
);
$client = new SolrClient($options);
$pingResponse = $client->ping();
print_r($pingResponse->getRawResponse());
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'port' => strval(SOLR_SERVER_PORT),
'password' => SOLR_SERVER_PASSWORD,
'path' => '/'.SOLR_SERVER_PATH,
'timeout' => '400'
);
$client = new SolrClient($options);
$pingResponse = $client->ping();
print_r($pingResponse->getRawResponse());
$options = array (
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'port' => SOLR_SERVER_PORT,
'password' => SOLR_SERVER_PASSWORD,
'path' => SOLR_SERVER_PATH,
'proxy_host' => 'localhost',
'proxy_login' => 'test',
'proxy_password' => 'password',
'proxy_port' => 8181,
'query_string_delimiter' => '&'
);
$client = new SolrClient($options);
try {
$pingResponse = $client->ping();
} catch (SolrClientException $e) {
print_exception($e);
}
$options = array (
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'port' => SOLR_SERVER_PORT,
'password' => SOLR_SERVER_PASSWORD,
'path' => SOLR_SERVER_PATH,
'proxy_host' => 'localhost',
'proxy_login' => 'test',
'proxy_password' => 'password',
'proxy_port' => '8181',
'query_string_delimiter' => '&'
);
$client = new SolrClient($options);
try {
$pingResponse = $client->ping();
} catch (SolrClientException $e) {
print_exception($e);
}
try {
$client = new SolrClient(array());
} catch (SolrIllegalArgumentException $e) {
print_exception($e);
}
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'port' => SOLR_SERVER_PORT,
'password' => SOLR_SERVER_PASSWORD,
'path' => SOLR_SERVER_PATH,
'ssl_cert' => '/tmp/unavailable.crt',
'ssl_key' => 'test',
'ssl_keypassword' => 'test',
'ssl_cainfo' => 'test',
'ssl_capath' => '/tmp/'
);
$client = new SolrClient($options);
try {
$pingResponse = $client->ping();
} catch (SolrClientException $e) {
print_exception($e);
}
?>
--EXPECTF--
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Content-Length: 0
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Content-Length: 0
SolrClientException 1004: Solr HTTP Error 7: 'Couldn't connect to server'
SolrClientException 1004: Solr HTTP Error 7: 'Couldn't connect to server'
SolrIllegalArgumentException 4000: The SolrClient options cannot be an empty array
|