/** * Tests the {@link phpucConfigProject} ctor and tests the magic properties. * * @return void */ public function testNewConfigProjectInstance() { $project = new phpucConfigProject($this->config, 'phpUnderControl'); $this->assertTrue($project->isNew()); $this->assertSame($this->config, $project->configFile); $this->assertEquals('phpUnderControl', $project->projectName); }
/** * 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]; }