Exemplo n.º 1
0
 public function testValidConfig()
 {
     $workingdir = getcwd();
     try {
         $config = new Xinc_Project_Config($workingdir . '/test/resources/testNonEmptyProjects.xml');
         $projects = $config->getProjects();
         $this->assertTrue($projects instanceof Xinc_Project_Iterator, 'Should be of instance project iterator ' . ' but is:' . get_class($projects));
         $engineName = $config->getEngineName();
         $this->assertTrue($engineName != null, 'Should have an engine name');
     } catch (Exception $e) {
         $this->assertTrue(false, 'Should not throw an exception but did: ' . get_class($e));
     }
 }
Exemplo n.º 2
0
 public function testBuildProperties()
 {
     Xinc_Plugin_Repository::tearDown();
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Property());
     $workingdir = getcwd();
     $engine = new Xinc_Engine_Sunrise();
     $config = new Xinc_Project_Config($workingdir . '/test/resources/testProjectsPlugProperty.xml');
     $buildIterator = $engine->parseProjects($config->getProjects());
     $this->assertTrue($buildIterator instanceof Xinc_Build_Iterator, 'Should be of type Xinc_Build_Iterator');
     $build = $buildIterator->next();
     $engine->build($build);
     $original = $build->getProperties()->get('original');
     $compare = $build->getProperties()->get('compare');
     $this->assertEquals($original, $compare, 'Value should have been substituted and should be equal now: ' . $original . '!=' . $compare);
 }
Exemplo n.º 3
0
 public function testExampleInvalid()
 {
     $workingdir = getcwd();
     Xinc_Plugin_Repository::tearDown();
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Builder());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet_BuildAlways());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Phing());
     $configFileName = $workingdir . '/test/resources/testSunriseExampleInvalidProject.xml';
     $config = new Xinc_Project_Config($configFileName);
     $projects = $config->getProjects();
     $engineParser = new Xinc_Engine_Sunrise_Parser(new Xinc_Engine_Sunrise());
     $result = $engineParser->parseProjects($projects);
     $this->assertTrue(count($result) == 1, 'Should have one item in the array');
     $build1 = $result[0];
     $projectStatus = $build1->getProject()->getStatus();
     $this->assertEquals(Xinc_Project_Status::MISCONFIGURED, $projectStatus, 'Project status should be MISCONFIGURED but is: ' . $projectStatus);
 }
Exemplo n.º 4
0
 public function testExample()
 {
     Xinc_Plugin_Repository::tearDown();
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Builder());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet_BuildAlways());
     Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Phing());
     $workingdir = getcwd();
     $engine = new Xinc_Engine_Sunrise();
     $config = new Xinc_Project_Config($workingdir . '/test/resources/testSunriseExampleProject.xml');
     $buildIterator = $engine->parseProjects($config->getProjects());
     $this->assertTrue($buildIterator instanceof Xinc_Build_Iterator, 'Should be of type Xinc_Build_Iterator');
     $build = $buildIterator->next();
     try {
         $build->build();
     } catch (Exception $e) {
         var_dump($e);
     }
     $this->assertTrue($build->getLastBuild()->getStatus() == Xinc_Build_Interface::PASSED, 'Build should pass');
 }
Exemplo n.º 5
0
 /**
  * Add a projectfile to the xinc processing.
  *
  * @param string $fileName
  */
 private function addProjectFile($fileName)
 {
     try {
         $config = new Xinc_Project_Config($fileName);
         $engineName = $config->getEngineName();
         $engine = Xinc_Engine_Repository::getInstance()->getEngine($engineName);
         $builds = $engine->parseProjects($config->getProjects());
         self::$_buildQueue->addBuilds($builds);
     } catch (Xinc_Project_Config_Exception_FileNotFound $notFound) {
         Xinc_Logger::getInstance()->error('Project Config File ' . $fileName . ' cannot be found');
     } catch (Xinc_Project_Config_Exception_InvalidEntry $invalid) {
         Xinc_Logger::getInstance()->error('Project Config File has an invalid entry: ' . $invalid->getMessage());
     } catch (Xinc_Engine_Exception_NotFound $engineNotFound) {
         Xinc_Logger::getInstance()->error('Project Config File references an unknown Engine: ' . $engineNotFound->getMessage());
     }
 }