本文整理汇总了PHP中PhpSpec\Console\IO::isCodeGenerationEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP IO::isCodeGenerationEnabled方法的具体用法?PHP IO::isCodeGenerationEnabled怎么用?PHP IO::isCodeGenerationEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpSpec\Console\IO
的用法示例。
在下文中一共展示了IO::isCodeGenerationEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_does_not_prompt_when_code_generation_is_disabled(IO $io, ExampleEvent $exampleEvent, SuiteEvent $suiteEvent)
{
$io->isCodeGenerationEnabled()->willReturn(false);
$this->afterExample($exampleEvent);
$this->afterSuite($suiteEvent);
$io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled();
}
示例2: afterSuite
/**
* @param SuiteEvent $event
*/
public function afterSuite(SuiteEvent $event)
{
if (!$this->io->isCodeGenerationEnabled()) {
return;
}
foreach ($this->exceptions as $exception) {
$resource = $this->resources->createResource($exception->getCollaboratorName());
if ($this->resourceIsInSpecNamespace($exception, $resource)) {
continue;
}
if ($this->io->askConfirmation(sprintf('Would you like me to generate an interface `%s` for you?', $exception->getCollaboratorName()))) {
$this->generator->generate($resource, 'interface');
$event->markAsWorthRerunning();
}
}
}
示例3: afterSuite
public function afterSuite(SuiteEvent $event)
{
if (!$this->io->isCodeGenerationEnabled()) {
return;
}
if (!$this->io->isFakingEnabled()) {
return;
}
foreach ($this->nullMethods as $methodString => $failedCall) {
$failedCall['expected'] = array_unique($failedCall['expected']);
if (count($failedCall['expected']) > 1) {
continue;
}
$expected = current($failedCall['expected']);
$class = $failedCall['class'];
$message = sprintf('Do you want me to make `%s()` always return %s for you?', $methodString, var_export($expected, true));
try {
$resource = $this->resources->createResource($class);
} catch (\RuntimeException $exception) {
continue;
}
if ($this->io->askConfirmation($message)) {
$this->generator->generate($resource, 'returnConstant', array('method' => $failedCall['method'], 'expected' => $expected));
$event->markAsWorthRerunning();
}
}
}
示例4:
function it_does_not_prompt_when_code_generation_is_disabled(IO $io, ExampleEvent $event, SuiteEvent $suiteEvent, MethodNotFoundException $exception)
{
$io->isCodeGenerationEnabled()->willReturn(false);
$exception->getClassname()->willReturn('spec\\PhpSpec\\Listener\\DoubleOfInterface');
$exception->getMethodName()->willReturn('aMethod');
$this->afterExample($event);
$this->afterSuite($suiteEvent);
$io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled();
}
示例5: getMethodNotFoundException
/**
* @param ExampleEvent $event
* @return bool
*/
private function getMethodNotFoundException(ExampleEvent $event)
{
if ($this->io->isCodeGenerationEnabled() && ($exception = $event->getException()) && $exception instanceof MethodNotFoundException) {
return $exception;
}
}
示例6:
function it_does_not_prompt_when_input_is_not_interactive(MethodCallEvent $methodCallEvent, ExampleEvent $exampleEvent, IO $io, SuiteEvent $event)
{
$io->isCodeGenerationEnabled()->willReturn(false);
$this->afterMethodCall($methodCallEvent);
$this->afterExample($exampleEvent);
$this->afterSuite($event);
$io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled();
}
示例7: let
function let(ModuleGenerator $moduleGenerator, ConfigGenerator $configGenerator, IO $io, ClassDetector $detector)
{
$io->isCodeGenerationEnabled()->willReturn(true);
$detector->classExists(Argument::any())->willReturn(true);
$this->beConstructedWith($moduleGenerator, $configGenerator, $io, $detector);
}