Commit 5f61e63a authored by thePanz's avatar thePanz

Merge branch 'develop' into 'master'

parents 75ac5576 243d9ac0
language: php language: php
dist: trusty
php: php:
- 7.1
- 7.0 - 7.0
- 5.6 - 5.6
- 5.5 - 5.5
...@@ -15,6 +18,10 @@ env: ...@@ -15,6 +18,10 @@ env:
- SYMFONY_VERSION=2.8.* - SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.* # Does not work with php below 5.5 - SYMFONY_VERSION=3.0.* # Does not work with php below 5.5
cache:
directories:
- $HOME/.composer/cache
before_script: before_script:
- bash -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7.0' ] && [ $TRAVIS_PHP_VERSION != 'nightly' ]; then printf '\n\n\n\n' | pecl install pecl_http-1.7.6; fi" - bash -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7.0' ] && [ $TRAVIS_PHP_VERSION != 'nightly' ]; then printf '\n\n\n\n' | pecl install pecl_http-1.7.6; fi"
- composer require --prefer-source --dev symfony/event-dispatcher:${SYMFONY_VERSION} - composer require --prefer-source --dev symfony/event-dispatcher:${SYMFONY_VERSION}
......
...@@ -116,7 +116,7 @@ class Curl extends Configurable implements AdapterInterface ...@@ -116,7 +116,7 @@ class Curl extends Configurable implements AdapterInterface
$handler = curl_init(); $handler = curl_init();
curl_setopt($handler, CURLOPT_URL, $uri); curl_setopt($handler, CURLOPT_URL, $uri);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
if (!ini_get('open_basedir')) { if (!(function_exists('ini_get') && ini_get('open_basedir'))) {
curl_setopt($handler, CURLOPT_FOLLOWLOCATION, true); curl_setopt($handler, CURLOPT_FOLLOWLOCATION, true);
} }
curl_setopt($handler, CURLOPT_TIMEOUT, $options['timeout']); curl_setopt($handler, CURLOPT_TIMEOUT, $options['timeout']);
......
...@@ -74,6 +74,7 @@ class Guzzle extends Configurable implements AdapterInterface ...@@ -74,6 +74,7 @@ class Guzzle extends Configurable implements AdapterInterface
RequestOptions::HEADERS => $this->getRequestHeaders($request), RequestOptions::HEADERS => $this->getRequestHeaders($request),
RequestOptions::BODY => $this->getRequestBody($request), RequestOptions::BODY => $this->getRequestBody($request),
RequestOptions::TIMEOUT => $endpoint->getTimeout(), RequestOptions::TIMEOUT => $endpoint->getTimeout(),
RequestOptions::CONNECT_TIMEOUT => $endpoint->getTimeout(),
]; ];
// Try endpoint authentication first, fallback to request for backwards compatibility // Try endpoint authentication first, fallback to request for backwards compatibility
......
...@@ -41,7 +41,6 @@ namespace Solarium\Core\Client\Adapter; ...@@ -41,7 +41,6 @@ namespace Solarium\Core\Client\Adapter;
use Guzzle\Http\Client as GuzzleClient; use Guzzle\Http\Client as GuzzleClient;
use Solarium\Core\Configurable; use Solarium\Core\Configurable;
use Solarium\Core\Client\Adapter\AdapterInterface;
use Solarium\Core\Client\Request; use Solarium\Core\Client\Request;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Client\Endpoint; use Solarium\Core\Client\Endpoint;
...@@ -76,7 +75,7 @@ class Guzzle3 extends Configurable implements AdapterInterface ...@@ -76,7 +75,7 @@ class Guzzle3 extends Configurable implements AdapterInterface
$this->getRequestBody($request), $this->getRequestBody($request),
array( array(
'timeout' => $endpoint->getTimeout(), 'timeout' => $endpoint->getTimeout(),
'connecttimeout' => $endpoint->getTimeout(), 'connect_timeout' => $endpoint->getTimeout(),
) )
); );
......
...@@ -111,13 +111,25 @@ class Http extends Configurable implements AdapterInterface ...@@ -111,13 +111,25 @@ class Http extends Configurable implements AdapterInterface
if ($method == Request::METHOD_POST) { if ($method == Request::METHOD_POST) {
if ($request->getFileUpload()) { if ($request->getFileUpload()) {
$boundary = '----------' . md5(time());
$CRLF = "\r\n";
$file = $request->getFileUpload();
$filename = basename($file);
// Add the proper boundary to the Content-Type header
$request->addHeader("Content-Type: multipart/form-data; boundary={$boundary}");
$data = "--{$boundary}" . $CRLF;
$data .= 'Content-Disposition: form-data; name="upload"; filename=' . $filename . $CRLF;
$data .= 'Content-Type: application/octet-stream' . $CRLF . $CRLF;
$data .= file_get_contents($request->getFileUpload()) . $CRLF;
$data .= '--' . $boundary . '--';
$content_length = strlen($data);
$request->addHeader("Content-Length: $content_length\r\n");
stream_context_set_option( stream_context_set_option(
$context, $context,
'http', 'http',
'content', 'content',
file_get_contents($request->getFileUpload()) $data
); );
$request->addHeader('Content-Type: multipart/form-data');
} else { } else {
$data = $request->getRawData(); $data = $request->getRawData();
if (null !== $data) { if (null !== $data) {
...@@ -171,10 +183,10 @@ class Http extends Configurable implements AdapterInterface ...@@ -171,10 +183,10 @@ class Http extends Configurable implements AdapterInterface
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$data = @file_get_contents($uri, false, $context); $data = @file_get_contents($uri, false, $context);
$headers = array();
if (isset($http_response_header)) { if (isset($http_response_header)) {
$headers = $http_response_header; $headers = $http_response_header;
} else {
$headers = array();
} }
return array($data, $headers); return array($data, $headers);
......
...@@ -157,7 +157,7 @@ class Response ...@@ -157,7 +157,7 @@ class Response
// $statusInfo[1] = the HTTP response code // $statusInfo[1] = the HTTP response code
// $statusInfo[2] = the response message // $statusInfo[2] = the response message
$statusInfo = explode(' ', $statusHeader, 3); $statusInfo = explode(' ', $statusHeader, 3);
$this->statusCode = $statusInfo[1]; $this->statusCode = (int) $statusInfo[1];
$this->statusMessage = $statusInfo[2]; $this->statusMessage = $statusInfo[2];
} }
} }
...@@ -460,10 +460,10 @@ class Helper ...@@ -460,10 +460,10 @@ class Helper
*/ */
public function cacheControl($useCache, $cost = null) public function cacheControl($useCache, $cost = null)
{ {
$cache = 'false';
if ($useCache === true) { if ($useCache === true) {
$cache = 'true'; $cache = 'true';
} else {
$cache = 'false';
} }
$result = '{!cache='.$cache; $result = '{!cache='.$cache;
......
...@@ -223,7 +223,7 @@ class BufferedAdd extends AbstractPlugin ...@@ -223,7 +223,7 @@ class BufferedAdd extends AbstractPlugin
$this->client->getEventDispatcher()->dispatch(Events::PRE_FLUSH, $event); $this->client->getEventDispatcher()->dispatch(Events::PRE_FLUSH, $event);
$this->updateQuery->addDocuments($event->getBuffer(), $event->getOverwrite(), $event->getCommitWithin()); $this->updateQuery->addDocuments($event->getBuffer(), $event->getOverwrite(), $event->getCommitWithin());
$result = $this->client->update($this->updateQuery, $this->getEndpoint()); $result = $this->client->update($this->updateQuery, $this->getEndPoint());
$this->clear(); $this->clear();
$event = new PostFlushEvent($result); $event = new PostFlushEvent($result);
...@@ -251,7 +251,7 @@ class BufferedAdd extends AbstractPlugin ...@@ -251,7 +251,7 @@ class BufferedAdd extends AbstractPlugin
$this->updateQuery->addDocuments($this->buffer, $event->getOverwrite()); $this->updateQuery->addDocuments($this->buffer, $event->getOverwrite());
$this->updateQuery->addCommit($event->getSoftCommit(), $event->getWaitSearcher(), $event->getExpungeDeletes()); $this->updateQuery->addCommit($event->getSoftCommit(), $event->getWaitSearcher(), $event->getExpungeDeletes());
$result = $this->client->update($this->updateQuery, $this->getEndpoint()); $result = $this->client->update($this->updateQuery, $this->getEndPoint());
$this->clear(); $this->clear();
$event = new PostCommitEvent($result); $event = new PostCommitEvent($result);
......
...@@ -44,7 +44,7 @@ use Solarium\Core\Plugin\AbstractPlugin; ...@@ -44,7 +44,7 @@ use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\Exception\InvalidArgumentException; use Solarium\Exception\InvalidArgumentException;
use Solarium\Exception\RuntimeException; use Solarium\Exception\RuntimeException;
use Solarium\Core\Event\Events; use Solarium\Core\Event\Events;
use Solarium\Core\Event\preExecuteRequest as preExecuteRequestEvent; use Solarium\Core\Event\PreExecuteRequest as preExecuteRequestEvent;
/** /**
* CustomizeRequest plugin. * CustomizeRequest plugin.
......
...@@ -64,10 +64,10 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface ...@@ -64,10 +64,10 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
{ {
$data = $result->getData(); $data = $result->getData();
$items = array();
if (isset($data['analysis'])) { if (isset($data['analysis'])) {
$items = $this->parseAnalysis($result, $data['analysis']); $items = $this->parseAnalysis($result, $data['analysis']);
} else {
$items = array();
} }
return $this->addHeaderInfo($data, array('items' => $items)); return $this->addHeaderInfo($data, array('items' => $items));
......
...@@ -64,8 +64,6 @@ class Types extends ResultList ...@@ -64,8 +64,6 @@ class Types extends ResultList
return $item; return $item;
} }
} }
return;
} }
/** /**
...@@ -80,7 +78,5 @@ class Types extends ResultList ...@@ -80,7 +78,5 @@ class Types extends ResultList
return $item; return $item;
} }
} }
return;
} }
} }
...@@ -107,7 +107,6 @@ class RequestBuilder extends BaseRequestBuilder ...@@ -107,7 +107,6 @@ class RequestBuilder extends BaseRequestBuilder
} elseif (is_readable($file)) { } elseif (is_readable($file)) {
$request->setFileUpload($file); $request->setFileUpload($file);
$request->addParam('resource.name', basename($query->getFile())); $request->addParam('resource.name', basename($query->getFile()));
$request->addHeader('Content-Type: multipart/form-data');
} else { } else {
throw new RuntimeException('Extract query file path/url invalid or not available'); throw new RuntimeException('Extract query file path/url invalid or not available');
} }
......
...@@ -88,6 +88,5 @@ class Query extends BaseQuery ...@@ -88,6 +88,5 @@ class Query extends BaseQuery
*/ */
public function getResponseParser() public function getResponseParser()
{ {
return;
} }
} }
...@@ -92,7 +92,6 @@ class DisMax extends AbstractComponent ...@@ -92,7 +92,6 @@ class DisMax extends AbstractComponent
*/ */
public function getResponseParser() public function getResponseParser()
{ {
return;
} }
/** /**
......
...@@ -97,7 +97,6 @@ class DistributedSearch extends AbstractComponent ...@@ -97,7 +97,6 @@ class DistributedSearch extends AbstractComponent
*/ */
public function getResponseParser() public function getResponseParser()
{ {
return;
} }
/** /**
......
...@@ -191,11 +191,15 @@ class Grouping extends AbstractComponent ...@@ -191,11 +191,15 @@ class Grouping extends AbstractComponent
* This overwrites any existing fields * This overwrites any existing fields
* *
* @param array $fields * @param array $fields
*
* @return self Provides fluent interface
*/ */
public function setFields($fields) public function setFields($fields)
{ {
$this->clearFields(); $this->clearFields();
$this->addFields($fields); $this->addFields($fields);
return $this;
} }
/** /**
......
...@@ -37,7 +37,6 @@ class Spatial extends AbstractComponent ...@@ -37,7 +37,6 @@ class Spatial extends AbstractComponent
*/ */
public function getResponseParser() public function getResponseParser()
{ {
return;
} }
/** /**
......
...@@ -248,11 +248,15 @@ class Stats extends AbstractComponent ...@@ -248,11 +248,15 @@ class Stats extends AbstractComponent
* This overwrites any existing fields * This overwrites any existing fields
* *
* @param array $fields * @param array $fields
*
* @return self Provides fluent interface
*/ */
public function setFields($fields) public function setFields($fields)
{ {
$this->clearFields(); $this->clearFields();
$this->addFields($fields); $this->addFields($fields);
return $this;
} }
/** /**
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
namespace Solarium\QueryType\Select\RequestBuilder\Component; namespace Solarium\QueryType\Select\RequestBuilder\Component;
use Solarium\QueryType\Select\Query\Component\Dismax as DismaxComponent; use Solarium\QueryType\Select\Query\Component\DisMax as DismaxComponent;
use Solarium\Core\Client\Request; use Solarium\Core\Client\Request;
/** /**
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
namespace Solarium\QueryType\Select\RequestBuilder\Component; namespace Solarium\QueryType\Select\RequestBuilder\Component;
use Solarium\QueryType\Select\Query\Component\Edismax as EdismaxComponent; use Solarium\QueryType\Select\Query\Component\EdisMax as EdismaxComponent;
use Solarium\Core\Client\Request; use Solarium\Core\Client\Request;
/** /**
......
...@@ -95,16 +95,16 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt ...@@ -95,16 +95,16 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt
} }
} }
$numFound = null;
if (isset($data['response']['numFound'])) { if (isset($data['response']['numFound'])) {
$numFound = $data['response']['numFound']; $numFound = $data['response']['numFound'];
} else {
$numFound = null;
} }
$maxScore = null;
if (isset($data['response']['maxScore'])) { if (isset($data['response']['maxScore'])) {
$maxScore = $data['response']['maxScore']; $maxScore = $data['response']['maxScore'];
} else {
$maxScore = null;
} }
return $this->addHeaderInfo( return $this->addHeaderInfo(
......
...@@ -229,10 +229,6 @@ class RequestBuilder extends BaseRequestBuilder ...@@ -229,10 +229,6 @@ class RequestBuilder extends BaseRequestBuilder
*/ */
protected function buildFieldXml($name, $boost, $value, $modifier = null, $query = null) protected function buildFieldXml($name, $boost, $value, $modifier = null, $query = null)
{ {
if ($value instanceof \DateTime) {
$value = $query->getHelper()->formatDate($value);
}
$xml = '<field name="' . $name . '"'; $xml = '<field name="' . $name . '"';
$xml .= $this->attrib('boost', $boost); $xml .= $this->attrib('boost', $boost);
$xml .= $this->attrib('update', $modifier); $xml .= $this->attrib('update', $modifier);
...@@ -242,10 +238,13 @@ class RequestBuilder extends BaseRequestBuilder ...@@ -242,10 +238,13 @@ class RequestBuilder extends BaseRequestBuilder
$value = 'false'; $value = 'false';
} elseif ($value === true) { } elseif ($value === true) {
$value = 'true'; $value = 'true';
} elseif ($value instanceof \DateTime) {
$value = $query->getHelper()->formatDate($value);
} else {
$value = htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8');
} }
$xml .= '>' . htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'); $xml .= '>' . $value . '</field>';
$xml .= '</field>';
return $xml; return $xml;
} }
......
...@@ -66,7 +66,7 @@ class Loader ...@@ -66,7 +66,7 @@ class Loader
if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) { if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) {
continue; continue;
} }
$sourceFile = realpath($file->getPathName()); $sourceFile = realpath($file->getPathname());
/** @noinspection PhpIncludeInspection */ /** @noinspection PhpIncludeInspection */
require_once $sourceFile; require_once $sourceFile;
$includedFiles[] = $sourceFile; $includedFiles[] = $sourceFile;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" backupStaticAttributes="false" syntaxCheck="false" bootstrap="tests/bootstrap.php"> <phpunit
backupGlobals="false"
backupStaticAttributes="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
colors="true"
>
<testsuites> <testsuites>
<testsuite name="Solarium"> <testsuite name="Solarium">
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Client\Adapter; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Client\Adapter;
use Guzzle\Plugin\Mock\MockPlugin; use Guzzle\Plugin\Mock\MockPlugin;
use Guzzle\Http\Message\Response; use Guzzle\Http\Message\Response;
use Guzzle\Http\Client as GuzzleClient;
use Solarium\Core\Client\Adapter\Guzzle3 as GuzzleAdapter; use Solarium\Core\Client\Adapter\Guzzle3 as GuzzleAdapter;
use Solarium\Core\Client\Request; use Solarium\Core\Client\Request;
use Solarium\Core\Client\Endpoint; use Solarium\Core\Client\Endpoint;
...@@ -89,7 +88,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -89,7 +88,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$response = $this->adapter->execute($request, $endpoint); $response = $this->adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -102,7 +101,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -102,7 +101,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests = $plugin->getReceivedRequests(); $receivedRequests = $plugin->getReceivedRequests();
$this->assertSame(1, count($receivedRequests)); $this->assertCount(1, $receivedRequests);
$this->assertSame('GET', $receivedRequests[0]->getMethod()); $this->assertSame('GET', $receivedRequests[0]->getMethod());
$this->assertSame( $this->assertSame(
...@@ -136,7 +135,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -136,7 +135,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$response = $this->adapter->execute($request, $endpoint); $response = $this->adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -149,10 +148,10 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -149,10 +148,10 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests = $plugin->getReceivedRequests(); $receivedRequests = $plugin->getReceivedRequests();
$this->assertSame(1, count($receivedRequests)); $this->assertCount(1, $receivedRequests);
$this->assertSame('POST', $receivedRequests[0]->getMethod()); $this->assertSame('POST', $receivedRequests[0]->getMethod());
$this->assertSame(file_get_contents(__FILE__), (string)$receivedRequests[0]->getBody()); $this->assertStringEqualsFile(__FILE__, (string)$receivedRequests[0]->getBody());
$this->assertSame( $this->assertSame(
'request value', 'request value',
(string)$receivedRequests[0]->getHeader('X-PHPUnit') (string)$receivedRequests[0]->getHeader('X-PHPUnit')
...@@ -185,7 +184,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -185,7 +184,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$response = $this->adapter->execute($request, $endpoint); $response = $this->adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -198,7 +197,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -198,7 +197,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests = $plugin->getReceivedRequests(); $receivedRequests = $plugin->getReceivedRequests();
$this->assertSame(1, count($receivedRequests)); $this->assertCount(1, $receivedRequests);
$this->assertSame('POST', $receivedRequests[0]->getMethod()); $this->assertSame('POST', $receivedRequests[0]->getMethod());
$this->assertSame($xml, (string)$receivedRequests[0]->getBody()); $this->assertSame($xml, (string)$receivedRequests[0]->getBody());
...@@ -237,7 +236,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -237,7 +236,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$response = $this->adapter->execute($request, $endpoint); $response = $this->adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -250,7 +249,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase ...@@ -250,7 +249,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests = $plugin->getReceivedRequests(); $receivedRequests = $plugin->getReceivedRequests();
$this->assertSame(1, count($receivedRequests)); $this->assertCount(1, $receivedRequests);
$this->assertSame('GET', $receivedRequests[0]->getMethod()); $this->assertSame('GET', $receivedRequests[0]->getMethod());
$this->assertSame( $this->assertSame(
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
namespace Solarium\Tests\Core\Client\Adapter; namespace Solarium\Tests\Core\Client\Adapter;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack; use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware; use GuzzleHttp\Middleware;
...@@ -94,7 +93,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase ...@@ -94,7 +93,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$response = $adapter->execute($request, $endpoint); $response = $adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -141,7 +140,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase ...@@ -141,7 +140,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$response = $adapter->execute($request, $endpoint); $response = $adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -155,7 +154,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase ...@@ -155,7 +154,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$this->assertCount(1, $container); $this->assertCount(1, $container);
$this->assertSame('POST', $container[0]['request']->getMethod()); $this->assertSame('POST', $container[0]['request']->getMethod());
$this->assertSame('request value', $container[0]['request']->getHeaderline('X-PHPUnit')); $this->assertSame('request value', $container[0]['request']->getHeaderline('X-PHPUnit'));
$this->assertSame(file_get_contents(__FILE__), (string)$container[0]['request']->getBody()); $this->assertStringEqualsFile(__FILE__, (string)$container[0]['request']->getBody());
} }
/** /**
...@@ -190,7 +189,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase ...@@ -190,7 +189,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$response = $adapter->execute($request, $endpoint); $response = $adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
...@@ -239,7 +238,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase ...@@ -239,7 +238,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$response = $adapter->execute($request, $endpoint); $response = $adapter->execute($request, $endpoint);
$this->assertSame('OK', $response->getStatusMessage()); $this->assertSame('OK', $response->getStatusMessage());
$this->assertSame('200', $response->getStatusCode()); $this->assertSame(200, $response->getStatusCode());
$this->assertSame( $this->assertSame(
array( array(
'HTTP/1.1 200 OK', 'HTTP/1.1 200 OK',
......
...@@ -184,16 +184,20 @@ class HttpTest extends \PHPUnit_Framework_TestCase ...@@ -184,16 +184,20 @@ class HttpTest extends \PHPUnit_Framework_TestCase
$context = $this->adapter->createContext($request, $endpoint); $context = $this->adapter->createContext($request, $endpoint);
// Remove content from comparison, since we can't determine the
// random boundary string.
$stream_context_get_options = stream_context_get_options($context);
unset($stream_context_get_options['http']['content']);
unset($stream_context_get_options['http']['header']);
$this->assertEquals( $this->assertEquals(
array( array(
'http' => array( 'http' => array(
'method' => $method, 'method' => $method,
'timeout' => $timeout, 'timeout' => $timeout,
'content' => file_get_contents(__FILE__),
'header' => 'Content-Type: multipart/form-data',
) )
), ),
stream_context_get_options($context) $stream_context_get_options
); );
} }
......
...@@ -211,7 +211,7 @@ EOF; ...@@ -211,7 +211,7 @@ EOF;
$response = $mock->execute($request, $endpoint); $response = $mock->execute($request, $endpoint);
$this->assertEquals($body, $response->getBody()); $this->assertEquals($body, $response->getBody());
$this->assertEquals($statusCode, $response->getStatusCode()); $this->assertSame($statusCode, $response->getStatusCode());
$this->assertEquals($statusMessage, $response->getStatusMessage()); $this->assertEquals($statusMessage, $response->getStatusMessage());
} }
......
...@@ -551,7 +551,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase ...@@ -551,7 +551,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
->method('getRequestBuilder') ->method('getRequestBuilder')
->will($this->returnValue($observer)); ->will($this->returnValue($observer));
$this->client->registerQueryType('testquerytype', 'Solarium\QueryType\Select\Query\Query', $observer, ''); $this->client->registerQueryType('testquerytype', 'Solarium\QueryType\Select\Query\Query');
$this->client->createRequest($queryStub); $this->client->createRequest($queryStub);
} }
...@@ -1293,9 +1293,7 @@ class MyAdapter extends ClientAdapterHttp ...@@ -1293,9 +1293,7 @@ class MyAdapter extends ClientAdapterHttp
{ {
public function execute($request, $endpoint) public function execute($request, $endpoint)
{ {
$response = new Response('{}', array('HTTP/1.1 200 OK')); return new Response('{}', array('HTTP/1.1 200 OK'));
return $response;
} }
} }
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\Core\Event\PostCreateResult; use Solarium\Core\Event\PostCreateResult;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event;
use Solarium\Core\Event\PostExecute; use Solarium\Core\Event\PostExecute;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\Core\Event\PreCreateResult; use Solarium\Core\Event\PreCreateResult;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\Core\Event;
use Solarium\Core\Event\PreExecute; use Solarium\Core\Event\PreExecute;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
namespace Solarium\Tests\Plugin\BufferedAdd\Event; namespace Solarium\Tests\Plugin\BufferedAdd\Event;
use Solarium\Plugin\BufferedAdd\Event\PostCommit; use Solarium\Plugin\BufferedAdd\Event\PostCommit;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
namespace Solarium\Tests\Plugin\BufferedAdd\Event; namespace Solarium\Tests\Plugin\BufferedAdd\Event;
use Solarium\Plugin\BufferedAdd\Event\PostFlush; use Solarium\Plugin\BufferedAdd\Event\PostFlush;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Core\Client\Client; use Solarium\Core\Client\Client;
use Solarium\Core\Client\Response; use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\Result; use Solarium\Core\Query\Result\Result;
......
...@@ -65,7 +65,7 @@ class WeightedRandomChoiceTest extends \PHPUnit_Framework_TestCase ...@@ -65,7 +65,7 @@ class WeightedRandomChoiceTest extends \PHPUnit_Framework_TestCase
$key = $randomizer->getRandom($excludes); $key = $randomizer->getRandom($excludes);
$this->assertTrue($key !== 'key3'); $this->assertNotSame($key, 'key3');
} }
public function testAllEntriesExcluded() public function testAllEntriesExcluded()
......
...@@ -85,7 +85,7 @@ class ResultTest extends AbstractResultTest ...@@ -85,7 +85,7 @@ class ResultTest extends AbstractResultTest
$result = new FilterResultDummy(1, 12, $this->numFound, $this->maxScore, $this->docs, $this->components, Query::FILTER_MODE_REMOVE); $result = new FilterResultDummy(1, 12, $this->numFound, $this->maxScore, $this->docs, $this->components, Query::FILTER_MODE_REMOVE);
$docs = $result->getDocuments(); $docs = $result->getDocuments();
$this->assertEquals(3, count($docs)); $this->assertCount(3, $docs);
$this->assertEquals($docs[0]->title, $this->docs[0]->title); $this->assertEquals($docs[0]->title, $this->docs[0]->title);
$this->assertEquals($docs[1]->title, $this->docs[1]->title); $this->assertEquals($docs[1]->title, $this->docs[1]->title);
$this->assertEquals($docs[2]->title, $this->docs[2]->title); $this->assertEquals($docs[2]->title, $this->docs[2]->title);
......
...@@ -86,7 +86,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase ...@@ -86,7 +86,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this->plugin->initPlugin($mockClient, array()); $this->plugin->initPlugin($mockClient, array());
$this->plugin->setQuery($this->query); $this->plugin->setQuery($this->query);
$this->assertEquals(5, count($this->plugin)); $this->assertCount(5, $this->plugin);
} }
public function testIteratorAndRewind() public function testIteratorAndRewind()
...@@ -200,7 +200,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase ...@@ -200,7 +200,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this->plugin->initPlugin($mockClient, array()); $this->plugin->initPlugin($mockClient, array());
$this->plugin->setQuery($this->query)->setEndpoint('s2'); $this->plugin->setQuery($this->query)->setEndpoint('s2');
$this->assertEquals(5, count($this->plugin)); $this->assertCount(5, $this->plugin);
} }
public function testWithSpecificEndpointOption() public function testWithSpecificEndpointOption()
...@@ -214,7 +214,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase ...@@ -214,7 +214,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this->plugin->initPlugin($mockClient, array('endpoint' => 's3')); $this->plugin->initPlugin($mockClient, array('endpoint' => 's3'));
$this->plugin->setQuery($this->query); $this->plugin->setQuery($this->query);
$this->assertEquals(5, count($this->plugin)); $this->assertCount(5, $this->plugin);
} }
} }
......
...@@ -134,9 +134,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase ...@@ -134,9 +134,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
public function testContentTypeHeader() public function testContentTypeHeader()
{ {
$headers = array( $headers = array();
'Content-Type: multipart/form-data'
);
$request = $this->builder->build($this->query); $request = $this->builder->build($this->query);
$this->assertEquals($headers, $this->assertEquals($headers,
$request->getHeaders()); $request->getHeaders());
......
...@@ -467,7 +467,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase ...@@ -467,7 +467,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
); );
$components = $query->getComponents(); $components = $query->getComponents();
$this->assertEquals(1, count($components)); $this->assertCount(1, $components);
$this->assertThat( $this->assertThat(
array_pop($components), array_pop($components),
$this->isInstanceOf('Solarium\QueryType\Select\Query\Component\FacetSet') $this->isInstanceOf('Solarium\QueryType\Select\Query\Component\FacetSet')
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
namespace Solarium\Tests\QueryType\RealtimeGet; namespace Solarium\Tests\QueryType\RealtimeGet;
use Solarium\Core\Client\Request;
use Solarium\QueryType\RealtimeGet\Query; use Solarium\QueryType\RealtimeGet\Query;
use Solarium\QueryType\RealtimeGet\RequestBuilder; use Solarium\QueryType\RealtimeGet\RequestBuilder;
......
...@@ -262,7 +262,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase ...@@ -262,7 +262,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase
{ {
$key = 'fq1'; $key = 'fq1';
$fq = $this->query->createFilterQuery($key, true); $fq = $this->query->createFilterQuery($key);
$fq->setQuery('category:1'); $fq->setQuery('category:1');
$this->assertEquals( $this->assertEquals(
...@@ -470,7 +470,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase ...@@ -470,7 +470,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase
); );
$components = $query->getComponents(); $components = $query->getComponents();
$this->assertEquals(1, count($components)); $this->assertCount(1, $components);
$this->assertThat( $this->assertThat(
array_pop($components), array_pop($components),
$this->isInstanceOf('Solarium\QueryType\Select\Query\Component\FacetSet') $this->isInstanceOf('Solarium\QueryType\Select\Query\Component\FacetSet')
...@@ -612,7 +612,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase ...@@ -612,7 +612,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase
$components = $this->query->getComponentTypes(); $components = $this->query->getComponentTypes();
$components['mykey'] = 'mycomponent'; $components['mykey'] = 'mycomponent';
$this->query->registerComponentType('mykey', 'mycomponent', 'mybuilder', 'myparser'); $this->query->registerComponentType('mykey', 'mycomponent');
$this->assertEquals( $this->assertEquals(
$components, $components,
......
...@@ -138,7 +138,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -138,7 +138,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this->distributedSearch->clearShards(); $this->distributedSearch->clearShards();
$shards = $this->distributedSearch->getShards(); $shards = $this->distributedSearch->getShards();
$this->assertTrue(is_array($shards)); $this->assertTrue(is_array($shards));
$this->assertEquals(0, count($shards)); $this->assertCount(0, $shards);
} }
public function testAddShards() public function testAddShards()
...@@ -167,7 +167,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -167,7 +167,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
) )
); );
$shards = $this->distributedSearch->getShards(); $shards = $this->distributedSearch->getShards();
$this->assertEquals(3, count($shards)); $this->assertCount(3, $shards);
$this->assertEquals( $this->assertEquals(
array( array(
'shard3' => 'localhost:8983/solr/shard3', 'shard3' => 'localhost:8983/solr/shard3',
...@@ -216,7 +216,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -216,7 +216,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this->distributedSearch->clearCollections(); $this->distributedSearch->clearCollections();
$collections = $this->distributedSearch->getCollections(); $collections = $this->distributedSearch->getCollections();
$this->assertTrue(is_array($collections)); $this->assertTrue(is_array($collections));
$this->assertEquals(0, count($collections)); $this->assertCount(0, $collections);
} }
public function testAddCollections() public function testAddCollections()
...@@ -245,7 +245,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -245,7 +245,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
) )
); );
$collections = $this->distributedSearch->getCollections(); $collections = $this->distributedSearch->getCollections();
$this->assertEquals(3, count($collections)); $this->assertCount(3, $collections);
$this->assertEquals( $this->assertEquals(
array( array(
'collection3' => 'localhost:8983/solr/collection3', 'collection3' => 'localhost:8983/solr/collection3',
...@@ -285,7 +285,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -285,7 +285,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this->distributedSearch->clearReplicas(); $this->distributedSearch->clearReplicas();
$replicas = $this->distributedSearch->getReplicas(); $replicas = $this->distributedSearch->getReplicas();
$this->assertTrue(is_array($replicas)); $this->assertTrue(is_array($replicas));
$this->assertEquals(0, count($replicas)); $this->assertCount(0, $replicas);
} }
public function testAddReplicas() public function testAddReplicas()
...@@ -314,7 +314,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase ...@@ -314,7 +314,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
) )
); );
$replicas = $this->distributedSearch->getReplicas(); $replicas = $this->distributedSearch->getReplicas();
$this->assertEquals(3, count($replicas)); $this->assertCount(3, $replicas);
$this->assertEquals( $this->assertEquals(
array( array(
'replica3' => 'localhost:8983/solr/replica3', 'replica3' => 'localhost:8983/solr/replica3',
......
...@@ -117,8 +117,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase ...@@ -117,8 +117,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase
public function testSetAndGetMinCount() public function testSetAndGetMinCount()
{ {
$this->facet->setMincount(100); $this->facet->setMinCount(100);
$this->assertEquals(100, $this->facet->getMincount()); $this->assertEquals(100, $this->facet->getMinCount());
} }
public function testSetAndGetMissing() public function testSetAndGetMissing()
......
...@@ -157,7 +157,7 @@ class PivotTest extends \PHPUnit_Framework_TestCase ...@@ -157,7 +157,7 @@ class PivotTest extends \PHPUnit_Framework_TestCase
$this->facet->clearStats(); $this->facet->clearStats();
$this->facet->addStats(array('stat1', 'stat2')); $this->facet->addStats(array('stat1', 'stat2'));
$this->facet->removeStat('stat1'); $this->facet->removeStat('stat1');
$this->assertEquals(array('stat2'), $this->facet->getstats()); $this->assertEquals(array('stat2'), $this->facet->getStats());
} }
public function testSetStats() public function testSetStats()
......
...@@ -69,7 +69,7 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase ...@@ -69,7 +69,7 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(2, count($facets)); $this->assertEquals(2, count($facets));
$this->assertEquals($options['prefix'], $this->facetSet->getPrefix()); $this->assertEquals($options['prefix'], $this->facetSet->getPrefix());
$this->assertEquals($options['sort'], $this->facetSet->getSort()); $this->assertEquals($options['sort'], $this->facetSet->getSort());
$this->assertEquals($options['mincount'], $this->facetSet->getMincount()); $this->assertEquals($options['mincount'], $this->facetSet->getMinCount());
$this->assertEquals($options['missing'], $this->facetSet->getMissing()); $this->assertEquals($options['missing'], $this->facetSet->getMissing());
$this->assertEquals($options['extractfromresponse'], $this->facetSet->getExtractFromResponse()); $this->assertEquals($options['extractfromresponse'], $this->facetSet->getExtractFromResponse());
$this->assertEquals($options['contains'], $this->facetSet->getContains()); $this->assertEquals($options['contains'], $this->facetSet->getContains());
...@@ -117,8 +117,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase ...@@ -117,8 +117,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
public function testSetAndGetMinCount() public function testSetAndGetMinCount()
{ {
$this->facetSet->setMincount(100); $this->facetSet->setMinCount(100);
$this->assertEquals(100, $this->facetSet->getMincount()); $this->assertEquals(100, $this->facetSet->getMinCount());
} }
public function testSetAndGetMissing() public function testSetAndGetMissing()
......
...@@ -33,7 +33,6 @@ namespace Solarium\Tests\QueryType\Select\Query\Component\Highlighting; ...@@ -33,7 +33,6 @@ namespace Solarium\Tests\QueryType\Select\Query\Component\Highlighting;
use Solarium\QueryType\Select\Query\Component\Highlighting\Highlighting; use Solarium\QueryType\Select\Query\Component\Highlighting\Highlighting;
use Solarium\QueryType\Select\Query\Component\Highlighting\Field; use Solarium\QueryType\Select\Query\Component\Highlighting\Field;
use Solarium\QueryType\Select\Query\Query;
class FieldTest extends \PHPUnit_Framework_TestCase class FieldTest extends \PHPUnit_Framework_TestCase
{ {
...@@ -101,7 +100,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase ...@@ -101,7 +100,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
public function testSetAndGetFragSize() public function testSetAndGetFragSize()
{ {
$value = 20; $value = 20;
$this->fld->setFragsize($value); $this->fld->setFragSize($value);
$this->assertEquals( $this->assertEquals(
$value, $value,
......
...@@ -294,7 +294,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase ...@@ -294,7 +294,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
public function testSetAndGetFragSize() public function testSetAndGetFragSize()
{ {
$value = 20; $value = 20;
$this->hlt->setFragsize($value); $this->hlt->setFragSize($value);
$this->assertEquals( $this->assertEquals(
$value, $value,
......
...@@ -139,7 +139,7 @@ class StatsTest extends \PHPUnit_Framework_TestCase ...@@ -139,7 +139,7 @@ class StatsTest extends \PHPUnit_Framework_TestCase
{ {
$key = 'f1'; $key = 'f1';
$fld = $this->stats->createField($key, true); $fld = $this->stats->createField($key);
$this->assertEquals( $this->assertEquals(
$key, $key,
......
...@@ -163,7 +163,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase ...@@ -163,7 +163,7 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
public function testWithEdismaxComponent() public function testWithEdismaxComponent()
{ {
$this->query->getEdisMax(); $this->query->getEDisMax();
$request = $this->builder->build($this->query); $request = $this->builder->build($this->query);
$this->assertEquals( $this->assertEquals(
......
...@@ -124,7 +124,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase ...@@ -124,7 +124,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('dummy-qp', $result->getQueryParser()); $this->assertEquals('dummy-qp', $result->getQueryParser());
$this->assertEquals('dummy-oq', $result->getOtherQuery()); $this->assertEquals('dummy-oq', $result->getOtherQuery());
$this->assertEquals(1, count($result->getExplain())); $this->assertCount(1, $result->getExplain());
$doc = $result->getExplain()->getDocument('MA147LL/A'); $doc = $result->getExplain()->getDocument('MA147LL/A');
$this->assertEquals(0.5, $doc->getValue()); $this->assertEquals(0.5, $doc->getValue());
$this->assertEquals(true, $doc->getMatch()); $this->assertEquals(true, $doc->getMatch());
...@@ -146,7 +146,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase ...@@ -146,7 +146,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase
) )
); );
$this->assertEquals(array($expectedDetail), $doc->getDetails()); $this->assertEquals(array($expectedDetail), $doc->getDetails());
$this->assertEquals(1, count($result->getExplainOther())); $this->assertCount(1, $result->getExplainOther());
$doc = $result->getExplainOther()->getDocument('IW-02'); $doc = $result->getExplainOther()->getDocument('IW-02');
$this->assertEquals(0.6, $doc->getValue()); $this->assertEquals(0.6, $doc->getValue());
$this->assertEquals(true, $doc->getMatch()); $this->assertEquals(true, $doc->getMatch());
...@@ -158,10 +158,10 @@ class DebugTest extends \PHPUnit_Framework_TestCase ...@@ -158,10 +158,10 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$timing = $result->getTiming(); $timing = $result->getTiming();
$this->assertEquals(36, $timing->getTime()); $this->assertEquals(36, $timing->getTime());
$this->assertEquals(2, count($timing->getPhases())); $this->assertCount(2, $timing->getPhases());
$phase = $timing->getPhase('process'); $phase = $timing->getPhase('process');
$this->assertEquals(8, $phase->getTime()); $this->assertEquals(8, $phase->getTime());
$this->assertEquals(2, count($phase->getTimings())); $this->assertCount(2, $phase->getTimings());
$this->assertEquals(5, $phase->getTiming('org.apache.solr.handler.component.QueryComponent')); $this->assertEquals(5, $phase->getTiming('org.apache.solr.handler.component.QueryComponent'));
$this->assertEquals(3, $phase->getTiming('org.apache.solr.handler.component.MoreLikeThisComponent')); $this->assertEquals(3, $phase->getTiming('org.apache.solr.handler.component.MoreLikeThisComponent'));
} }
...@@ -183,8 +183,8 @@ class DebugTest extends \PHPUnit_Framework_TestCase ...@@ -183,8 +183,8 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('dummy-qp', $result->getQueryParser()); $this->assertEquals('dummy-qp', $result->getQueryParser());
$this->assertEquals('dummy-oq', $result->getOtherQuery()); $this->assertEquals('dummy-oq', $result->getOtherQuery());
$this->assertEquals(0, count($result->getExplain())); $this->assertCount(0, $result->getExplain());
$this->assertEquals(0, count($result->getExplainOther())); $this->assertCount(0, $result->getExplainOther());
} }
public function testParseNoData() public function testParseNoData()
......
...@@ -76,6 +76,6 @@ class StatsTest extends \PHPUnit_Framework_TestCase ...@@ -76,6 +76,6 @@ class StatsTest extends \PHPUnit_Framework_TestCase
public function testParseNoData() public function testParseNoData()
{ {
$result = $this->parser->parse(null, null, array()); $result = $this->parser->parse(null, null, array());
$this->assertEquals(0, count($result)); $this->assertCount(0, $result);
} }
} }
...@@ -73,13 +73,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase ...@@ -73,13 +73,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase
public function testPropertyEmpty() public function testPropertyEmpty()
{ {
$this->assertTrue( $this->assertEmpty($this->doc->empty_field);
empty($this->doc->empty_field) $this->assertNotEmpty($this->doc->categories);
);
$this->assertFalse(
empty($this->doc->categories)
);
} }
public function testSetField() public function testSetField()
...@@ -124,13 +119,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase ...@@ -124,13 +119,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase
public function testArrayEmpty() public function testArrayEmpty()
{ {
$this->assertTrue( $this->assertEmpty($this->doc['empty_field']);
empty($this->doc['empty_field']) $this->assertNotEmpty($this->doc['categories']);
);
$this->assertFalse(
empty($this->doc['categories'])
);
} }
public function testArraySet() public function testArraySet()
......
...@@ -33,8 +33,4 @@ namespace Solarium\Tests\QueryType\Select\Result; ...@@ -33,8 +33,4 @@ namespace Solarium\Tests\QueryType\Select\Result;
class ResultTest extends AbstractResultTest class ResultTest extends AbstractResultTest
{ {
public function setUp()
{
parent::setUp();
}
} }
...@@ -85,7 +85,7 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase ...@@ -85,7 +85,7 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase
); );
$this->assertEquals($expected, $result['results']); $this->assertEquals($expected, $result['results']);
$this->assertEquals(2, count($result['results'])); $this->assertCount(2, $result['results']);
} }
public function testParseSolr14Format() public function testParseSolr14Format()
...@@ -139,6 +139,6 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase ...@@ -139,6 +139,6 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase
); );
$this->assertEquals($expected, $result['results']); $this->assertEquals($expected, $result['results']);
$this->assertEquals(2, count($result['results'])); $this->assertCount(2, $result['results']);
} }
} }
...@@ -71,7 +71,7 @@ class AddTest extends \PHPUnit_Framework_TestCase ...@@ -71,7 +71,7 @@ class AddTest extends \PHPUnit_Framework_TestCase
} }
try { try {
$doc = new \StdClass(); $doc = new \stdClass;
$this->command->addDocument($doc); $this->command->addDocument($doc);
$this->fail( $this->fail(
......
...@@ -437,11 +437,9 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase ...@@ -437,11 +437,9 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
public function testBuildRollbackXml() public function testBuildRollbackXml()
{ {
$command = new RollbackCommand;
$this->assertEquals( $this->assertEquals(
'<rollback/>', '<rollback/>',
$this->builder->buildRollbackXml($command) $this->builder->buildRollbackXml()
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment