1--TEST-- 2SolrServerException (json) - Throw Exception on solr server exception using json response writer 3--SKIPIF-- 4<?php 5include 'skip.if.server_not_configured.inc'; 6?> 7--FILE-- 8<?php 9require_once "bootstrap.inc"; 10 11$options = array ( 12 'hostname' => SOLR_SERVER_HOSTNAME, 13 'login' => SOLR_SERVER_USERNAME, 14 'password' => SOLR_SERVER_PASSWORD, 15 'port' => SOLR_SERVER_PORT, 16 'path' => SOLR_SERVER_PATH, 17 'wt' => 'json' 18); 19 20$client = new SolrClient ( $options ); 21$query = new SolrQuery ( "lucene\\" ); 22try { 23 $response = $client->query ( $query ); 24 print_r ( $response ); 25} catch ( SolrServerException $e ) { 26 echo sprintf("code: %d", $e->getCode()).PHP_EOL; 27 echo sprintf("message: %s", $e->getMessage()).PHP_EOL; 28} 29 30?> 31--EXPECTF-- 32code: %d 33message: %s