subject = new ResultSetMapper( [ ResultSetMapper::OPTION_STRUCTURE_MAP => [ 'default' => [ 'label' => [ 'id' => 'label', 'label' => __('Label'), 'sortable' => false ] ], 'results' => [ 'default' => null, 'advanced' => [ 'test_taker' => [ 'id' => 'test_taker', 'label' => 'Test Taker', 'sortable' => false ], 'label' => [ 'id' => 'label', 'label' => 'Label', 'sortable' => false ], 'test_taker_name' => [ 'id' => 'test_taker_name', 'label' => 'Test Taker', 'sortable' => false ], ], ], ] ] ); $this->advancedSearchChecker = $this->createMock(AdvancedSearchChecker::class); $this->subject->setServiceLocator( $this->getServiceLocatorMock( [ AdvancedSearchChecker::class => $this->advancedSearchChecker ] ) ); } /** * @dataProvider getScenariosData */ public function testGetPromiseModelResults(array $expectedResult, string $mappedField, bool $elasticSearchEnabled): void { $this->advancedSearchChecker ->expects($this->once()) ->method('isEnabled') ->willReturn($elasticSearchEnabled); $result = $this->subject->map($mappedField); $this->assertEquals($expectedResult, $result); } public function getScenariosData() { return [ 'result search with elastic search enabled' => [ [ 'label' => [ 'id' => 'label', 'label' => __('Label'), 'sortable' => false ], 'test_taker_name' => [ 'id' => 'test_taker_name', 'label' => __('Test Taker'), 'sortable' => false ], 'test_taker' => [ 'id' => 'test_taker', 'label' => __('Test Taker'), 'sortable' => false ], ], 'results', true, ], 'result search with elastic search disabled' => [ [ 'label' => [ 'id' => 'label', 'label' => __('Label'), 'sortable' => false ], ], 'results', false, ], 'different search with elastic search enabled' => [ [ 'label' => [ 'id' => 'label', 'label' => __('Label'), 'sortable' => false ], ], 'different', true, ] ]; } }