Download plugins/FeatureFlags/tests/Integration/FeatureFlagManagerTest.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/FeatureFlags/tests/Integration/FeatureFlagManagerTest.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/plugins/FeatureFlags/tests/Integration/FeatureFlagManagerTest.php
-
curl -L -o FeatureFlagManagerTest.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/FeatureFlags/tests/Integration/FeatureFlagManagerTest.php
1.65 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | |
| */ | |
| namespace Piwik\Plugins\FeatureFlags\tests\Integration; | |
| use PHPUnit\Framework\TestCase; | |
| use Piwik\Plugins\FeatureFlags\FeatureFlagManager; | |
| use Piwik\Plugins\FeatureFlags\Storage\ConfigFeatureFlagStorage; | |
| use Piwik\Plugins\FeatureFlags\tests\Integration\FeatureFlags\FakeFeatureFlag; | |
| use Piwik\Plugins\FeatureFlags\tests\Integration\FeatureFlags\FakeForcedEnabledFeatureFlag; | |
| use Piwik\Tests\Framework\Mock\FakeConfig; | |
| use Piwik\Tests\Framework\Mock\FakeLogger; | |
| class FeatureFlagManagerTests extends TestCase | |
| { | |
| public function testConfigStorageReadsFeatureFlagsCorrectly(): void | |
| { | |
| $config = new FakeConfig(['FeatureFlags' => ['NotReal_feature' => 'enabled']]); | |
| $configFeatureFlagStorage = new ConfigFeatureFlagStorage($config); | |
| $featureFlagManager = new FeatureFlagManager( | |
| [$configFeatureFlagStorage], | |
| new FakeLogger() | |
| ); | |
| $this->assertTrue($featureFlagManager->isFeatureActive(FakeFeatureFlag::class)); | |
| } | |
| public function testForcedFeatureStateOverridesDisabledConfig(): void | |
| { | |
| $config = new FakeConfig(['FeatureFlags' => ['ForcedEnabled_feature' => 'disabled']]); | |
| $configFeatureFlagStorage = new ConfigFeatureFlagStorage($config); | |
| $featureFlagManager = new FeatureFlagManager( | |
| [$configFeatureFlagStorage], | |
| new FakeLogger() | |
| ); | |
| $this->assertTrue($featureFlagManager->isFeatureActive(FakeForcedEnabledFeatureFlag::class)); | |
| } | |
| } | |