Пример #1
0
 /**
  *  Test with project path set
  */
 public function testWithProjectPathSet()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_working_path_mandatory'));
     $this->parameters->set('workingPath', '/path/to/project/');
     $task = new ProjectPathMandatory();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
 /**
  *  Test with controller existing
  */
 public function testWithKnownHydrators()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_base_hydrator_param_unknown'));
     $this->console->expects($this->never())->method('colorize');
     $knownHydrators = ['ArraySerializable', 'ClassMethods', 'ObjectProperty', 'Reflection'];
     foreach ($knownHydrators as $hydrator) {
         $this->parameters->set('paramBaseHydrator', $hydrator);
         $task = new BaseHydratorParam();
         $result = $task($this->route, $this->console, $this->parameters);
         $this->assertEquals(0, $result);
     }
 }
Пример #3
0
 /**
  *  Test with unwritable project path t
  */
 public function testUnwritableProjectPathSet()
 {
     $this->console->expects($this->once())->method('writeFailLine')->with($this->equalTo('task_setup_config_file_not_writable'));
     $this->parameters->set('workingPath', '/path/to/project/');
     $task = new ConfigFile();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(1, $result);
 }
Пример #4
0
 /**
  *  Test with module path existing
  */
 public function testWithModulePathExisting()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_working_path_not_exists'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('projectModuleDir', $this->zf2rapidModuleDir);
     $task = new ModulePathExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
Пример #5
0
 /**
  *  Test with validator existing
  */
 public function testWithValidatorExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), array('validator'));
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('validatorDir', $this->zf2rapidValidatorDir);
     $this->parameters->set('paramValidator', $this->zf2rapidValidatorName);
     file_put_contents($this->zf2rapidValidatorDir . $this->zf2rapidValidatorFile, 'class TestValidator {}');
     $task = new ValidatorExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
 /**
  *  Test with controller plugin existing
  */
 public function testWithControllerPluginExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), array('controller plugin'));
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('controllerPluginDir', $this->zf2rapidControllerPluginDir);
     $this->parameters->set('paramControllerPlugin', $this->zf2rapidControllerPluginName);
     file_put_contents($this->zf2rapidControllerPluginDir . $this->zf2rapidControllerPluginFile, 'class TestPlugin {}');
     $task = new ControllerPluginExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
Пример #7
0
 /**
  *  Test with form existing
  */
 public function testWithFormExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), ['form']);
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('formDir', $this->zf2rapidFormDir);
     $this->parameters->set('paramForm', $this->zf2rapidFormName);
     file_put_contents($this->zf2rapidFormDir . $this->zf2rapidFormFile, 'class TestForm {}');
     $task = new FormExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
 /**
  *  Test with module dir creating succeed
  */
 public function testWithModuleDirCreatingSucceed()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_create_structure_module_root_created'));
     $this->console->expects($this->once())->method('colorize');
     $this->parameters->set('moduleDir', $this->zf2rapidModuleDir);
     $this->parameters->set('moduleConfigDir', $this->zf2rapidModuleDir . 'config/');
     $this->parameters->set('moduleSrcDir', $this->zf2rapidModuleDir . 'src/');
     $this->parameters->set('moduleViewDir', $this->zf2rapidModuleDir . 'view/');
     $task = new CreateModuleStructure();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
     $this->assertFileExists($this->zf2rapidModuleDir);
     $this->assertFileExists($this->zf2rapidModuleDir . 'config/');
     $this->assertFileExists($this->zf2rapidModuleDir . 'src/');
     $this->assertFileExists($this->zf2rapidModuleDir . 'view/');
 }
Пример #9
0
 /**
  *  Test with project path not allowed file
  */
 public function testWithProjectPathNotAllowedFile()
 {
     if (!file_exists($this->zf2rapidProjectPath)) {
         mkdir($this->zf2rapidProjectPath);
     }
     if (!file_exists($this->zf2rapidProjectPath . $this->zf2rapidNotAllowedFile)) {
         file_put_contents($this->zf2rapidProjectPath . $this->zf2rapidNotAllowedFile, 'test');
     }
     $this->console->expects($this->once())->method('writeFailLine')->with($this->equalTo('task_check_working_path_not_empty'));
     $this->console->expects($this->once())->method('colorize');
     $this->parameters->set('workingPath', $this->zf2rapidProjectPath);
     $this->assertFileExists($this->zf2rapidProjectPath);
     $task = new ProjectPathEmpty();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(1, $result);
     $this->assertFileExists($this->zf2rapidProjectPath);
 }