/** * Returns an existing project from the config file. * * @param string $projectName The name for the new project. * * @return phpucConfigProject * @throws phpucErrorException If no project for the given name exists. */ public function getProject($projectName) { if (!isset($this->projects[$projectName])) { $project = new phpucConfigProject($this, $projectName); if ($project->isNew()) { throw new phpucErrorException("Cannot find a project names '{$projectName}'."); } $this->projects[$projectName] = $project; } return $this->projects[$projectName]; }
public function testNonBundledAntReplacesAntWorkerWithExecTask() { $project = new phpucConfigProject($this->config, 'phpUnderControl'); $project->anthome = '/usr'; $project->buildXml(); $element = $project->element; $schedule = $element->getElementsByTagName('schedule'); $builders = $schedule->item(0)->getElementsByTagName('exec'); $exec = $builders->item(0); $this->assertTrue($exec->hasAttribute('workingdir')); $this->assertEquals(PHPUC_TEST_DIR, $exec->getAttribute('workingdir')); $this->assertTrue($exec->hasAttribute('command')); $this->assertEquals('/usr/bin/ant', $exec->getAttribute('command')); $this->assertTrue($exec->hasAttribute('args')); $dir = PHPUC_TEST_DIR . '/'; $argStr = '-logger org.apache.tools.ant.XmlLogger ' . "-logfile {$dir}log.xml " . '-buildfile projects/${project.name}/build.xml'; $this->assertEquals($argStr, $exec->getAttribute('args')); }