@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 64 lines 1.5 kB view raw
1<?php 2 3/** 4 * Configurable test object for implementing Policy unit tests. 5 */ 6final class PhabricatorPolicyTestObject 7 extends Phobject 8 implements 9 PhabricatorPolicyInterface, 10 PhabricatorExtendedPolicyInterface { 11 12 private $phid; 13 private $capabilities = array(); 14 private $policies = array(); 15 private $automaticCapabilities = array(); 16 private $extendedPolicies = array(); 17 18 public function setPHID($phid) { 19 $this->phid = $phid; 20 return $this; 21 } 22 23 public function getPHID() { 24 return $this->phid; 25 } 26 27 public function getCapabilities() { 28 return $this->capabilities; 29 } 30 31 public function getPolicy($capability) { 32 return idx($this->policies, $capability); 33 } 34 35 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 36 $auto = idx($this->automaticCapabilities, $capability, array()); 37 return idx($auto, $viewer->getPHID()); 38 } 39 40 public function setCapabilities(array $capabilities) { 41 $this->capabilities = $capabilities; 42 return $this; 43 } 44 45 public function setPolicies(array $policy_map) { 46 $this->policies = $policy_map; 47 return $this; 48 } 49 50 public function setAutomaticCapabilities(array $auto_map) { 51 $this->automaticCapabilities = $auto_map; 52 return $this; 53 } 54 55 public function setExtendedPolicies(array $extended_policies) { 56 $this->extendedPolicies = $extended_policies; 57 return $this; 58 } 59 60 public function getExtendedPolicy($capability, PhabricatorUser $viewer) { 61 return idx($this->extendedPolicies, $capability, array()); 62 } 63 64}