From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- .../test/lib/Elastica/Test/ExampleTest.php | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/ExampleTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/ExampleTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/ExampleTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/ExampleTest.php new file mode 100644 index 00000000..efdc04eb --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/ExampleTest.php @@ -0,0 +1,61 @@ +_getClient(); + $index = $client->getIndex('ruflin'); + $type = $index->getType('users'); + + $id = 2; + $data = array('firstname' => 'Nicolas', 'lastname' => 'Ruflin'); + $doc = new Document($id, $data); + + $type->addDocument($doc); + } + + /** + * @group functional + */ + public function testExample() + { + // Creates a new index 'xodoa' and a type 'user' inside this index + $client = $this->_getClient(); + $index = $client->getIndex('elastica_test'); + $index->create(array(), true); + + $type = $index->getType('user'); + + // Adds 1 document to the index + $doc1 = new Document(1, + array('username' => 'hans', 'test' => array('2', '3', '5')) + ); + $type->addDocument($doc1); + + // Adds a list of documents with _bulk upload to the index + $docs = array(); + $docs[] = new Document(2, + array('username' => 'john', 'test' => array('1', '3', '6')) + ); + $docs[] = new Document(3, + array('username' => 'rolf', 'test' => array('2', '3', '7')) + ); + $type->addDocuments($docs); + + // Refresh index + $index->refresh(); + + $resultSet = $type->search('rolf'); + } +} -- cgit v1.2.3-54-g00ecf