本文整理汇总了PHP中PhpSpec\Loader\Node\ExampleNode::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleNode::getTitle方法的具体用法?PHP ExampleNode::getTitle怎么用?PHP ExampleNode::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Loader\Node\ExampleNode
的用法示例。
在下文中一共展示了ExampleNode::getTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_orders_an_array_of_example_nodes(ExampleNode $a, ExampleNode $b, ExampleNode $c)
{
$a->getTitle()->willReturn('bar1');
$b->getTitle()->willReturn('bar2');
$c->getTitle()->willReturn('bar3');
$nodes = [$a, $b, $c];
$expected = [$c, $b, $a];
$this->setSpecificationTitle('foo');
$this->filter($nodes)->shouldReturn($expected);
}
示例2: prepare
/**
* @param ExampleNode $example
* @param SpecificationInterface $context
* @param MatcherManager $matchers
* @param CollaboratorManager $collaborators
*/
public function prepare(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
{
$exampleNum = $this->getExampleNumber($example->getTitle());
$providedData = $this->getDataFromProvider($example);
if (!array_key_exists($exampleNum, $providedData)) {
return;
}
$data = $providedData[$exampleNum];
foreach ($example->getFunctionReflection()->getParameters() as $position => $parameter) {
if (!isset($data[$position])) {
continue;
}
$collaborators->set($parameter->getName(), $data[$position]);
}
}
示例3: PendingException
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();
}
示例4: getTitle
/**
* @return string
*/
public function getTitle()
{
return $this->example->getTitle();
}
示例5:
function it_escapes_unicode_symbols(IO $io, ExampleNode $node)
{
$node->getTitle()->willReturn("Example 0x1234");
$io->write("##teamcity[testIgnored name='Example |0x1234' message='Exception |0x4321!']\n")->shouldBeCalled();
$this->afterExample($this->exampleEvent($node, ExampleEvent::PENDING, 0, 'Exception 0x4321!'));
}