コード例 #1
0
ファイル: ContextStack.php プロジェクト: jlippitt/tusk
 /**
  * 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;
 }
コード例 #2
0
ファイル: InstanceMethod.php プロジェクト: tomaszdurka/mocka
 public function equals(AbstractContext $context)
 {
     return $context instanceof InstanceMethod && $this->getInstance() === $context->getInstance() && $this->getMethodName() === $context->getMethodName();
 }
コード例 #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);
     }
 }
コード例 #4
0
ファイル: ProductContext.php プロジェクト: uuf6429/rune
 /**
  * @param Product|null $product
  */
 public function __construct($product = null)
 {
     parent::__construct();
     $this->product = $product;
 }
コード例 #5
0
ファイル: SmartyBlockContext.php プロジェクト: ilivanoff/www
 /** @return SmartyBlockContext */
 public static function getInstance()
 {
     return parent::inst();
 }
コード例 #6
0
ファイル: Thing.php プロジェクト: Torann/json-ld
 /**
  * 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);
 }
コード例 #7
0
 /**
  * @override autocomplete
  *
  * @return MemoryUsageOptions
  */
 function inOptions()
 {
     return parent::options();
 }
コード例 #8
0
ファイル: Spec.php プロジェクト: jlippitt/tusk
 /**
  * @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;
 }
コード例 #9
0
ファイル: Suite.php プロジェクト: jlippitt/tusk
 /**
  * @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;
 }