/** * Test multiple rules whith one failed */ public function testCheckAllWithOneFailed() { $rule1 = new Rule($this->getAuthorization(false), 'action1'); $rule2 = new Rule($this->getAuthorization(true), 'action2'); $rule3 = new Rule($this->getAuthorization(false), 'action2'); $rule4 = new Rule($this->getAuthorization(true), '*'); $rules = [$rule2, $rule3, $rule4, $rule1]; $this->assertFalse(RuleChecker::checkAll($rules, 'action1', $failed)); $this->assertSame($rule1, $failed); }
/** * Checks all rules * NOTE : Rules with unresolved ResolvableAuthorizationInterface always pass checks * * @return bool Whether or not all check passed */ protected function _checkAllRules() { RuleChecker::checkAll($this->rules, $this->_action, $failedRule); if (is_object($failedRule)) { $this->_unauthorized($failedRule); return false; } return true; }