Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 public function equals(AbstractContext $context)
 {
     return $context instanceof InstanceMethod && $this->getInstance() === $context->getInstance() && $this->getMethodName() === $context->getMethodName();
 }
Exemplo n.º 3
0
 /**
  * @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);
     }
 }
Exemplo n.º 4
0
 /**
  * @param Product|null $product
  */
 public function __construct($product = null)
 {
     parent::__construct();
     $this->product = $product;
 }
Exemplo n.º 5
0
 /** @return SmartyBlockContext */
 public static function getInstance()
 {
     return parent::inst();
 }
Exemplo n.º 6
0
 /**
  * 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);
 }
Exemplo n.º 7
0
 /**
  * @override autocomplete
  *
  * @return MemoryUsageOptions
  */
 function inOptions()
 {
     return parent::options();
 }
Exemplo n.º 8
0
 /**
  * @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;
 }
Exemplo n.º 9
0
 /**
  * @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;
 }