bestit / flagception-bundle

Feature flags on steroids!
MIT License
210 stars 42 forks source link

Provide test helpers for FeatureManager implementation #9

Closed Haehnchen closed 7 years ago

Haehnchen commented 7 years ago

Prevent mocking of interface

    private function createAlwaysTrueFeature(): FeatureManagerInterface
    {
        $feature = $this->createMock(FeatureManagerInterface::class);
        $feature->method('isActive')->with('foobar')->willReturn(true);

        return $feature;
    }

Some ideas

(new AlwaysTrueFeatureManager())->isActive();
(new AlwaysFalseFeatureManager())->isActive();
(new NamedTrueFeatureManager('foobar', 'foobar1'))->isActive('foobar');
migo315 commented 7 years ago

Good idea - i will add / change the tests for the next minor release this weekend.

migo315 commented 7 years ago

I've removed some mocks and use real classes instead now.