當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IO::askConfirmation方法代碼示例

本文整理匯總了PHP中PhpSpec\Console\IO::askConfirmation方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::askConfirmation方法的具體用法?PHP IO::askConfirmation怎麽用?PHP IO::askConfirmation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhpSpec\Console\IO的用法示例。


在下文中一共展示了IO::askConfirmation方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $destination = $this->getSavePath($resource);
     if (file_exists($destination) && !$this->io->askConfirmation(sprintf('File "%s" already exists. Overwrite?', basename($destination)), false)) {
         return;
     }
     $directory = dirname($destination);
     if (!file_exists($directory)) {
         $this->createDir($directory);
     }
     $code = $this->generateCodeForResource($resource, $data);
     $this->filesystem->putFileContents($destination, $code);
     $this->io->writeln($this->getPromptMessage($resource, $resource->getSrcFilename()));
 }
開發者ID:ulabox,項目名稱:bus-spec,代碼行數:18,代碼來源:AbstractGenerator.php

示例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();
         }
     }
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:19,代碼來源:CollaboratorNotFoundListener.php

示例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();
         }
     }
 }
開發者ID:ProgrammingPeter,項目名稱:nba-schedule-api,代碼行數:27,代碼來源:MethodReturnedNullListener.php

示例4:

 function it_does_not_generate_interface_when_prompt_is_answered_with_no(IO $io, ExampleEvent $exampleEvent, SuiteEvent $suiteEvent, GeneratorManager $generator)
 {
     $io->askConfirmation('Would you like me to generate an interface `Example\\ExampleClass` for you?')->willReturn(false);
     $this->afterExample($exampleEvent);
     $this->afterSuite($suiteEvent);
     $generator->generate(Argument::cetera())->shouldNotHaveBeenCalled();
     $suiteEvent->markAsWorthRerunning()->shouldNotHaveBeenCalled();
 }
開發者ID:edwardricardo,項目名稱:zenska,代碼行數:8,代碼來源:CollaboratorNotFoundListenerSpec.php

示例5:

 function it_prompts_and_warns_when_one_method_name_is_correct_but_other_reserved($exampleEvent, SuiteEvent $suiteEvent, IO $io, NameCheckerInterface $nameChecker)
 {
     $this->callAfterExample($exampleEvent, $nameChecker, 'throw', false);
     $this->callAfterExample($exampleEvent, $nameChecker, 'foo');
     $io->writeBrokenCodeBlock("I cannot generate the method 'throw' for you because it is a reserved keyword", 2)->shouldBeCalled();
     $io->askConfirmation('Do you want me to create `stdClass::foo()` for you?')->shouldBeCalled();
     $suiteEvent->markAsNotWorthRerunning()->shouldBeCalled();
     $this->afterSuite($suiteEvent);
 }
開發者ID:drickferreira,項目名稱:rastreador,代碼行數:9,代碼來源:MethodNotFoundListenerSpec.php

示例6: afterSuite

 /**
  * @param SuiteEvent $event
  */
 public function afterSuite(SuiteEvent $event)
 {
     foreach ($this->interfaces as $interface => $methods) {
         try {
             $resource = $this->resources->createResource($interface);
         } catch (ResourceCreationException $e) {
             continue;
         }
         foreach ($methods as $method => $arguments) {
             if ($this->io->askConfirmation(sprintf(self::PROMPT, $interface, $method))) {
                 $this->generator->generate($resource, 'method-signature', array('name' => $method, 'arguments' => $this->getRealArguments($arguments)));
                 $event->markAsWorthRerunning();
             }
         }
     }
 }
開發者ID:edwardricardo,項目名稱:zenska,代碼行數:19,代碼來源:CollaboratorMethodNotFoundListener.php

示例7: userAborts

 /**
  * @param string $filepath
  *
  * @return bool
  */
 private function userAborts($filepath)
 {
     $message = sprintf('File "%s" already exists. Overwrite?', basename($filepath));
     return !$this->io->askConfirmation($message, false);
 }
開發者ID:mawaha,項目名稱:tracker,代碼行數:10,代碼來源:PromptingGenerator.php

示例8:

 function it_marks_the_suite_as_being_worth_rerunning_when_generation_happens(IO $io, ExampleEvent $event, SuiteEvent $suiteEvent, MethodNotFoundException $exception)
 {
     $io->askConfirmation(Argument::any())->willReturn(true);
     $exception->getClassname()->willReturn('spec\\PhpSpec\\Listener\\DoubleOfInterface');
     $exception->getMethodName()->willReturn('aMethod');
     $this->afterExample($event);
     $this->afterSuite($suiteEvent);
     $suiteEvent->markAsWorthRerunning()->shouldHaveBeenCalled();
 }
開發者ID:qasem2rubik,項目名稱:laravel,代碼行數:9,代碼來源:CollaboratorMethodNotFoundListenerSpec.php

示例9: array

 function it_invokes_method_body_generation_when_prompt_is_answered_yes(MethodCallEvent $methodCallEvent, ExampleEvent $exampleEvent, IO $io, GeneratorManager $generatorManager, ResourceManager $resourceManager, ResourceInterface $resource, SuiteEvent $event)
 {
     $io->askConfirmation(Argument::any())->willReturn(true);
     $resourceManager->createResource(Argument::any())->willReturn($resource);
     $methodCallEvent->getSubject()->willReturn(new \StdClass());
     $methodCallEvent->getMethod()->willReturn('myMethod');
     $this->afterMethodCall($methodCallEvent);
     $this->afterExample($exampleEvent);
     $this->afterSuite($event);
     $generatorManager->generate($resource, 'returnConstant', array('method' => 'myMethod', 'expected' => 100))->shouldHaveBeenCalled();
 }
開發者ID:HarveyCheng,項目名稱:myblog,代碼行數:11,代碼來源:MethodReturnedNullListenerSpec.php

示例10: let

 function let(IO $io, ResourceManager $resourceManager, GeneratorManager $generatorManager, SuiteEvent $suiteEvent, ExampleEvent $exampleEvent)
 {
     $io->writeln(Argument::any())->willReturn();
     $io->askConfirmation(Argument::any())->willReturn();
     $this->beConstructedWith($io, $resourceManager, $generatorManager);
 }
開發者ID:focuslife,項目名稱:v0.1,代碼行數:6,代碼來源:ClassNotFoundListenerSpec.php


注:本文中的PhpSpec\Console\IO::askConfirmation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。