/**
  * Test that GetFailedAuthorizationRules returns rules whith failed authorizations with the specified type
  */
 public function testGetFailedAuthorizationRulesWithType()
 {
     $rule1 = new Rule($this->getAuthorization(false), 'action1', RuleType::accessibility);
     $rule2 = new Rule($this->getAuthorization(true), 'action2');
     $rule3 = new Rule($this->getAuthorization(true), 'action1');
     $rule4 = new Rule($this->getAuthorization(false), '*', RuleType::visibility);
     $rules = [$rule1, $rule2, $rule3, $rule4];
     $this->assertSame([$rule1], RuleChecker::getFailedAuthorizationRules($rules, RuleType::accessibility));
     $this->assertSame([$rule4], RuleChecker::getFailedAuthorizationRules($rules, RuleType::visibility));
 }
 /**
  * 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;
 }
 /**
  * Returns unauthorized finders
  * @return array
  */
 protected function _getUnauthorizedFinders()
 {
     $finders = [];
     foreach (RuleChecker::getFailedAuthorizationRules($this->rules, RuleType::finder) as $rule) {
         $finders = array_merge($finders, $rule->authorizedValues);
     }
     $finders = array_unique($finders);
     return $finders;
 }