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])); }
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])); }
/** * @expectedException \InvalidArgumentException */ public function testResolveThrowsOnInvalidStrategy() { $name = "test.condition.callable.resolve-throws"; $feature = new Feature($name, new VotingCondition(0, [])); $feature->isEnabled([]); }