本文整理汇总了PHP中PhpSpec\Console\IO::write方法的典型用法代码示例。如果您正苦于以下问题:PHP IO::write方法的具体用法?PHP IO::write怎么用?PHP IO::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Console\IO
的用法示例。
在下文中一共展示了IO::write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_outputs_monkey_when_example_is_pending(IO $io, ExampleEvent $event)
{
$event->getResult()->willReturn(ExampleEvent::PENDING);
$this->outputEmoji($event);
$io->write(mb_convert_encoding('🙉', 'UTF-8', 'HTML-ENTITIES'))->shouldHaveBeenCalled();
$io->write(' ')->shouldHaveBeenCalled();
}
示例2: outputEmoji
public function outputEmoji(ExampleEvent $event)
{
switch ($event->getResult()) {
case ExampleEvent::PASSED:
$this->io->write($this->encodeChar('😄'));
break;
case ExampleEvent::FAILED:
$this->io->write($this->encodeChar('💩'));
break;
case ExampleEvent::BROKEN:
$this->io->write($this->encodeChar('🔥'));
break;
case ExampleEvent::SKIPPED:
$this->io->write($this->encodeChar('🙈'));
break;
case ExampleEvent::PENDING:
$this->io->write($this->encodeChar('🙉'));
break;
}
$this->io->write(' ');
}
示例3:
function it_outputs_a_suite_summary(SuiteEvent $event, IO $io, StatisticsCollector $stats)
{
$stats->getEventsCount()->willReturn(1);
$stats->getFailedEvents()->willReturn(array());
$stats->getBrokenEvents()->willReturn(array());
$stats->getPendingEvents()->willReturn(array());
$stats->getSkippedEvents()->willReturn(array());
$stats->getTotalSpecs()->willReturn(15);
$event->getTime()->willReturn(12.345);
$stats->getCountsHash()->willReturn(array('passed' => 1, 'pending' => 0, 'skipped' => 0, 'failed' => 2, 'broken' => 0));
$this->afterSuite($event);
$io->writeln('15 specs')->shouldHaveBeenCalled();
$io->writeln("\n12345ms")->shouldHaveBeenCalled();
$io->write('1 example ')->shouldHaveBeenCalled();
$expected = '(<passed>1 passed</passed>, <failed>2 failed</failed>)';
$io->write($expected)->shouldHaveBeenCalled();
}
示例4:
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!'));
}