isControllerExists() публичный Метод

public isControllerExists ( )
Пример #1
0
 private function generate()
 {
     $controller = $this->input->getArgument('controller');
     $action = $this->input->getArgument('action');
     $controllerGenerator = new ControllerGenerator($controller);
     $actionGenerator = null;
     if ($action) {
         $actionGenerator = new ActionGenerator($action);
     }
     $this->output->writeln('---------------------------------');
     $this->output->writeln('Class name: <info>' . $controllerGenerator->getClassName() . '</info>');
     $this->output->writeln('Class namespace: <info>' . $controllerGenerator->getClassNamespace() . '</info>');
     $this->output->writeln('---------------------------------');
     if (!$controllerGenerator->isControllerExists()) {
         $this->output->writeln('Create: <info>' . $controllerGenerator->getControllerPath() . '</info>');
         $controllerGenerator->saveController();
     }
     if ($controllerGenerator->appendAction($actionGenerator)) {
         $this->output->writeln('Appened action: <info>' . $controllerGenerator->getClassName() . '::' . $actionGenerator->getActionName() . '</info>');
     }
     $viewGenerator = new ViewGenerator($controller);
     if ($viewGenerator->createViewDirectoryIfNotExists()) {
         $this->output->writeln('Create: <info>' . $viewGenerator->getViewPath() . '</info>');
     }
     if ($viewGenerator->appendAction($actionGenerator)) {
         $this->output->writeln('Appened view file: <info>' . $actionGenerator->getActionViewFile() . '</info>');
     }
 }
Пример #2
0
 /**
  * @test
  */
 public function shouldReturnFalseIfControllerNotExists()
 {
     //given
     $generator = new ControllerGenerator('users');
     //when
     $isControllerExists = $generator->isControllerExists();
     //then
     $this->assertFalse($isControllerExists);
 }