public function SupportedGroupingFieldsTest::testSupportedGroupingFields in Search API Grouping 8
Test if an integer field has the info message in the label.
File
- tests/
src/ Unit/ SupportedGroupingFieldsTest.php, line 88
Class
- SupportedGroupingFieldsTest
- Test the getSupportedFields method.
Namespace
Drupal\Tests\search_api_grouping\UnitCode
public function testSupportedGroupingFields() {
$fields = [];
$field = $this
->getMockBuilder(FieldInterface::class)
->disableOriginalConstructor()
->getMock();
$field
->method('getType')
->willReturn('integer');
$field
->method('getLabel')
->willReturn('Content Type');
$fields[] = $field;
$this->index
->method('getFields')
->willReturn($fields);
$this->processor
->setIndex($this->index);
$fields = $this->processor
->getSupportedFields();
$this
->assertEquals('Content Type (Converted to string for indexing)', $fields['field_options'][0]);
$this
->assertArrayNotHasKey(2, $fields['field_sorts']);
}