function it_is_not_active_when_non_of_strategies_arent_active(Strategy $strategy1, Strategy $strategy2, Feature $feature, Context $context) { $this->beConstructedWith(array($strategy1, $strategy2)); $strategy1->isActive($feature, $context)->willReturn(false); $strategy2->isActive($feature, $context)->willReturn(false); $this->isActive($feature, $context)->shouldReturn(false); }
/** * @param Context $context * @return bool */ public function isActive(Context $context) { return $this->strategy->isActive($this, $context); }
function it_throws_exception_when_given_context_is_not_found(Repository $repository, Strategy $strategy) { $feature = new Feature('captcha', $strategy->getWrappedObject()); $repository->findByName('captcha')->willReturn($feature); $this->shouldThrow(new ContextNotFoundException("Context with name 'fffuuuu' was not found."))->during('isActive', array('captcha', 'fffuuuu')); }