featureFlagChecker = $this->createMock(FeatureFlagChecker::class); $this->search = $this->createMock(SearchInterface::class); $this->advancedSearchChecker = new AdvancedSearchChecker(); $this->advancedSearchChecker->setServiceLocator( $this->getServiceLocatorMock( [ FeatureFlagChecker::class => $this->featureFlagChecker, SearchProxy::SERVICE_ID => $this->search, ] ) ); } /** * @dataProvider isEnabledDataProvider */ public function testIsEnabled(bool $advancedSearchDisabled, bool $supportsCustomIndex, bool $expected): void { $this->featureFlagChecker ->expects(static::once()) ->method('isEnabled') ->willReturn($advancedSearchDisabled); $this->search ->method('supportCustomIndex') ->willReturn($supportsCustomIndex); $this->assertEquals($expected, $this->advancedSearchChecker->isEnabled()); } public function isEnabledDataProvider(): array { return [ [ 'advancedSearchDisabled' => true, 'supportsCustomIndex' => true, 'expected' => false, ], [ 'advancedSearchDisabled' => false, 'supportsCustomIndex' => false, 'expected' => false, ], [ 'advancedSearchDisabled' => false, 'supportsCustomIndex' => true, 'expected' => true, ], [ 'advancedSearchDisabled' => true, 'supportsCustomIndex' => false, 'expected' => false, ], ]; } }