PhpSpec\Console\ConsoleIO::isFakingEnabled PHP Method

isFakingEnabled() public method

public isFakingEnabled ( )
    public function isFakingEnabled()
    {
        return $this->input->getOption('fake') || $this->config->isFakingEnabled();
    }

Usage Example

コード例 #1
0
 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();
         }
     }
 }
All Usage Examples Of PhpSpec\Console\ConsoleIO::isFakingEnabled