BasicAuthTestSolrCloudConnector.php in Search API Solr 4.x
File
tests/modules/search_api_solr_test/src/Plugin/SolrConnector/BasicAuthTestSolrCloudConnector.php
View source
<?php
namespace Drupal\search_api_solr_test\Plugin\SolrConnector;
use Drupal\search_api_solr\Plugin\SolrConnector\BasicAuthSolrCloudConnector;
use Drupal\search_api_solr\Utility\Utility;
use Solarium\Core\Client\Endpoint;
use Solarium\Core\Client\Request;
use Solarium\Core\Client\Response;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Query\Result\Result;
class BasicAuthTestSolrCloudConnector extends BasicAuthSolrCloudConnector {
protected static $query;
protected static $request;
protected $intercept = FALSE;
public function execute(QueryInterface $query, Endpoint $endpoint = NULL) {
self::$query = $query;
if ($this->intercept) {
return new Result($query, new Response(''));
}
return parent::execute($query, $endpoint);
}
public function executeRequest(Request $request, Endpoint $endpoint = NULL) {
self::$request = $request;
if ($this->intercept) {
return new Response('');
}
return parent::executeRequest($request, $endpoint);
}
public function getQuery() {
return self::$query;
}
public function getRequest() {
return self::$request;
}
public function getRequestParams() {
return Utility::parseRequestParams(self::$request);
}
public function setIntercept(bool $intercept) {
$this->intercept = $intercept;
}
}