diff options
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php index 16362140..aab37615 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Filter/PrefixTest.php @@ -1,14 +1,16 @@ <?php - namespace Elastica\Test\Filter; use Elastica\Document; use Elastica\Filter\Prefix; -use Elastica\Type\Mapping; use Elastica\Test\Base as BaseTest; +use Elastica\Type\Mapping; class PrefixTest extends BaseTest { + /** + * @group unit + */ public function testToArray() { $field = 'name'; @@ -18,30 +20,21 @@ class PrefixTest extends BaseTest $expectedArray = array( 'prefix' => array( - $field => $prefix - ) + $field => $prefix, + ), ); $this->assertequals($expectedArray, $filter->toArray()); } + /** + * @group functional + */ public function testDifferentPrefixes() { $client = $this->_getClient(); $index = $client->getIndex('test'); - /*$indexParams = array( - 'analysis' => array( - 'analyzer' => array( - 'lw' => array( - 'type' => 'custom', - 'tokenizer' => 'keyword', - 'filter' => array('lowercase') - ) - ), - ) - );*/ - $index->create(array(), true); $type = $index->getType('test'); @@ -50,17 +43,13 @@ class PrefixTest extends BaseTest ) ); $type->setMapping($mapping); - - $doc = new Document(1, array('name' => 'Basel-Stadt')); - $type->addDocument($doc); - $doc = new Document(2, array('name' => 'New York')); - $type->addDocument($doc); - $doc = new Document(3, array('name' => 'Baden')); - $type->addDocument($doc); - $doc = new Document(4, array('name' => 'Baden Baden')); - $type->addDocument($doc); - $doc = new Document(5, array('name' => 'New Orleans')); - $type->addDocument($doc); + $type->addDocuments(array( + new Document(1, array('name' => 'Basel-Stadt')), + new Document(2, array('name' => 'New York')), + new Document(3, array('name' => 'Baden')), + new Document(4, array('name' => 'Baden Baden')), + new Document(5, array('name' => 'New Orleans')), + )); $index->refresh(); @@ -86,6 +75,9 @@ class PrefixTest extends BaseTest $this->assertEquals(0, $resultSet->count()); } + /** + * @group functional + */ public function testDifferentPrefixesLowercase() { $client = $this->_getClient(); @@ -97,10 +89,10 @@ class PrefixTest extends BaseTest 'lw' => array( 'type' => 'custom', 'tokenizer' => 'keyword', - 'filter' => array('lowercase') - ) + 'filter' => array('lowercase'), + ), ), - ) + ), ); $index->create($indexParams, true); @@ -112,16 +104,13 @@ class PrefixTest extends BaseTest ); $type->setMapping($mapping); - $doc = new Document(1, array('name' => 'Basel-Stadt')); - $type->addDocument($doc); - $doc = new Document(2, array('name' => 'New York')); - $type->addDocument($doc); - $doc = new Document(3, array('name' => 'Baden')); - $type->addDocument($doc); - $doc = new Document(4, array('name' => 'Baden Baden')); - $type->addDocument($doc); - $doc = new Document(5, array('name' => 'New Orleans')); - $type->addDocument($doc); + $type->addDocuments(array( + new Document(1, array('name' => 'Basel-Stadt')), + new Document(2, array('name' => 'New York')), + new Document(3, array('name' => 'Baden')), + new Document(4, array('name' => 'Baden Baden')), + new Document(5, array('name' => 'New Orleans')), + )); $index->refresh(); |