summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Exception')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/NotImplementedTest.php23
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/PartialShardFailureExceptionTest.php55
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/ResponseExceptionTest.php60
3 files changed, 0 insertions, 138 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/NotImplementedTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/NotImplementedTest.php
deleted file mode 100644
index ff704638..00000000
--- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/NotImplementedTest.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-namespace Elastica\Test\Exception;
-
-use Elastica\Exception\NotImplementedException;
-use Elastica\Test\Base as BaseTest;
-
-class NotImplementedTest extends BaseTest
-{
- public function testInstance()
- {
- $code = 4;
- $message = 'Hello world';
- $exception = new NotImplementedException($message, $code);
-
- $this->assertInstanceOf('Elastica\Exception\NotImplementedException', $exception);
- $this->assertInstanceOf('Elastica\Exception\ExceptionInterface', $exception);
- $this->assertInstanceOf('Exception', $exception);
-
- $this->assertEquals($message, $exception->getMessage());
- $this->assertEquals($code, $exception->getCode());
- }
-}
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/PartialShardFailureExceptionTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/PartialShardFailureExceptionTest.php
deleted file mode 100644
index 31698e26..00000000
--- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/PartialShardFailureExceptionTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-namespace Elastica\Test\Exception;
-
-use Elastica\Document;
-use Elastica\Exception\PartialShardFailureException;
-use Elastica\Query;
-use Elastica\ResultSet;
-use Elastica\Test\Base as BaseTest;
-
-class PartialShardFailureExceptionTest extends BaseTest
-{
-
- public function testPartialFailure()
- {
- $client = $this->_getClient();
- $index = $client->getIndex('elastica_partial_failure');
- $index->create(array(
- 'index' => array(
- 'number_of_shards' => 5,
- 'number_of_replicas' => 0
- )
- ), true);
-
- $type = $index->getType('folks');
-
- $type->addDocument(new Document('', array('name' => 'ruflin')));
- $type->addDocument(new Document('', array('name' => 'bobrik')));
- $type->addDocument(new Document('', array('name' => 'kimchy')));
-
- $index->refresh();
-
- $query = Query::create(array(
- 'query' => array(
- 'filtered' => array(
- 'filter' => array(
- 'script' => array(
- 'script' => 'doc["undefined"] > 8', // compiles, but doesn't work
- ),
- ),
- ),
- ),
- ));
-
- try {
- $index->search($query);
-
- $this->fail('PartialShardFailureException should have been thrown');
- } catch (PartialShardFailureException $e) {
- $resultSet = new ResultSet($e->getResponse(), $query);
- $this->assertEquals(0, count($resultSet->getResults()));
- }
- }
-
-}
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/ResponseExceptionTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/ResponseExceptionTest.php
deleted file mode 100644
index 06b5462b..00000000
--- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/ResponseExceptionTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-namespace Elastica\Test\Exception;
-
-use Elastica\Document;
-use Elastica\Exception\ResponseException;
-use Elastica\Test\Base as BaseTest;
-
-class ResponseExceptionTest extends BaseTest
-{
-
- public function testCreateExistingIndex()
- {
- $this->_createIndex('woo', true);
-
- try {
- $this->_createIndex('woo', false);
- $this->fail('Index created when it should fail');
- } catch (ResponseException $ex) {
- $this->assertEquals('IndexAlreadyExistsException', $ex->getElasticsearchException()->getExceptionName());
- $this->assertEquals(400, $ex->getElasticsearchException()->getCode());
- }
- }
-
- public function testBadType()
- {
- $index = $this->_createIndex('woo');
- $type = $index->getType('test');
-
- $type->setMapping(array(
- 'num' => array(
- 'type' => 'long'
- )
- ));
-
- try {
- $type->addDocument(new Document('', array(
- 'num' => 'not number at all',
- )));
- $this->fail('Indexing with wrong type should fail');
- } catch (ResponseException $ex) {
- $this->assertEquals('MapperParsingException', $ex->getElasticsearchException()->getExceptionName());
- $this->assertEquals(400, $ex->getElasticsearchException()->getCode());
- }
- }
-
- public function testWhatever()
- {
- $index = $this->_createIndex('woo');
- $index->delete();
-
- try {
- $index->search();
- } catch (ResponseException $ex) {
- $this->assertEquals('IndexMissingException', $ex->getElasticsearchException()->getExceptionName());
- $this->assertEquals(404, $ex->getElasticsearchException()->getCode());
- }
- }
-
-}