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