/** * Executes a context (i.e. spec or suite). Keeps track of previous * context and will restore it once context has finished running. * * @param AbstractContext $context */ public function execute(AbstractContext $context) { $oldContext = $this->context; $this->context = $context; $context->setUp($this->skipFlag); $this->context = $oldContext; }
public function equals(AbstractContext $context) { return $context instanceof InstanceMethod && $this->getInstance() === $context->getInstance() && $this->getMethodName() === $context->getMethodName(); }
/** * @param AbstractContext $context */ protected function prepareContext(AbstractContext $context) { //defaults $context->setParsers([new StringParser(), new BooleanParser(), new IntegerParser(), new FloatParser(), new DateTimeParser(), new ArrayParser(), new ObjectParser($context)]); //add custom parsers foreach ($this->getParsers() as $parser) { if ($parser instanceof ValueParserInterface) { $context->prependParser($parser); } } //disable parsers foreach ($this->getDisabledParsers() as $disabledParser) { $actualParsers = $context->getParsers(); if (array_key_exists($disabledParser, $actualParsers)) { unset($actualParsers[$disabledParser]); } $context->setParsers($actualParsers); } }
/** * @param Product|null $product */ public function __construct($product = null) { parent::__construct(); $this->product = $product; }
/** @return SmartyBlockContext */ public static function getInstance() { return parent::inst(); }
/** * Thing constructor. Merges extendedStructure up * * @param array $attributes * @param array $extendedStructure */ public function __construct(array $attributes, array $extendedStructure = []) { $this->structure = array_merge($this->structure, $extendedStructure); parent::__construct($attributes); }
/** * @override autocomplete * * @return MemoryUsageOptions */ function inOptions() { return parent::options(); }
/** * @param string $description * @param \Closure $body * @param AbstractContext $parent * @param bool $skip * @param SpecRunner $specRunner */ public function __construct($description, \Closure $body, AbstractContext $parent, SpecRunner $specRunner, $skip = false) { parent::__construct($description, $parent, $skip); $this->body = $body; $this->specRunner = $specRunner; }
/** * @param string $description * @param \Closure $body * @param AbstractContext|null $parent */ public function __construct($description, \Closure $body, AbstractContext $parent = null, $skip = false) { parent::__construct($description, $parent, $skip); $this->body = $body; }