当前位置: 首页>>代码示例>>PHP>>正文


PHP ExampleNode::getSpecification方法代码示例

本文整理汇总了PHP中PhpSpec\Loader\Node\ExampleNode::getSpecification方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleNode::getSpecification方法的具体用法?PHP ExampleNode::getSpecification怎么用?PHP ExampleNode::getSpecification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpSpec\Loader\Node\ExampleNode的用法示例。


在下文中一共展示了ExampleNode::getSpecification方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 /**
  * @param ExampleNode            $example
  * @param SpecificationInterface $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function prepare(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $spec = $example->getSpecification()->getClassReflection()->newInstance();
     $beforeMethod = $example->getSpecification()->getClassReflection()->getMethod($this->beforeMethod);
     $this->createMissingCollabolators($collaborators, $beforeMethod);
     $beforeMethod->invokeArgs($spec, $collaborators->getArgumentsFor($beforeMethod));
 }
开发者ID:coduo,项目名称:phpspec-prepare-extension,代码行数:13,代码来源:BeforeMaintainer.php

示例2: teardown

 /**
  * @param ExampleNode            $example
  * @param SpecificationInterface $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function teardown(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     if (!$example->getSpecification()->getClassReflection()->hasMethod('letgo')) {
         return;
     }
     $reflection = $example->getSpecification()->getClassReflection()->getMethod('letgo');
     $reflection->invokeArgs($context, $collaborators->getArgumentsFor($reflection));
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:14,代码来源:LetAndLetgoMaintainer.php

示例3: prepare

 /**
  * Generates DI related stuff via parameter validator
  *
  * @param ExampleNode $example
  * @param Specification $context
  * @param MatcherManager $matchers
  * @param CollaboratorManager $collaborators
  *
  * @return $this
  */
 public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     if ($example->getSpecification()->getClassReflection()->hasMethod('let')) {
         $this->parameterValidator->validate($example->getSpecification()->getClassReflection()->getMethod('let'));
     }
     $this->parameterValidator->validate($example->getFunctionReflection());
     return $this;
 }
开发者ID:ecomdev,项目名称:phpspec-magento-di-adapter,代码行数:18,代码来源:CollaboratorMaintainer.php

示例4: prepare

 /**
  * @param ExampleNode            $example
  * @param Specification $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $subjectFactory = new Wrapper($matchers, $this->presenter, $this->dispatcher, $example, $this->accessInspector);
     $subject = $subjectFactory->wrap(null);
     $subject->beAnInstanceOf($example->getSpecification()->getResource()->getSrcClassname());
     $context->setSpecificationSubject($subject);
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:13,代码来源:SubjectMaintainer.php

示例5: prepare

 /**
  * @param ExampleNode            $example
  * @param SpecificationInterface $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function prepare(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $this->prophet = new Prophet(null, $this->unwrapper, null);
     $classRefl = $example->getSpecification()->getClassReflection();
     if ($classRefl->hasMethod('let')) {
         $this->generateCollaborators($collaborators, $classRefl->getMethod('let'));
     }
     $this->generateCollaborators($collaborators, $example->getFunctionReflection());
 }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:15,代码来源:CollaboratorsMaintainer.php

示例6:

 function it_prepares_the_subject(ExampleNode $example, ObjectBehavior $context, MatcherManager $matchers, CollaboratorManager $collaborators, SpecificationNode $specification, ResourceInterface $resource, VarienWrapper $wrapper, Subject $subject, $factory)
 {
     $factory->create(Argument::cetera())->willReturn($wrapper);
     $wrapper->wrap(null)->willReturn($subject);
     $subject->beAnInstanceOf('\\stdObject');
     $subject = $subject->getWrappedObject();
     $resource->getSrcClassname()->willReturn('\\stdObject');
     $specification->getResource()->willReturn($resource);
     $example->getSpecification()->willReturn($specification);
     $context->setSpecificationSubject($subject)->shouldBeCalled();
     $this->prepare($example, $context, $matchers, $collaborators);
 }
开发者ID:kbulloch,项目名称:MageSpec_vm,代码行数:12,代码来源:VarienSubjectMaintainerSpec.php

示例7: prepareExampleBeforeAnnotation

    function prepareExampleBeforeAnnotation(ExampleNode $exampleNode, \ReflectionMethod $method, SpecificationNode $specificationNode, \ReflectionClass $specClass)
    {
        $exampleNode->getFunctionReflection()->willReturn($method);
        $method->getDocComment()->willReturn(<<<ANNOTATION
/**
 * @before prepareMethod
 */
ANNOTATION
);
        $exampleNode->getSpecification()->willReturn($specificationNode);
        $specificationNode->getClassReflection()->willReturn($specClass);
    }
开发者ID:coduo,项目名称:phpspec-prepare-extension,代码行数:12,代码来源:BeforeMaintainerSpec.php

示例8: let

 function let(Laravel $laravel, ExampleNode $example, SpecificationInterface $context)
 {
     $this->beConstructedWith($laravel);
     $p = new Prophet();
     $this->refMethod = $p->prophesize('ReflectionMethod');
     $this->refMethod->invokeArgs(Argument::type('PhpSpec\\SpecificationInterface'), Argument::type('array'))->shouldBeCalled();
     $refClass = $p->prophesize('ReflectionClass');
     $refClass->hasMethod('setLaravel')->willReturn(true);
     $refClass->hasMethod('setLaravel')->shouldBeCalled();
     $refClass->getMethod('setLaravel')->willReturn($this->refMethod->reveal());
     $refClass->getMethod('setLaravel')->shouldBeCalled();
     $specNode = $p->prophesize('PhpSpec\\Loader\\Node\\SpecificationNode');
     $specNode->getClassReflection()->willReturn($refClass->reveal());
     $example->getSpecification()->willReturn($specNode->reveal());
 }
开发者ID:SkysoulDesign,项目名称:TempArk,代码行数:15,代码来源:LaravelMaintainerSpec.php

示例9:

 function it_does_pass_regular_example_into_parameter_validator_and_let_method_if_they_are_defined(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators, SpecificationNode $specificationNode, \ReflectionClass $reflectionClass)
 {
     $example->getSpecification()->willReturn($specificationNode);
     $specificationNode->getClassReflection()->willReturn($reflectionClass);
     $reflectionClass->hasMethod('let')->willReturn(true);
     $exampleClosureReflection = new \ReflectionFunction(function () {
     });
     $letClosureReflection = new \ReflectionFunction(function () {
     });
     $reflectionClass->getMethod('let')->willReturn($letClosureReflection)->shouldBeCalled();
     $example->getFunctionReflection()->willReturn($exampleClosureReflection)->shouldBeCalled();
     $this->parameterValidator->validate($letClosureReflection)->shouldBeCalled();
     $this->parameterValidator->validate($exampleClosureReflection)->shouldBeCalled();
     $this->prepare($example, $context, $matchers, $collaborators)->shouldReturn($this);
 }
开发者ID:ecomdev,项目名称:phpspec-magento-di-adapter,代码行数:15,代码来源:CollaboratorMaintainerSpec.php

示例10: array

 function it_runs_let_and_letgo_maintainer_before_and_after_each_example_if_the_example_throws_an_exception(ExampleNode $example, SpecificationNode $specification, ReflectionClass $specReflection, $context, ReflectionMethod $exampReflection, LetAndLetgoMaintainer $maintainer, SpecificationInterface $context)
 {
     $example->isPending()->willReturn(false);
     $example->getFunctionReflection()->willReturn($exampReflection);
     $example->getSpecification()->willReturn($specification);
     $specification->getClassReflection()->willReturn($specReflection);
     $specReflection->newInstanceArgs()->willReturn($context);
     $exampReflection->getParameters()->willReturn(array());
     $exampReflection->invokeArgs($context, array())->willThrow('RuntimeException');
     $maintainer->getPriority()->willReturn(1);
     $maintainer->supports($example)->willReturn(true);
     $maintainer->prepare($example, Argument::cetera())->shouldBeCalled();
     $maintainer->teardown($example, Argument::cetera())->shouldBeCalled();
     $this->registerMaintainer($maintainer);
     $this->run($example);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:16,代码来源:ExampleRunnerSpec.php

示例11: getIterators

 private function getIterators(ExampleNode $example)
 {
     $classRefl = $example->getSpecification()->getClassReflection();
     if ($classRefl->hasMethod('let')) {
         foreach ($classRefl->getMethod('let')->getParameters() as $parameter) {
             if ($this->isIterator($parameter->getClass())) {
                 (yield $parameter->getName() => $parameter->getClass()->getName());
             }
         }
     }
     foreach ($example->getFunctionReflection()->getParameters() as $parameter) {
         if ($this->isIterator($parameter->getClass())) {
             (yield $parameter->getName() => $parameter->getClass()->getName());
         }
     }
 }
开发者ID:docteurklein,项目名称:event-store,代码行数:16,代码来源:Maintainer.php

示例12: getSuite

 /**
  * @return \PhpSpec\Loader\Suite
  */
 public function getSuite()
 {
     return $this->example->getSpecification()->getSuite();
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:7,代码来源:MethodCallEvent.php

示例13: prepare

 /**
  * {@inheritdoc}
  */
 public function prepare(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $reflection = $example->getSpecification()->getClassReflection()->getMethod('setLumen');
     $reflection->invokeArgs($context, array($this->lumen));
 }
开发者ID:josborne,项目名称:phpspec-lumen,代码行数:8,代码来源:LumenMaintainer.php

示例14: prepare

 /**
  * {@inheritdoc}
  */
 public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $reflection = $example->getSpecification()->getClassReflection()->getMethod('setLaravel');
     $reflection->invokeArgs($context, [$this->laravel]);
 }
开发者ID:benconstable,项目名称:phpspec-laravel,代码行数:8,代码来源:LaravelMaintainer.php

示例15: supports

 public function supports(ExampleNode $example)
 {
     return $example->getSpecification()->getResource() instanceof ModelResource;
 }
开发者ID:kbulloch,项目名称:MageSpec_vm,代码行数:4,代码来源:VarienSubjectMaintainer.php


注:本文中的PhpSpec\Loader\Node\ExampleNode::getSpecification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。