/** * @param Project $project * @return Properties * @throws BuildException */ protected static function _getDatabase($project) { $coverageDatabase = $project->getProperty('coverage.database'); if (!$coverageDatabase) { throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file"); } $database = new PhingFile($coverageDatabase); $props = new Properties(); $props->load($database); return $props; }
/** * Tests if the property set in unlessCondition exists. * * @return boolean <code>true</code> if the property specified * in <code>$this->unlessCondition</code> exists; * <code>false</code> otherwise */ private function testUnlessCondition() { if ($this->unlessCondition === "") { return true; } $properties = explode(",", $this->unlessCondition); $result = true; foreach ($properties as $property) { $test = ProjectConfigurator::replaceProperties($this->getProject(), $property, $this->project->getProperties()); $result = $result && $this->project->getProperty($test) === null; } return $result; }
/** * Checks whether pattern should be applied based on whether the if and unless * properties are set in project. * @param Project $project * @return boolean */ public function valid(Project $project) { if ($this->ifCond !== null && $project->getProperty($this->ifCond) === null) { return false; } else { if ($this->unlessCond !== null && $project->getProperty($this->unlessCond) !== null) { return false; } } return true; }
/** * * @test */ public function aLocalConfigurationPropertyShouldBeAvailableInTheProjectProperties() { $db_name = $this->project->getProperty('LocalConfiguration.DB.database'); $this->assertEquals($db_name, 'mydb'); }