Best Mockery code snippet using NoArgs
Attribute.php
Source:Attribute.php
1<?php2/**3 * Classes and functions for the template engine.4 *5 * @author The phpLDAPadmin development team6 * @package phpLDAPadmin7 */8/**9 * Represents an attribute of a template.10 *11 * @package phpLDAPadmin12 * @subpackage Templates13 */14class Attribute {15 # Attribute Name16 public $name;17 # Source of this attribute definition18 protected $source;19 # Current and Old Values20 protected $oldvalues = array();21 protected $values = array();22 # MIN/MAX number of values23 protected $min_value_count = -1;24 protected $max_value_count = -1;25 # Is the attribute internal26 protected $internal = false;27 # Has the attribute been modified28 protected $modified = false;29 # Is the attribute being deleted because of an object class removal30 protected $forcedelete = false;31 # Is the attribute visible32 protected $visible = false;33 protected $forcehide = false;34 # Is the attribute modifiable35 protected $readonly = false;36 # LDAP attribute type MUST/MAY37 protected $ldaptype = null;38 # Attribute property type (eg password, select, multiselect)39 protected $type = '';40 # Attribute value to keep unique41 protected $unique = false;42 # Display parameters43 protected $display = '';44 protected $icon = '';45 protected $hint = '';46 # Helper details47 protected $helper = array();48 protected $helpervalue = array();49 # Onchange details50 protected $onchange = array();51 # Show spacer after this attribute is rendered52 protected $spacer = false;53 protected $verify = false;54 # Component size55 protected $size = 0;56 # Value max length57 protected $maxlength = 0;58 # Text Area sizings59 protected $cols = 0;60 protected $rows = 0;61 # Public for sorting62 public $page = 1;63 public $order = 255;64 public $ordersort = 255;65 public $rdn = false;66 # Schema Aliases for this attribute (stored in lowercase)67 protected $aliases = array();68 # Configuration for automatically generated values69 protected $autovalue = array();70 protected $postvalue = array();71 public function __construct($name,$values,$server_id,$source=null) {72 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))73 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);74 $server = $_SESSION[APPCONFIG]->getServer($server_id);75 $sattr = $server->getSchemaAttribute($name);76 if ($sattr) {77 $this->name = $sattr->getName(false);78 $this->setLDAPdetails($sattr);79 } else80 $this->name = $name;81 $this->source = $source;82 # XML attributes are shown by default83 switch ($source) {84 case 'XML': $this->show();85 $this->setXML($values);86 break;87 default:88 if (! isset($values['values']))89 debug_dump_backtrace('no index "values"',1);90 $this->initValue($values['values']);91 }92 # Should this attribute be hidden93 if ($server->isAttrHidden($this->name))94 $this->forcehide = true;95 # Should this attribute value be read only96 if ($server->isAttrReadOnly($this->name))97 $this->readonly = true;98 # Should this attribute value be unique99 if ($server->isAttrUnique($this->name))100 $this->unique = true;101 }102 /**103 * Return the name of the attribute.104 *105 * @param boolean $lower - Return the attribute in normal or lower case (default lower)106 * @param boolean $real - Return the real attribute name (with ;binary, or just the name)107 * @return string Attribute name108 */109 public function getName($lower=true,$real=false) {110 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))111 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);112 if ($real)113 return $lower ? strtolower($this->name) : $this->name;114 else115 return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name();116 }117 public function getValues() {118 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))119 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->values);120 return $this->values;121 }122 public function getOldValues() {123 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))124 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oldvalues);125 return $this->oldvalues;126 }127 public function getValueCount() {128 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))129 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->values);130 return count($this->values);131 }132 public function getSource() {133 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))134 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->source);135 return $this->source;136 }137 /**138 * Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set.139 */140 public function autoValue($new_val) {141 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))142 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);143 if ($this->values)144 return;145 $this->values = $new_val;146 }147 public function initValue($new_val) {148 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))149 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);150 if ($this->values || $this->oldvalues) {151 debug_dump(array('new_val'=>$new_val,'this'=>$this));152 debug_dump_backtrace('new and/or old values are set',1);153 }154 $this->values = $new_val;155 }156 public function clearValue() {157 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))158 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);159 $this->values = array();160 }161 public function setOldValue($val) {162 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))163 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);164 $this->oldvalues = $val;165 }166 public function setValue($new_val) {167 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))168 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);169 if ($this->values) {170 if ($this->values == $new_val)171 return;172 if ($this->oldvalues) {173 debug_dump($this);174 debug_dump_backtrace('old values are set',1);175 } else176 $this->oldvalues = $this->values;177 }178 if ($new_val == $this->values)179 return;180 $this->values = $new_val;181 $this->justModified();182 }183 public function addValue($new_val,$i=-1) {184 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))185 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);186 if ($i < 0)187 $i = $this->getValueCount();188 $old_val = $this->getValue($i);189 if (is_null($old_val) || ($old_val != $new_val))190 $this->justModified();191 $this->values[$i] = $new_val;192 }193 public function delValue($i=-1) {194 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))195 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);196 if ($i < 0)197 $this->setValue(array());198 if (! $this->hasBeenModified())199 $this->oldvalues = $this->values;200 if (isset($this->values[$i])) {201 unset($this->values[$i]);202 $this->values = array_values($this->values);203 $this->justModified();204 }205 }206 public function getValue($i) {207 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))208 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);209 if (isset($this->values[$i]))210 return $this->values[$i];211 else212 return null;213 }214 public function getOldValue($i) {215 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))216 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);217 if (isset($this->oldvalues[$i]))218 return $this->oldvalues[$i];219 else220 return null;221 }222 public function getMinValueCount() {223 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))224 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->min_value_count);225 return $this->min_value_count;226 }227 public function setMinValueCount($min) {228 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))229 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);230 $this->min_value_count = $min;231 }232 public function getMaxValueCount() {233 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))234 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->max_value_count);235 return $this->max_value_count;236 }237 public function setMaxValueCount($max) {238 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))239 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);240 $this->max_value_count = $max;241 }242 public function haveMoreValues() {243 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))244 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);245 if ($this->getMaxValueCount() < 0 || ($this->getValueCount() < $this->getMaxValueCount()))246 return true;247 else248 return false;249 }250 public function justModified() {251 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))252 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);253 $this->modified = true;254 }255 public function hasBeenModified() {256 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))257 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->modified);258 return $this->modified;259 }260 public function isForceDelete() {261 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))262 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->forcedelete);263 return $this->forcedelete;264 }265 public function setForceDelete() {266 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))267 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);268 $this->forcedelete = true;269 $this->oldvalues = $this->values;270 $this->values = array();271 $this->justModified();272 }273 public function isInternal() {274 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))275 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->internal);276 return $this->internal;277 }278 public function setInternal() {279 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))280 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);281 $this->internal = true;282 }283 public function isRequired() {284 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))285 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);286 if ($this->getMinValueCount() > 0)287 return true;288 elseif ($this->ldaptype == 'must')289 return true;290 elseif ($this->isRDN())291 return true;292 else293 return false;294 }295 public function isMay() {296 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))297 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);298 if (($this->ldaptype == 'may') && ! $this->isRequired())299 return true;300 else301 return false;302 }303 public function setType($type) {304 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))305 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);306 $this->type = strtolower($type);307 }308 public function getType() {309 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))310 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type);311 return $this->type;312 }313 public function setLDAPtype($type) {314 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))315 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);316 $this->ldaptype = strtolower($type);317 }318 public function getLDAPtype() {319 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))320 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->ldaptype);321 return $this->ldaptype;322 }323 public function setProperties($properties) {324 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))325 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);326 foreach ($properties as $index => $value) {327 if ($index == 'maxvalnb') {328 $this->setMaxValueCount($value);329 continue;330 } elseif ($index == 'minvalnb') {331 $this->setMinValueCount($value);332 continue;333 } elseif ($index == 'maxlength') {334 $this->setMinValueCount($value);335 continue;336 } elseif ($index == 'hidden') {337 $this->visible = $value;338 continue;339 } elseif (in_array($index,array('cols','rows'))) {340 # @todo To be implemented341 continue;342 }343 if (isset($this->$index))344 $this->$index = $value;345 else {346 debug_dump($this);347 debug_dump_backtrace(sprintf('Unknown property (%s) with value (%s) for (%s)',$index,$value,$this->getName()),1);348 }349 }350 }351 public function setRequired() {352 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))353 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);354 if ($this->getMinValueCount() <= 0)355 $this->setMinValueCount(1);356 }357 public function setOptional() {358 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))359 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);360 $this->setMinValueCount(0);361 }362 public function isReadOnly() {363 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))364 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->readonly);365 return $this->readonly;366 }367 public function setReadOnly() {368 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))369 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);370 $this->readonly = true;371 }372 public function isVisible() {373 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))374 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);375 return $this->visible && (! $this->forcehide);376 }377 public function hide() {378 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))379 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);380 $this->visible = false;381 }382 public function show() {383 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))384 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);385 $this->visible = true;386 }387 public function haveFriendlyName() {388 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))389 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);390 return $_SESSION[APPCONFIG]->haveFriendlyName($this);391 }392 public function getFriendlyName() {393 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))394 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->display);395 if ($this->display)396 return $this->display;397 else398 return $_SESSION[APPCONFIG]->getFriendlyName($this);399 }400 public function setDescription($description) {401 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))402 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);403 $this->description = $description;404 }405 public function getDescription() {406 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))407 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description);408 return $this->description;409 }410 public function setIcon($icon) {411 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))412 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);413 $this->icon = $icon;414 }415 public function getIcon() {416 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))417 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon);418 return $this->icon ? sprintf('%s/%s',IMGDIR,$this->icon) : '';419 }420 public function getHint() {421 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))422 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->hint);423 return $this->hint;424 }425 public function setHint($hint) {426 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))427 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);428 $this->hint = $hint;429 }430 public function getMaxLength() {431 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))432 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->maxlength);433 return $this->maxlength;434 }435 public function setMaxLength($maxlength) {436 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))437 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);438 $this->maxlength = $maxlength;439 }440 public function getSize() {441 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))442 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->size);443 return $this->size;444 }445 public function setSize($size) {446 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))447 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);448 $this->size = $size;449 }450 public function getSpacer() {451 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))452 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->spacer);453 return $this->spacer;454 }455 public function getPage() {456 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))457 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->page);458 return $this->page;459 }460 public function setPage($page) {461 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))462 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);463 $this->page = $page;464 }465 public function getOnChange() {466 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))467 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->onchange);468 return $this->onchange;469 }470 public function getHelper() {471 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))472 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helper);473 return $this->helper;474 }475 public function getHelperValue() {476 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))477 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helpervalue);478 return $this->helpervalue;479 }480 public function getVerify() {481 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))482 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->verify);483 return $this->verify;484 }485 public function setRDN($rdn) {486 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))487 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);488 $this->rdn = $rdn;489 }490 /**491 * Return if this attribute is an RDN attribute492 *493 * @return boolean494 */495 public function isRDN() {496 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))497 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->rdn);498 return $this->rdn;499 }500 /**501 * Capture all the LDAP details we are interested in502 *503 * @param sattr Schema Attribute504 */505 private function setLDAPdetails($sattr) {506 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))507 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);508 # By default, set this as a MAY attribute, later processing should make it a MUST attribute if it is.509 if (! $this->ldaptype)510 $this->ldaptype = 'may';511 # Store our Aliases512 foreach ($sattr->getAliases() as $alias)513 array_push($this->aliases,strtolower($alias));514 if ($sattr->getIsSingleValue())515 $this->setMaxValueCount(1);516 }517 /**518 * Return a list of aliases for this Attribute (as defined by the schema)519 * This list will be lowercase.520 */521 public function getAliases() {522 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))523 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->aliases);524 return $this->aliases;525 }526 public function getAutoValue() {527 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))528 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->autovalue);529 return $this->autovalue;530 }531 public function getPostValue() {532 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))533 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->postvalue);534 return $this->postvalue;535 }536 public function setPostValue($postvalue) {537 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))538 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);539 $this->postvalue = $postvalue;540 }541 public function setXML($values) {542 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))543 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);544 # Mostly all the time, this should be an array545 if (is_array($values))546 foreach ($values as $index => $value)547 switch ($index) {548 # Helpers should be accompanied with a <post> attribute.549 case 'helper':550 if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))551 system_message(array(552 'title'=>sprintf('%s [<i>%s</i>]',_('Missing [post] setting in XML file'),$index),553 'body'=>_('[helper] needs an accompanying [post] action.'),554 'type'=>'warn'));555 if (isset($value['value']) && ! is_array($value['value']) && preg_match('/^=php\.(\w+)\((.*)\)$/',$value['value'],$matches)) {556 $this->helpervalue['function'] = $matches[1];557 $this->helpervalue['args'] = $matches[2];558 unset ($value['value']);559 }560 foreach ($value as $i => $detail) {561 if (! in_array($i,array('default','display','id','value'))) {562 if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))563 system_message(array(564 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i),565 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail),566 'type'=>'warn'));567 unset($value[$i]);568 }569 }570 $this->$index = $value;571 break;572 case 'hidden': $value ? $this->visible = false : $this->visible = true;573 break;574 case 'spacer': $value ? $this->$index = true : $this->$index = false;575 break;576 # Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type.577 case 'type':578 if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))579 system_message(array(580 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),581 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),582 'type'=>'warn'));583 break;584 case 'post':585 if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) {586 $this->postvalue['function'] = $matches[1];587 $this->postvalue['args'] = $matches[2];588 } else589 if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))590 system_message(array(591 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),592 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),593 'type'=>'warn'));594 case 'value':595 if (is_array($value))596 $this->values = $value;597 else598 # Check to see if the value is auto generated.599 if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) {600 $this->autovalue['function'] = $matches[1];601 $this->autovalue['args'] = $matches[2];602 # We'll add a hint too603 if (! $this->hint)604 $this->hint = _('Automatically determined');605 } else606 $this->values = array($value);607 break;608 # Queries609 case 'ordersort':610 # Creation/Editing Templates611 case 'cols':612 case 'default':613 case 'display':614 case 'hint':615 case 'icon':616 case 'maxlength':617 case 'onchange':618 case 'order':619 case 'page':620 case 'readonly':621 case 'rows':622 case 'size':623 case 'values':624 case 'verify': $this->$index = $value;625 break;626 case 'max':627 if ($this->getMaxValueCount() == -1)628 $this->setMaxValueCount($value);629 default:630 if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))631 system_message(array(632 'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),633 'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)),634 'type'=>'warn'));635 }636 elseif (is_string($values) && (strlen($values) > 0))637 $this->values = array($values);638 }639 /**640 * Display the values removed in an attribute.641 */642 public function getRemovedValues() {643 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))644 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);645 $return = array();646 foreach ($this->getOldValues() as $value)647 if (! in_array($value,$this->getValues()))648 array_push($return,$value);649 return $return;650 }651 /**652 * Display the values removed in an attribute.653 */654 public function getAddedValues() {655 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))656 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);657 $return = array();658 foreach ($this->getValues() as $value)659 if (! in_array($value,$this->getOldValues()))660 array_push($return,$value);661 return $return;662 }663 /**664 * Prunes off anything after the ";" in an attr name. This is useful for665 * attributes that may have ";binary" appended to their names. With666 * real_attr_name(), you can more easily fetch these attributes' schema667 * with their "real" attribute name.668 *669 * @param string $attr_name The name of the attribute to examine.670 * @return string671 */672 private function real_attr_name() {673 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))674 debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);675 return preg_replace('/;.*$/U','',$this->name);676 }677 /**678 * Does this attribute need supporting JS679 */680 public function needJS($type=null) {681 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))682 debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);683 if (is_null($type)) {684 foreach (array('focus','blur','validate') as $type)685 if ($this->needJS($type))686 return true;687 return false;688 } elseif ($type == 'focus') {689 # We dont have any focus javascript routines.690 return false;691 } elseif ($type == 'blur') {692 if ($this->onchange || $this->isRequired())693 return true;694 else695 return false;696 } elseif ($type == 'validate') {697 if ($this->isRequired())698 return true;699 else700 return false;701 } else702 debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1);703 }704}705?>...
TreeItem.php
Source:TreeItem.php
1<?php2/**3 * Classes and functions for the LDAP tree.4 *5 * @author The phpLDAPadmin development team6 * @package phpLDAPadmin7 */8/**9 * Represents an item in the tree.10 *11 * @package phpLDAPadmin12 * @subpackage Tree13 */14class TreeItem {15 # This entry's DN16 protected $dn;17 # The server this entry belongs to.18 private $server_id;19 # The objectclasses in LDAP, used to deterimine the icon and template20 protected $objectclasses = array();21 # Is this a base entry?22 private $base_entry = false;23 # Array of dn - the children24 private $children = array();25 # An icon file path26 protected $icon;27 # Is the entry a leaf?28 private $leaf = false;29 # Is the node open?30 private $open = false;31 # Is the size of children limited?32 private $size_limited = true;33 # Last template used to edit this entry34 private $template = null;35 # Do we need to sort the children36 private $childsort = true;37 # Are we reading the children38 private $reading_children = false;39 public function __construct($server_id,$dn) {40 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))41 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);42 $this->server_id = $server_id;43 $this->dn = $dn;44 }45 /**46 * Get the DN of this tree item.47 *48 * @return DN The DN of this item.49 */50 public function getDN() {51 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))52 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->dn);53 return $this->dn;54 }55 /**56 * Get the RDN of this tree items DN.57 *58 * @return RDN The RDN of this items DN.59 */60 public function getRDN() {61 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))62 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);63 return get_rdn($this->getDn(),0,true);64 }65 /**66 * Set this item as a LDAP base DN item.67 */68 public function setBase() {69 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))70 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);71 $this->base_entry = true;72 }73 /**74 * Return if this item is a base DN item.75 */76 public function isBaseDN() {77 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))78 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->base_entry);79 return $this->base_entry;80 }81 public function setObjectClasses($oc) {82 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))83 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);84 $this->objectclasses = $oc;85 }86 public function getObjectClasses() {87 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))88 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->objectclasses);89 return $this->objectclasses;90 }91 public function isInLDAP() {92 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))93 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);94 return count($this->objectclasses) ? true : false;95 }96 /**97 * Returns null if the children have never be defined98 * or an array of the dn of the children99 */100 public function getChildren() {101 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))102 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->children);103 if ($this->childsort && ! $this->reading_children) {104 usort($this->children,'pla_compare_dns');105 $this->childsort = false;106 }107 return $this->children;108 }109 public function readingChildren($bool) {110 $this->reading_children = $bool;111 }112 /**113 * Do the children require resorting114 */115 public function isChildSorted() {116 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))117 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->childsort);118 return $this->childsort;119 }120 /**121 * Mark the children as sorted122 */123 public function childSorted() {124 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))125 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);126 $this->childsort = false;127 }128 /**129 * Add a child to this DN entry.130 *131 * @param DN The DN to add.132 */133 public function addChild($dn) {134 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))135 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);136 if (in_array($dn,$this->children))137 return;138 array_push($this->children,$dn);139 $this->childsort = true;140 }141 /**142 * Delete a child from this DN entry.143 *144 * @param DN The DN to add.145 */146 public function delChild($dn) {147 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))148 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);149 if ($this->children) {150 # If the parent hasnt been opened in the tree, then there wont be any children.151 $index = array_search($dn,$this->children);152 if ($index !== false)153 unset($this->children[$index]);154 }155 }156 /**157 * Rename this DN.158 *159 * @param DN The DN to rename to.160 */161 public function rename($dn) {162 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))163 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);164 $this->dn = $dn;165 }166 /**167 * Return if this item has been opened.168 */169 public function isOpened() {170 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))171 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->open);172 return $this->open;173 }174 /**175 * Mark this node as closed.176 */177 public function close() {178 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))179 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);180 $this->open = false;181 }182 /**183 * Opens the node ; the children of the node must have been defined184 */185 public function open() {186 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))187 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);188 $this->open = true;189 }190 /**191 * Mark this node as a leaf.192 */193 public function setLeaf() {194 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))195 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);196 $this->leaf = true;197 }198 /**199 * Return if this node is a leaf.200 */201 public function isLeaf() {202 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))203 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->leaf);204 return $this->leaf;205 }206 /**207 * Returns the path of the icon file used to represent this node ;208 * If the icon hasnt been set, it will call get_icon()209 */210 public function getIcon() {211 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))212 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon);213 if (! $this->icon)214 $this->icon = get_icon($this->server_id,$this->dn,$this->objectclasses);215 return $this->icon;216 }217 /**218 * Mark this node as a size limited (it wont have all its children).219 */220 public function setSizeLimited() {221 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))222 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);223 $this->size_limited = true;224 }225 /**226 * Clear the size limited flag.227 */228 public function unsetSizeLimited() {229 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))230 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);231 $this->size_limited = false;232 }233 /**234 * Return if this node has hit an LDAP size limit (and thus doesnt have all its children).235 */236 public function isSizeLimited() {237 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))238 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);239 return $this->size_limited;240 }241 public function setTemplate($template) {242 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))243 debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);244 $this->template = $template;245 }246 public function getTemplate() {247 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))248 debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);249 return $this->template;250 }251}252?>...
NoArgs
Using AI Code Generation
1$mockery = new Mockery();2$mockery->mock('NoArgs');3$mockery = new Mockery();4$mockery->mock('NoArgs');5$mockery = new Mockery();6$mockery->mock('NoArgs');7$mockery = new Mockery();8$mockery->mock('NoArgs');9$mockery = new Mockery();10$mockery->mock('NoArgs');11$mockery = new Mockery();12$mockery->mock('NoArgs');13$mockery = new Mockery();14$mockery->mock('NoArgs');15$mockery = new Mockery();16$mockery->mock('NoArgs');17$mockery = new Mockery();18$mockery->mock('NoArgs');19$mockery = new Mockery();20$mockery->mock('NoArgs');21$mockery = new Mockery();22$mockery->mock('NoArgs');23$mockery = new Mockery();24$mockery->mock('NoArgs');25$mockery = new Mockery();26$mockery->mock('NoArgs');27$mockery = new Mockery();28$mockery->mock('NoArgs');29$mockery = new Mockery();
NoArgs
Using AI Code Generation
1use Mockery\Adapter\Phpunit\MockeryTestCase;2{3 public function testNoArgs()4 {5 $mock = \Mockery::mock('NoArgs');6 $mock->shouldReceive('foo')->withNoArgs();7 $mock->foo();8 }9}10use Mockery\Adapter\Phpunit\MockeryTestCase;11{12 public function testNoArgs()13 {14 $mock = \Mockery::mock('NoArgs');15 $mock->shouldReceive('foo')->withNoArgs();16 $mock->foo(1);17 }18}19Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_0_NoArgs::foo(). Either the method was unexpected or its arguments matched no expected argument list for this method20Mockery\Exception\InvalidCountException: Method foo() from Mockery_0_NoArgs should be called
NoArgs
Using AI Code Generation
1$mock = Mockery::mock('NoArgs');2$mock = Mockery::mock('NoArgs');3$mock = Mockery::mock('NoArgs');4$mock = Mockery::mock('NoArgs');5$mock = Mockery::mock('NoArgs');6$mock = Mockery::mock('NoArgs');7$mock = Mockery::mock('NoArgs');8$mock = Mockery::mock('NoArgs');9$mock = Mockery::mock('NoArgs');10$mock = Mockery::mock('NoArgs');11$mock = Mockery::mock('NoArgs');12$mock = Mockery::mock('NoArgs');13$mock = Mockery::mock('NoArgs');14$mock = Mockery::mock('NoArgs');15$mock = Mockery::mock('NoArgs');16$mock = Mockery::mock('NoArgs');17$mock = Mockery::mock('NoArgs');18$mock = Mockery::mock('NoArgs');19$mock = Mockery::mock('NoArgs');20$mock = Mockery::mock('NoArgs');21$mock = Mockery::mock('NoArgs');22$mock = Mockery::mock('
NoArgs
Using AI Code Generation
1use \Mockery\Adapter\Phpunit\MockeryTestCase;2{3 public function testNoArgs()4 {5 $mock = \Mockery::mock('NoArgs');6 $mock->shouldReceive('noArgs')->once()->andReturn('foo');7 $this->assertEquals('foo', $mock->noArgs());8 }9}10use \Mockery\Adapter\Phpunit\MockeryTestCase;11{12 public function testNoArgs()13 {14 $mock = \Mockery::mock('NoArgs');15 $mock->shouldReceive('noArgs')->once()->andReturn('foo');16 $this->assertEquals('foo', $mock->noArgs());17 }18}19use \Mockery\Adapter\Phpunit\MockeryTestCase;20{21 public function testNoArgs()22 {23 $mock = \Mockery::mock('NoArgs');24 $mock->shouldReceive('noArgs')->once()->andReturn('foo');25 $this->assertEquals('foo', $mock->noArgs());26 }27}28use \Mockery\Adapter\Phpunit\MockeryTestCase;29{30 public function testNoArgs()31 {32 $mock = \Mockery::mock('NoArgs');33 $mock->shouldReceive('noArgs')->once()->andReturn('foo');34 $this->assertEquals('foo', $mock->noArgs());35 }36}37use \Mockery\Adapter\Phpunit\MockeryTestCase;38{39 public function testNoArgs()40 {41 $mock = \Mockery::mock('NoArgs');42 $mock->shouldReceive('noArgs')->once()->andReturn('foo');43 $this->assertEquals('foo', $mock->noArgs());44 }45}46use \Mockery\Adapter\Phpunit\MockeryTestCase;47{
NoArgs
Using AI Code Generation
1$mock = Mockery::mock('NoArgs');2$mock->shouldReceive('foo')->once()->andReturn('bar');3echo $mock->foo();4$mock = Mockery::mock('NoArgs');5$mock->shouldReceive('foo')->once()->andReturn('baz');6echo $mock->foo();7The solution to this problem is to use the Mockery::mock('NoArgs[foo]') syntax. The [foo] syntax tells Mockery that you want to mock the foo method on the NoArgs class. The code below will work as expected:8$mock = Mockery::mock('NoArgs[foo]');9$mock->shouldReceive('foo')->once()->andReturn('bar');10echo $mock->foo();11$mock = Mockery::mock('NoArgs[foo]');12$mock->shouldReceive('foo')->once()->andReturn('baz');13echo $mock->foo();
NoArgs
Using AI Code Generation
1use Mockery\Adapter\Phpunit\MockeryTestCase;2use Mockery\MockInterface;3use NoArgs;4{5 private $noArgs;6 public function test1()7 {8 $this->noArgs = \Mockery::mock(NoArgs::class);9 $this->noArgs->shouldReceive('execute')10 ->once()11 ->andReturn(true);12 $this->assertTrue($this->noArgs->execute());13 }14}15use Mockery\Adapter\Phpunit\MockeryTestCase;16use Mockery\MockInterface;17use NoArgs;18{19 private $noArgs;20 public function test2()21 {22 $this->noArgs = \Mockery::mock(NoArgs::class);23 $this->noArgs->shouldReceive('execute')24 ->once()25 ->andReturn(true);26 $this->assertTrue($this->noArgs->execute());27 }28}29use Mockery\Adapter\Phpunit\MockeryTestCase;30use Mockery\MockInterface;31use NoArgs;32{33 private $noArgs;34 public function test3()35 {36 $this->noArgs = \Mockery::mock(NoArgs::class);37 $this->noArgs->shouldReceive('execute')38 ->once()39 ->andReturn(true);40 $this->assertTrue($this->noArgs->execute());41 }42}43... 3 / 3 (100%)44OK (3 tests, 3 assertions)45... 3 / 3 (100%)46OK (3 tests, 3 assertions)
NoArgs
Using AI Code Generation
1use Mockery as m;2use NoArgs;3{4 public function testMethod()5 {6 $mock = m::mock('NoArgs');7 $mock->shouldReceive('someMethod')->once();8 $mock->someMethod();9 }10}11use Mockery as m;12use NoArgs;13{14 public function testMethod()15 {16 $mock = m::mock('NoArgs');17 $mock->shouldReceive('someMethod')->once();18 $mock->someMethod();19 }20}21require_once '2.php';22use Mockery as m;23use NoArgs;24{25 public function testMethod()26 {27 $mock = m::mock('NoArgs');28 $mock->shouldReceive('someMethod')->once();29 $mock->someMethod();30 }31}32use Mockery as m;33use NoArgs;34{35 public function testMethod()36 {37 $mock = m::mock('NoArgs');38 $mock->shouldReceive('someMethod')->once();39 $mock->someMethod();40 }41}
NoArgs
Using AI Code Generation
1require_once 'vendor/autoload.php';2use Mockery as m;3{4 public function __construct()5 {6 echo 'Hello';7 }8}9$mock = m::mock('NoArgs');10$mock->shouldReceive('foo')->once()->andReturn('bar');11echo $mock->foo();12require_once 'vendor/autoload.php';13use Mockery as m;14{15 public function __construct()16 {17 echo 'Hello';18 }19}20$mock = m::mock('NoArgs');21$mock->shouldReceive('foo')->once()->andReturn('bar');22echo $mock->foo();23$states = DB::table('states')->orderBy('state')->lists('state', 'id');24return View::make('user.create')->with('states', $states);25$states = DB::table('states')->orderBy('state')->lists('state', 'id');26$states = array('' => 'Select a State') + $states;27return View::make('user.create')->with('states', $states);28function random_string($length)29{30 $str = "";31 $characters = array_merge(range('A','Z'), range('a','z'), range('0','9'));32 $max = count($characters) - 1;33 for ($i = 0; $i < $length; $i++) {34 $rand = mt_rand(0, $max);
NoArgs
Using AI Code Generation
1$noArgs = Mockery::mock('NoArgs');2$noArgs->shouldReceive('foo')->with('bar');3$noArgs->foo('bar');4$noArgs = Mockery::mock('NoArgs');5$noArgs->shouldReceive('foo')->with('bar');6$noArgs->foo('bar');
NoArgs
Using AI Code Generation
1$mock = Mockery::mock('NoArgs');2$mock->shouldReceive('foo')->once();3$mock->shouldReceive('foo')->with(1)->once();4$mock->shouldReceive('bar')->with(1)->once();5$mock->shouldReceive('baz')->with(1)->once();6$mock = Mockery::mock('NoArgs');7$mock->shouldReceive('foo')->with(1)->once();8$mock->shouldReceive('bar')->with(1)->once();9$mock->shouldReceive('baz')->with(1)->once();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.
Test now for FreeGet 100 minutes of automation test minutes FREE!!