public getSpecification ( ) : |
||
Résultat |
/** * Run the `beforeSpecification` hook. * * @param \PhpSpec\Event\SpecificationEvent $event * @return void */ public function beforeSpecification(SpecificationEvent $event) { $spec = $event->getSpecification(); if ($spec->getClassReflection()->hasMethod('setLaravel')) { $this->laravel->refreshApplication(); } }
function it_refreshes_the_laravel_framework_before_spec_is_run(Laravel $laravel, SpecificationEvent $event, SpecificationNode $spec, ReflectionClass $refl) { $event->getSpecification()->shouldBeCalled()->willReturn($spec); $spec->getClassReflection()->shouldBeCalled()->willReturn($refl); $refl->hasMethod('setLaravel')->shouldBeCalled()->willReturn(true); $laravel->refreshApplication()->shouldBeCalled(); $this->beforeSpecification($event); }
/** * @param SpecificationEvent $sus * @param Params $param * @param Reporter $reporter */ public function analyse(SpecificationEvent $sus, Params $param, Reporter $reporter) { $class = $sus->getSpecification()->getTitle(); $this->sus = new ReflectionClass($class); $this->param = $param; $this->reporter = $reporter; foreach ($this->detections as $detection) { $detection->check($this->sus, $this->param, $this->reporter); } }
function it_should_analyse_the_number_of_methods_size(SpecificationEvent $specificationEvent, SpecificationNode $specificationNode, Params $params, Reporter $reporter) { $specificationEvent->getSpecification()->willReturn($specificationNode); $specificationNode->getTitle()->willReturn('Elfiggo\\Brobdingnagian\\Detector\\ClassSize'); $this->shouldNotThrow('Elfiggo\\Brobdingnagian\\Exception\\TooManyMethodsDetected'); $params->getClassSize()->willReturn(200); $params->getDependenciesLimit()->willReturn(2); $params->getNumberOfMethods()->willReturn(5); $params->getMethodSize()->willReturn(10); $params->getNumberOfInterfaces()->willReturn(2); $params->getNumberOfTraits()->willReturn(1); $this->analyse($specificationEvent, $params, $reporter); }
public function beforeSpecification(SpecificationEvent $event) { $examplesToAdd = array(); $parser = new Parser(); foreach ($event->getSpecification()->getExamples() as $example) { $dataProviderMethod = $parser->getDataProvider($example->getFunctionReflection()); if (null !== $dataProviderMethod) { if (!$example->getSpecification()->getClassReflection()->hasMethod($dataProviderMethod)) { return false; } $subject = $example->getSpecification()->getClassReflection()->newInstance(); $providedData = $example->getSpecification()->getClassReflection()->getMethod($dataProviderMethod)->invoke($subject); if (is_array($providedData)) { foreach ($providedData as $i => $dataRow) { $examplesToAdd[] = new ExampleNode($i + 1 . ') ' . $example->getTitle(), $example->getFunctionReflection()); } } } } foreach ($examplesToAdd as $example) { $event->getSpecification()->addExample($example); } }
/** * @param SpecificationEvent $event */ public function beforeSpecification(SpecificationEvent $event) { $this->currentSpecificationTitle = $event->getSpecification()->getTitle(); }
function it_outputs_undefined_progress_on_afterexample_event(SpecificationEvent $specEvent, ExampleEvent $exampleEvent, ExampleNode $example, SpecificationNode $spec, IO $io, StatisticsCollector $stats) { $specEvent->getSpecification()->willReturn($spec); $exampleEvent->getExample()->willReturn($example); $example->getTitle()->willReturn('foobar'); $exampleEvent->getResult()->willReturn(999); $spec->getTitle()->willReturn('spec1'); $this->beforeSpecification($specEvent); $this->afterExample($exampleEvent); $expected = "not ok 1 - spec1: foobar\n ---\n message: 'The example result type was unknown to formatter'\n severity: fail\n ..."; $io->writeln($expected)->shouldHaveBeenCalled(); }
public function beforeSpecification(SpecificationEvent $event) { $this->getIO()->writeln(sprintf("\n %s\n", $event->getSpecification()->getTitle()), 0); }
/** * Run the `beforeSpecification` hook. * * @param \PhpSpec\Event\SpecificationEvent $event * @return void */ public function beforeSpecification(SpecificationEvent $event) { $spec = $event->getSpecification(); $refl = $spec->getClassReflection(); }
public function afterSpecification(SpecificationEvent $event) { $this->finished('Suite', $event->getSpecification()->getTitle()); }
public function afterSpecification(SpecificationEvent $event) { $node = $event->getSpecification(); $resource = $node->getResource(); $this->logger->logSpecification($resource->getSrcFilename(), $node->getTitle(), $node->getClassReflection()->name, $resource->getSrcClassname()); }
public function afterSpecification(SpecificationEvent $event) { $this->safelyFreeProperties($event->getSpecification()); }
public function beforeSpecification(SpecificationEvent $event) { $specFilename = $event->getSpecification()->getClassReflection()->getFileName(); $specClass = $event->getSpecification()->getClassReflection()->getName(); $this->getIO()->writeln($this->teamCityMessage('testSuiteStarted', array('name' => $event->getTitle(), 'locationHint' => "file://{$specFilename}::\\{$specClass}"))); }