public function testSetters()
 {
     $project = new Xinc_Project();
     $project->setName('test');
     $engine = new Xinc_Engine_Sunrise();
     $build = new Xinc_Build($engine, $project);
     $status = Xinc_Build_Interface::PASSED;
     $build->setStatus($status);
     $this->assertEquals($status, $build->getStatus(), 'Stati should be equal');
     $buildNo = 100;
     $expectedLabel = "BUILD.{$buildNo}";
     $build->setNumber($buildNo);
     $this->assertEquals($expectedLabel, $build->getLabel(), 'Labels dont match');
     $this->assertEquals($buildNo, $build->getNumber(), 'Numbers should equal');
 }
Exemple #2
0
 /**
  * Parses the projects xml
  * loads all the tasks
  * assigns them to the builds
  *
  * @param Xinc\Core\Project\Iterator $projects
  *
  * @return array the builds
  */
 public function parseProjectOld($project)
 {
     $builds = array();
     //         $this->setters = Xinc_Plugin_Repository::getInstance()
     //             ->getTasksForSlot(Xinc_Plugin_Slot::PROJECT_SET_VALUES);
     $build = null;
     /**
      * trying to recover the last build information
      */
     try {
         $build = \Xinc\Core\Build::unserialize($project);
         $build->setBuildTime(null);
         $build->resetConfigDirective();
     } catch (Xinc_Build_Exception_NotFound $e) {
         Xinc_Logger::getInstance()->info('No status data found for ' . $project->getName());
     } catch (Exception $e) {
         Xinc_Logger::getInstance()->error('Could not unserialize old status of ' . $project->getName());
     }
     $projectXml = $project->getConfig();
     if (!$build instanceof Xinc_Build_Interface) {
         $build = new Xinc_Build($this->engine, $project);
     }
     $build->getProperties()->set('project.name', $project->getName());
     $build->getProperties()->set('build.number', $build->getNumber());
     $build->getProperties()->set('build.label', $build->getLabel());
     $builtinProps = Xinc::getInstance()->getBuiltinProperties();
     foreach ($builtinProps as $prop => $value) {
         $build->getProperties()->set($prop, $value);
     }
     $taskRegistry = new Xinc_Build_Tasks_Registry();
     $this->_parseTasks($build, $projectXml, $taskRegistry);
     $build->setTaskRegistry($taskRegistry);
     $build->process(Xinc_Plugin_Slot::PROJECT_INIT);
     if (!$build->haveScheduler()) {
         // set default scheduler
         $scheduler = new Xinc_Build_Scheduler_Default();
         $build->addScheduler($scheduler);
     }
     $labeler = $build->getLabeler();
     if ($labeler == null) {
         // set default scheduler
         $labeler = new Xinc_Build_Labeler_Default();
         $build->setLabeler($labeler);
     }
     $builds[] = $build;
     return $builds;
 }