PhpSpec\Loader\Node\ExampleNode::getLineNumber PHP Method

getLineNumber() public method

public getLineNumber ( ) : integer
return integer
    public function getLineNumber()
    {
        return $this->function->isClosure() ? 0 : $this->function->getStartLine();
    }

Usage Example

Ejemplo n.º 1
0
 function it_outputs_exceptions_for_failed_examples(SuiteEvent $event, ExampleEvent $pendingEvent, ConsoleIO $io, StatisticsCollector $stats, SpecificationNode $specification, ExampleNode $example)
 {
     $example->getLineNumber()->willReturn(37);
     $example->getTitle()->willReturn('it tests something');
     $pendingEvent->getException()->willReturn(new PendingException());
     $pendingEvent->getSpecification()->willReturn($specification);
     $pendingEvent->getExample()->willReturn($example);
     $stats->getEventsCount()->willReturn(1);
     $stats->getFailedEvents()->willReturn(array());
     $stats->getBrokenEvents()->willReturn(array());
     $stats->getPendingEvents()->willReturn(array($pendingEvent));
     $stats->getSkippedEvents()->willReturn(array());
     $stats->getTotalSpecs()->willReturn(1);
     $stats->getCountsHash()->willReturn(array('passed' => 0, 'pending' => 1, 'skipped' => 0, 'failed' => 0, 'broken' => 0));
     $this->afterSuite($event);
     $expected = '<lineno>  37</lineno>  <pending>- it tests something</pending>';
     $io->writeln($expected)->shouldHaveBeenCalled();
 }