diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-23 13:25:30 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-23 13:25:30 +0300 |
| commit | 9259fbf741f4a080285fbdd8d8586681558c0ab6 (patch) | |
| tree | 67cf776a9ef261f6d62c8f7fe7b217f9d8873ddd /src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php | |
| parent | fc0e71e28e49d9cdc84fadfda40692bdfc415a6c (diff) | |
| download | phorge-elasticsearch-modern-9259fbf741f4a080285fbdd8d8586681558c0ab6.tar.gz phorge-elasticsearch-modern-9259fbf741f4a080285fbdd8d8586681558c0ab6.zip | |
E5 fixup: expand testBuildIndexMappingsShape coverage to body/comment/projectPHID
🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php')
| -rw-r--r-- | src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php index ab6f5c6..979c419 100644 --- a/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php +++ b/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php @@ -113,8 +113,7 @@ final class VyOSElasticModernFulltextStorageEngineTestCase } public function testBuildIndexMappingsShape() { - $engine = id(new VyOSElasticModernFulltextStorageEngine()) - ->setVersion(7); + $engine = $this->newEngine()->setVersion(7); $doc_types = array('TASK', 'DREV'); $fields = array('title', 'body', 'comment'); @@ -127,30 +126,45 @@ final class VyOSElasticModernFulltextStorageEngineTestCase $this->assertFalse(isset($mappings['TASK'])); $this->assertFalse(isset($mappings['DREV'])); - // Field properties exist with the multi-analyzer shape. - $this->assertTrue(isset($mappings['properties']['title'])); - $this->assertEqual('text', $mappings['properties']['title']['type']); - $this->assertTrue( - isset($mappings['properties']['title']['fields']['raw'])); - $this->assertTrue( - isset($mappings['properties']['title']['fields']['keywords'])); - $this->assertTrue( - isset($mappings['properties']['title']['fields']['stems'])); - - // Relationships emit as keyword fields with doc_values:false. - $this->assertEqual( - 'keyword', - $mappings['properties']['authorPHID']['type']); - $this->assertEqual( - false, - $mappings['properties']['authorPHID']['doc_values']); - $this->assertEqual( - 'date', - $mappings['properties']['authorPHID_ts']['type']); + // All three text fields have the multi-analyzer shape. + foreach (array('title', 'body', 'comment') as $field) { + $this->assertTrue( + isset($mappings['properties'][$field]), + pht('Field "%s" missing from mappings.', $field)); + $this->assertEqual( + 'text', + $mappings['properties'][$field]['type'], + pht('Field "%s" should be type text.', $field)); + $this->assertTrue( + isset($mappings['properties'][$field]['fields']['raw']), + pht('Field "%s" missing raw sub-field.', $field)); + $this->assertTrue( + isset($mappings['properties'][$field]['fields']['keywords']), + pht('Field "%s" missing keywords sub-field.', $field)); + $this->assertTrue( + isset($mappings['properties'][$field]['fields']['stems']), + pht('Field "%s" missing stems sub-field.', $field)); + } - // No include_in_all anywhere. - $this->assertFalse( - isset($mappings['properties']['authorPHID']['include_in_all'])); + // Both relationships emit as keyword fields with doc_values:false. + foreach (array('authorPHID', 'projectPHID') as $rel) { + $this->assertEqual( + 'keyword', + $mappings['properties'][$rel]['type'], + pht('Relationship "%s" should be keyword type.', $rel)); + $this->assertEqual( + false, + $mappings['properties'][$rel]['doc_values'], + pht('Relationship "%s" should have doc_values:false.', $rel)); + $this->assertEqual( + 'date', + $mappings['properties'][$rel.'_ts']['type'], + pht('Relationship "%s" missing timestamp field.', $rel)); + // No include_in_all anywhere. + $this->assertFalse( + isset($mappings['properties'][$rel]['include_in_all']), + pht('Relationship "%s" should not have include_in_all.', $rel)); + } // documentType is a keyword field inside properties. $this->assertEqual( |
