public function testIsEnabledSimpleFilterMultiDimArray() { $featureFlag = new FeatureFlag(new Simple(['one' => ['enabled' => true, 'not-enabled' => false]])); $this->assertFalse($featureFlag->isEnabled('enabled')); $this->assertFalse($featureFlag->isEnabled('not-enabled')); $this->assertFalse($featureFlag->isEnabled('not-set')); }
public function testIsEnabledDistributedIpFilterFloat() { $featureFlag = new FeatureFlag(new DistributedIp(0.5)); $this->assertFalse($featureFlag->isEnabled('feature-one', '192.168.1.100')); $this->assertFalse($featureFlag->isEnabled('feature-one', '31.12.127.255')); $this->assertTrue($featureFlag->isEnabled('feature-one', '46.248.224.183')); $this->assertTrue($featureFlag->isEnabled('feature-one', '58.136.218.102')); $featureFlag = new FeatureFlag(new DistributedIp(0.52)); $this->assertFalse($featureFlag->isEnabled('feature-one', '192.168.1.100')); $this->assertTrue($featureFlag->isEnabled('feature-one', '31.12.127.255')); //51, now passes $this->assertTrue($featureFlag->isEnabled('feature-one', '46.248.224.183')); $this->assertTrue($featureFlag->isEnabled('feature-one', '58.136.218.102')); }