/**
  * @param string $key
  * @param bool $status
  * @return Feature
  */
 public static function buildFeature($key, $status)
 {
     $feature = new Feature($key);
     if ($status) {
         $feature->addSwitcher(Simple::on());
     }
     return $feature;
 }
 /**
  * @test
  */
 public function addFeature_enabled()
 {
     $featureSwitch = $this->getClass();
     $featureSwitch->addFeature($featureSwitch::buildFeature('foo', true));
     $feature = new FeatureSwitch\Feature('bar2');
     $feature->addSwitcher(new FeatureSwitch\Feature\Switcher\AB());
     $featureSwitch->addFeature($feature);
     $this->assertTrue($featureSwitch->isEnabled('foo'));
 }
 /**
  * @test
  */
 public function noSwitcher()
 {
     $feature = new Feature('test');
     $this->assertFalse($feature->isEnabled());
 }
Beispiel #4
0
 /**
  * @test
  */
 public function readmeTest_after()
 {
     $feature = new Feature('foo_bar_feature_key');
     $feature->addSwitcher(new Until(\DateTime::createFromFormat('Y-m-d H:i:s', date('Y-m-d H:i:s', time() - 10)), false));
     $this->assertTrue($feature->isEnabled());
 }