예제 #1
0
 public function testResolveIsPassedContext()
 {
     $name = "test.condition.callable.resolve-context";
     $feature = new Feature($name, new CallableCondition(function (array $context) : bool {
         return $context["resolve"];
     }));
     $this->assertTrue($feature->isEnabled(["resolve" => true]));
     $this->assertFalse($feature->isEnabled(["resolve" => false]));
 }
예제 #2
0
 public function testIsEnabledPassesContext()
 {
     $condition = new CallableCondition(function (array $context) : bool {
         return $context["resolve"];
     });
     $feature = new Feature("test.is-enabled.context", $condition);
     $this->assertTrue($feature->isEnabled(["resolve" => true]));
     $this->assertFalse($feature->isEnabled(["resolve" => false]));
 }
예제 #3
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testResolveThrowsOnInvalidStrategy()
 {
     $name = "test.condition.callable.resolve-throws";
     $feature = new Feature($name, new VotingCondition(0, []));
     $feature->isEnabled([]);
 }