eZ\Publish\Core\Search\Tests\FieldNameResolverTest::testGetIndexFieldNameDefaultSortField PHP Method

testGetIndexFieldNameDefaultSortField() public method

    public function testGetIndexFieldNameDefaultSortField()
    {
        $mockedFieldNameResolver = $this->getMockedFieldNameResolver(array('getSearchableFieldMap'));
        $indexFieldType = $this->getIndexFieldTypeMock();
        $searchFieldTypeMock = $this->getSearchFieldTypeMock();
        $this->fieldRegistryMock->expects($this->once())->method('getType')->with('field_type_identifier')->will($this->returnValue($indexFieldType));
        $indexFieldType->expects($this->once())->method('getDefaultSortField')->will($this->returnValue('field_name'));
        $indexFieldType->expects($this->once())->method('getIndexDefinition')->will($this->returnValue(array('field_name' => $searchFieldTypeMock)));
        $this->fieldNameGeneratorMock->expects($this->once())->method('getName')->with('field_name', 'field_definition_identifier', 'content_type_identifier')->will($this->returnValue('generated_field_name'));
        $this->fieldNameGeneratorMock->expects($this->once())->method('getTypedName')->with('generated_field_name', $this->isInstanceOf('eZ\\Publish\\SPI\\Search\\FieldType'))->will($this->returnValue('generated_typed_field_name'));
        $fieldName = $mockedFieldNameResolver->getIndexFieldName(new ArrayObject(), 'content_type_identifier', 'field_definition_identifier', 'field_type_identifier', null, true);
        $this->assertEquals('generated_typed_field_name', key($fieldName));
    }