本文整理汇总了PHP中PhpSpec\Event\ExampleEvent::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleEvent::getTitle方法的具体用法?PHP ExampleEvent::getTitle怎么用?PHP ExampleEvent::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Event\ExampleEvent
的用法示例。
在下文中一共展示了ExampleEvent::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CurrentExampleTracker
function it_should_call_afterCurrentExample(ExampleEvent $example)
{
$currentExample = new CurrentExampleTracker();
$currentExample->setCurrentExample(null);
$example->getTitle()->willReturn(null);
$this->afterCurrentExample($example);
$example->getTitle()->shouldNotHaveBeenCalled();
}
示例2: afterExample
public function afterExample(ExampleEvent $event)
{
$type = $this->map[$event->getResult()];
$this->addResult($type, $event->getSpecification(), $event->getTitle());
if ($this->coverage) {
$this->coverage->stop();
}
}
示例3: array
function it_writes_a_fail_message_for_a_failing_example(Template $template, ExampleEvent $event, Presenter $presenter)
{
$event->getTitle()->willReturn(self::EVENT_TITLE);
$event->getMessage()->willReturn(self::EVENT_MESSAGE);
$event->getBacktrace()->willReturn(self::$BACKTRACE);
$event->getException()->willReturn(new \Exception());
$template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => self::EVENT_TITLE, 'message' => self::EVENT_MESSAGE, 'backtrace' => self::BACKTRACE, 'code' => self::CODE, 'index' => 1, 'specification' => 1))->shouldBeCalled();
$presenter->presentException(Argument::cetera())->willReturn(self::CODE);
$this->write(1);
}
示例4: ExceptionStub
function it_stores_a_testcase_node_after_failed_example_run(ExampleEvent $event, SpecificationNode $specification, \ReflectionClass $refClass)
{
$event->getResult()->willReturn(ExampleEvent::FAILED);
$event->getTitle()->willReturn('example title');
$event->getTime()->willReturn(1337);
$event->getException()->willReturn(new ExceptionStub('Something went wrong', 'Exception trace'));
$event->getSpecification()->willReturn($specification);
$specification->getClassReflection()->willReturn($refClass);
$refClass->getName()->willReturn('Acme\\Foo\\Bar');
$this->afterExample($event);
$this->getTestCaseNodes()->shouldReturn(array('<testcase name="example title" time="1337" classname="Acme\\Foo\\Bar" status="failed">' . "\n" . '<failure type="spec\\PhpSpec\\Formatter\\ExceptionStub" message="Something went wrong" />' . "\n" . '<system-err>' . "\n" . '<![CDATA[' . "\n" . 'Exception trace' . "\n" . ']]>' . "\n" . '</system-err>' . "\n" . '</testcase>'));
}
示例5: SkippingException
function it_stores_a_testcase_node_after_skipped_example_run(ExampleEvent $event, SpecificationNode $specification, \ReflectionClass $refClass)
{
$event->getResult()->willReturn(ExampleEvent::SKIPPED);
$event->getTitle()->willReturn('example title');
$event->getTime()->willReturn(1337);
$event->getException()->willReturn(new SkippingException('zog zog'));
$event->getSpecification()->willReturn($specification);
$specification->getClassReflection()->willReturn($refClass);
$refClass->getName()->willReturn('Acme\\Foo\\Bar');
$this->afterExample($event);
// skipped tag is escaped because a skipped tag is also registered in the console formatter
$this->getTestCaseNodes()->shouldReturn(array('<testcase name="example title" time="1337.000000" classname="Acme\\Foo\\Bar" status="skipped">' . "\n" . '\\<skipped><![CDATA[ skipped: zog zog ]]>\\</skipped>' . "\n" . '</testcase>'));
}
示例6: let
function let(SpecificationNode $specificationNode, ExampleEvent $exampleEvent, ServiceContainer $container, CodeCoverageSession $coverageSession)
{
$r = new \ReflectionClass(__CLASS__);
$specificationNode->getClassReflection()->willReturn($r);
$specificationNode->getTitle()->willReturn('Specification');
$exampleEvent->getSpecification()->willReturn($specificationNode);
$exampleEvent->getTitle()->willReturn('it should do something');
$this->cwd = getcwd();
chdir(sys_get_temp_dir());
$container->get('coverage.session')->willReturn($coverageSession);
$this->setCoverageRunner($coverageSession);
$this->load($container);
}
示例7: afterExample
/**
* @param ExampleEvent $event
*/
public function afterExample(ExampleEvent $event)
{
$io = $this->getIO();
$output = ob_get_clean();
if ($output) {
$io->writeln($this->teamCityMessage("testStdOut", array("name" => $event->getTitle(), "out" => "Test Output\n>>>>>>>>>>>\n{$output}\n<<<<<<<<<<<\n")));
}
switch ($event->getResult()) {
case ExampleEvent::PASSED:
break;
case ExampleEvent::PENDING:
$io->writeln($this->teamCityMessage('testIgnored', array('name' => $event->getTitle(), 'details' => $event->getMessage())));
break;
case ExampleEvent::FAILED:
$io->writeln($this->teamCityMessage('testFailed', array('name' => $event->getTitle(), 'message' => "Failed Test\n\n" . $event->getMessage(), 'details' => $event->getException()->getTraceAsString())));
break;
case ExampleEvent::BROKEN:
$io->writeln($this->teamCityMessage('testFailed', array('name' => $event->getTitle(), 'message' => "Broken Test\n\n" . $event->getMessage(), 'details' => $event->getException()->getTraceAsString())));
break;
}
$io->writeln($this->teamCityMessage('testFinished', array('name' => $event->getTitle())));
}
示例8: write
/**
*
* @param int $index
*/
public function write($index)
{
$code = $this->presenter->presentException($this->event->getException(), true);
$this->template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => htmlentities(strip_tags($this->event->getTitle())), 'message' => htmlentities(strip_tags($this->event->getMessage())), 'backtrace' => $this->formatBacktrace(), 'code' => $code, 'index' => self::$failingExamplesCount++, 'specification' => $index));
}
示例9: afterExample
/**
* {@inheritdoc}
*/
public function afterExample(ExampleEvent $event)
{
$testCaseNode = sprintf('<testcase name="%s" time="%s" classname="%s" status="%s"', $event->getTitle(), $event->getTime(), $event->getSpecification()->getClassReflection()->getName(), $this->jUnitStatuses[$event->getResult()]);
$this->exampleStatusCounts[$event->getResult()]++;
if (in_array($event->getResult(), array(ExampleEvent::BROKEN, ExampleEvent::FAILED))) {
$exception = $event->getException();
$testCaseNode .= sprintf('>' . "\n" . '<%s type="%s" message="%s" />' . "\n" . '<system-err>' . "\n" . '<![CDATA[' . "\n" . '%s' . "\n" . ']]>' . "\n" . '</system-err>' . "\n" . '</testcase>', $this->resultTags[$event->getResult()], get_class($exception), htmlspecialchars($exception->getMessage()), $exception->getTraceAsString());
} else {
$testCaseNode .= ' />';
}
$this->testCaseNodes[] = $testCaseNode;
}
示例10: array
function it_writes_a_pass_message_for_a_passing_example(Template $template, ExampleEvent $event)
{
$event->getTitle()->willReturn(self::EVENT_TITLE);
$template->render(Template::DIR . '/Template/ReportPending.html', array('title' => self::EVENT_TITLE, 'pendingExamplesCount' => 1))->shouldBeCalled();
$this->write();
}
示例11: write
/**
*/
public function write()
{
$this->template->render(Template::DIR . '/Template/ReportPending.html', array('title' => $this->event->getTitle(), 'pendingExamplesCount' => self::$pendingExamplesCount));
self::$pendingExamplesCount++;
}
示例12: write
/**
*
*/
public function write()
{
$this->template->render(Template::DIR . '/Template/ReportPass.html', array('title' => $this->event->getTitle()));
}
示例13: write
/**
*
*/
public function write()
{
$this->template->render(Template::DIR . '/Template/ReportSkipped.html', array('title' => htmlentities(strip_tags($this->event->getTitle())), 'message' => htmlentities(strip_tags($this->event->getMessage()))));
}
示例14: beforeCurrentExample
public function beforeCurrentExample(ExampleEvent $event)
{
$this->currentExample->setCurrentExample($event->getTitle());
}
示例15: afterExample
public function afterExample(ExampleEvent $event)
{
$this->logger->logExample($event->getSpecification()->getTitle(), $event->getTitle(), $event->getTime());
}