summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:47 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:47 -0400
commit7e85254903c7c0cb49e381f16b18441ea7b058cc (patch)
treeb22328fcf4c8408fc25a7acb73d1cb1089cd82ac /vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php
parent1de335ad3f395ca6861085393ba366a9e3fb4a0d (diff)
parent1a365e77dfb8825136626202b1df462731b42060 (diff)
Merge commit '1a365e'
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php
new file mode 100644
index 00000000..c07f5da1
--- /dev/null
+++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/NullTest.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Elastica\Test\Transport;
+
+use Elastica\Client;
+use Elastica\Connection;
+use Elastica\Query;
+use Elastica\Test\Base as BaseTest;
+
+/**
+ * Elastica Null Transport Test
+ *
+ * @package Elastica
+ * @author James Boehmer <james.boehmer@jamesboehmer.com>
+ */
+class NullTest extends BaseTest
+{
+
+ public function testEmptyResult()
+ {
+ // Creates a client with any destination, and verify it returns a response object when executed
+ $client = $this->_getClient();
+ $connection = new Connection(array('transport' => 'Null'));
+ $client->setConnections(array($connection));
+
+ $index = $client->getIndex('elasticaNullTransportTest1');
+
+ $resultSet = $index->search(new Query());
+ $this->assertNotNull($resultSet);
+
+ $response = $resultSet->getResponse();
+ $this->assertNotNull($response);
+
+ // Validate most of the expected fields in the response data. Consumers of the response
+ // object have a reasonable expectation of finding "hits", "took", etc
+ $responseData = $response->getData();
+ $this->assertContains("took", $responseData);
+ $this->assertEquals(0, $responseData["took"]);
+ $this->assertContains("_shards", $responseData);
+ $this->assertContains("hits", $responseData);
+ $this->assertContains("total", $responseData["hits"]);
+ $this->assertEquals(0, $responseData["hits"]["total"]);
+ $this->assertContains("params", $responseData);
+
+ $took = $response->getEngineTime();
+ $this->assertEquals(0, $took);
+
+ $errorString = $response->getError();
+ $this->assertEmpty($errorString);
+
+ $shards = $response->getShardsStatistics();
+ $this->assertContains("total", $shards);
+ $this->assertEquals(0, $shards["total"]);
+ $this->assertContains("successful", $shards);
+ $this->assertEquals(0, $shards["successful"]);
+ $this->assertContains("failed", $shards);
+ $this->assertEquals(0, $shards["failed"]);
+ }
+}