Ejemplo n.º 1
0
 public function testGetException()
 {
     $conf = new Config();
     try {
         $conf->getOption('not-set');
         $this->assertTrue(False, 'unknown option should not be ignored');
     } catch (ConfigException $e) {
         $this->assertTrue(true, 'Expected exception thrown');
     }
 }
Ejemplo n.º 2
0
 public function testProjectWithoutName()
 {
     $conf = new Config();
     $conf->setOption('config-file', __DIR__ . '/config/plugins2.xml');
     $conf->setOption('project-file', __DIR__ . '/config/project-anonym.xml');
     $this->projectXml($conf, $reg)->load($conf, $reg);
     $projects = $reg->getProjectIterator();
     $this->assertEquals(1, $projects->count());
     $project = $projects->current();
     $this->assertEquals('3ff74917e5698d0e418b55b592416df2', $project->getName());
 }
Ejemplo n.º 3
0
 /**
  * setup a basic configuration for tests
  * @return Xinc::Core::Config::Config
  */
 public function defaultConfig()
 {
     $conf = new Config();
     $conf->setOption('once', false);
     $conf->setOption('working-dir', './');
     $conf->setOption('config-dir', './tests/etc/xinc/');
     $conf->setOption('project-dir', './tests/etc/xinc/projects/');
     $conf->setOption('status-dir', './tests/status/');
     $conf->setOption('log-file', './tests/log/xinc.log');
     return $conf;
 }
Ejemplo n.º 4
0
 public function testSetupBuild()
 {
     $conf = new Config();
     $conf->setOption('config-file', __DIR__ . '/config/plugins2.xml');
     $conf->setOption('project-file', __DIR__ . '/config/project-property.xml');
     $conf->setOption('working-dir', './', 'working-dir');
     $conf->setOption('status-dir', './', 'status-dir');
     $conf->setOption('project-dir', './', 'project-dir');
     $this->projectXml($conf, $reg)->load($conf, $reg);
     $build = $this->aBuildWithConfig($conf);
     $project = $build->getProject();
     $this->assertInstanceOf('Xinc\\Core\\Project\\Project', $project);
     $engine = $build->getEngine();
     $this->assertInstanceOf('Xinc\\Core\\Engine\\EngineInterface', $engine);
     $this->assertInstanceOf('Xinc\\Core\\Logger', $engine->getLogger());
     $build2 = $engine->setupBuild($project);
     $this->assertEquals('TestProjectProperty', $build2->getProperty('project.name'));
     $this->assertEquals(1, $build2->getProperty('build.number'));
     $this->assertEquals('BUILD.1', $build2->getProperty('build.label'));
     $this->assertEquals('./', $build2->getProperty('workingdir'));
     $this->assertEquals('./', $build2->getProperty('statusdir'));
     $this->assertEquals('./', $build2->getProperty('projectdir'));
     //  print_r($project->getConfig());
 }
Ejemplo n.º 5
0
 public function testEngines()
 {
     $conf = new Config();
     $conf->setOption('config-file', __DIR__ . '/config/sample-engines.xml');
     $this->xml($conf, $reg)->load($conf, $reg);
     $this->assertInstanceOf('Xinc\\Core\\Test\\Engine', $reg->getDefaultEngine());
     $this->assertInstanceOf('Xinc\\Core\\Test\\Engine', $reg->getEngine('TestEngine'));
     try {
         $reg->getEngine('xyz');
         $this->assertTrue(false, "Unknown engine?");
     } catch (RegistryException $e) {
         $this->assertTrue(true, "Ok, unknown engine throws exception.");
     }
 }