Skip to content

Commit

Permalink
Merge pull request #112 from AKSW/feature-fix-owdev-builds
Browse files Browse the repository at this point in the history
Fix owdev builds

Tests ok
  • Loading branch information
white-gecko authored Jun 30, 2016
2 parents 9669d4b + c2204d2 commit 2964447
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 83 deletions.
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,23 @@ endif

# coding standard
# test stuff
test-directories:
rm -rf tests/cache tests/unit/cache tests/integration/cache
mkdir tests/cache
mkdir tests/unit/cache
mkdir tests/integration/cache

test-unit: test-directories
test-unit: directories
$(PHPUNIT) --testsuite "Erfurt Unit Tests"

test-integration-virtuoso: test-directories
EF_STORE_ADAPTER=virtuoso $(PHPUNIT) --testsuite "Erfurt Virtuoso Integration Tests"
test-unit-cc: directories
$(PHPUNIT) --testsuite "Erfurt Unit Tests" --coverage-clover ./build/logs/clover.xml --coverage-html ./build/coverage --log-junit ./build/logs/junit.xml

test-integration-virtuoso: directories
EF_STORE_ADAPTER=virtuoso $(PHPUNIT) --testsuite "Erfurt Integration Tests"

test-integration-virtuoso-cc: directories
EF_STORE_ADAPTER=virtuoso $(PHPUNIT) --testsuite "Erfurt Integration Tests" --coverage-html ./build/coverage-virtuoso

test-integration-mysql: directories
EF_STORE_ADAPTER=zenddb $(PHPUNIT) --testsuite "Erfurt Integration Tests"

test-integration-mysql: test-directories
EF_STORE_ADAPTER=zenddb $(PHPUNIT) --testsuite "Erfurt Virtuoso Integration Tests"
test-integration-mysql-cc: directories
EF_STORE_ADAPTER=zenddb $(PHPUNIT) --testsuite "Erfurt Integration Tests" --coverage-html ./build/coverage-mysql

test:
make test-unit
Expand Down
84 changes: 46 additions & 38 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

<project name="Erfurt" default="build">

<target name="build-unit" depends="prepare,lint,phpunit,phpdoc,phpcb" />
<target name="build-integration" depends="prepare,lint,phpunit-integration,phpdoc,phpcb,phpmd-ci,phpcpd,phpcs-ci,pdepend" />
<target name="build-full" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdoc,phpunit-integration,phpcb" />
<target name="build-unit" depends="prepare,lint,phpunit,phpcb" />
<target name="build-integration" depends="prepare,lint,phpunit-integration,phpcb,phpmd-ci,phpcpd,phpcs-ci,pdepend" />
<target name="build-full" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit-integration,phpcb" />

<target name="build" depends="build-integration"/>

<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/coverage-integration"/>
<delete dir="${basedir}/build/coverage-virtuoso"/>
<delete dir="${basedir}/build/coverage-mysql"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
</target>
Expand All @@ -21,7 +22,8 @@
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/coverage-integration"/>
<mkdir dir="${basedir}/build/coverage-virtuoso"/>
<mkdir dir="${basedir}/build/coverage-mysql"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
Expand All @@ -38,71 +40,50 @@
</target>

<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<exec executable="./vendor/bin/phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}/library/Erfurt" />
</exec>
</target>

<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<exec executable="./vendor/bin/pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${basedir}/library/Erfurt" />
</exec>
</target>

<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}/library/Erfurt" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
</exec>
</target>

<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}/library/Erfurt" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>

<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<exec executable="./vendor/bin/phpcs">
<arg value="--standard=${basedir}/phpcs.xml" />
<arg path="${basedir}/library/Erfurt" />
</exec>
</target>

<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<exec executable="./vendor/bin/phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg value="--standard=${basedir}/phpcs.xml" />
<arg path="${basedir}/library/Erfurt" />
</exec>
</target>

<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<exec executable="./vendor/bin/phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/library/Erfurt" />
</exec>
</target>

<target name="phpdoc" description="Create API doc using DocCreator">
<exec dir="/opt/DocCreator/" executable="php">
<arg value="/opt/DocCreator/create.php5" />
<exec executable="php vendor/bin/doc-creator.php">
<arg value="--config-file=${basedir}/build/doc.erfurt.xml" />
<arg value="--source-folder=${basedir}/library/Erfurt/" />
<arg value="--target-folder=${basedir}/build/api/" />
Expand All @@ -111,20 +92,27 @@

<target name="directories">
<exec executable="make">
<arg value="test-directories" />
<arg value="directories" />
</exec>
</target>

<target name="phpunit" depends="directories" description="Run unit tests with PHPUnit">
<exec dir="${basedir}/tests/unit/" executable="phpunit" failonerror="true" />
<exec executable="make" failonerror="true">
<arg value="test-unit-cc" />
</exec>
</target>

<target name="phpunit-integration" depends="phpunit" description="Run unit tests with PHPUnit">
<exec dir="${basedir}/tests/integration/" executable="phpunit" failonerror="true" />
<exec executable="make" failonerror="true">
<arg value="test-integration-virtuoso-cc" />
</exec>
<exec executable="make" failonerror="true">
<arg value="test-integration-mysql-cc" />
</exec>
</target>

<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<exec executable="./vendor/bin/phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
Expand All @@ -133,4 +121,24 @@
<arg path="${basedir}/build/code-browser" />
</exec>
</target>

<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="./vendor/bin/phpmd">
<arg path="${basedir}/library/Erfurt" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
</exec>
</target>

<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="./vendor/bin/phpmd">
<arg path="${basedir}/library/Erfurt" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
</project>
6 changes: 0 additions & 6 deletions build/phpcs.xml

This file was deleted.

6 changes: 3 additions & 3 deletions build/phpmd.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>

<ruleset name="OntoWiki RuleSet"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<ruleset name="OntoWiki RuleSet"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/
ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.4.0",
"semsol/arc2": "*",
"zendframework/zendframework1": "1.*"
},
"require-dev": {
"phpunit/phpunit": "4.5.*",
"squizlabs/php_codesniffer": "dev-master"
"squizlabs/php_codesniffer": "dev-master",
"ceus-media/common": "dev-master",
"ceus-media/doc-creator": "dev-master",
"zerkalica/php-code-browser": "dev-master",
"sebastian/phpcpd": "2.0.*",
"pdepend/pdepend": "2.2.*",
"phploc/phploc": "2.1.*",
"phpmd/phpmd": "2.4.*"
},
"autoload": {
"classmap": [
Expand Down
5 changes: 4 additions & 1 deletion library/Erfurt/Ac/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,11 @@ public function isModelAllowed($type, $modelUri)
$modelUri = (string)$modelUri;
$result = $this->areModelsAllowed($type, array($modelUri));
if (isset($result[$modelUri])) {
return $result[$modelUri];
if ($result[$modelUri] === true) {
return true;
}
}

return false;
}

Expand Down
19 changes: 19 additions & 0 deletions library/Erfurt/Sparql/SimpleQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class Erfurt_Sparql_SimpleQuery
/** @var boolean */
protected $_ask = false;

/** @var boolean */
protected $_oldCount = false;

/** @var array */
protected $_from = array();

Expand Down Expand Up @@ -60,6 +63,8 @@ public function __toString()

if ($this->_ask) {
$queryString .= 'ASK' . PHP_EOL;
} else if ($this->_oldCount) {
$queryString .= 'COUNT' . PHP_EOL;
} else {
$queryString .= $this->_selectClause . PHP_EOL;
}
Expand Down Expand Up @@ -120,6 +125,7 @@ public static function initWithString($queryString)
'prefix' => '/((PREFIX\s+[^:\s]+:\s+<[^\s]*>\s*)+)/si',
'base' => '/BASE\s+<(.+?)>/i',
'ask' => '/(ASK)/si',
'old_count' => '/(COUNT\s+(FROM|WHERE))/si',
'select_clause' => '/((SELECT\s+)(DISTINCT\s+)?)(\*|((COUNT\s*\((\?\w*|\*)\)\s+(as\s+(\?\w+\s+))?)|(\?\w+\s+))*)/si',
'from' => '/FROM\s+<(.+?)>/i',
'from_named' => '/FROM\s+NAMED\s+<(.+?)>/i',
Expand Down Expand Up @@ -152,6 +158,10 @@ public static function initWithString($queryString)
$queryObject->setAsk(true);
}

if (isset($parts['old_count'][0][0])) {
$queryObject->setOldCount(true);
}

if (isset($parts['select_clause'][0][0])) {
$queryObject->setSelectClause($parts['select_clause'][0][0]);
}
Expand Down Expand Up @@ -320,6 +330,15 @@ public function setAsk($ask = true)
return $this;
}

public function setOldCount($oldCount = true) {

if ($oldCount === true | strtolower($oldCount) == 'count') {
$this->_oldCount = true;
} else {
$this->_oldCount = false;
}
}

public function setSelectClause($selectClauseString)
{
$this->_selectClause = $selectClauseString;
Expand Down
5 changes: 2 additions & 3 deletions library/Erfurt/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ public function getImportsClosure($modelIri, $withHiddenImports = true, $useAC =
*
* @param string $modelIri
*/
private function _getImportsClosure($modelIri, $withHiddenImports = true)
private function _getImportsClosure($modelIri, $withHiddenImports = true, $useAC = true)
{
$currentLevel = $this->_backendAdapter->getImportsClosure($modelIri);
if ($currentLevel == array($modelIri)) {
Expand All @@ -1002,7 +1002,7 @@ private function _getImportsClosure($modelIri, $withHiddenImports = true)
foreach ($graphConfig[$importsUri] as $valueArray) {
$currentLevel = array_merge(
$currentLevel,
$this->getImportsClosure($valueArray['value'], $withHiddenImports)
$this->getImportsClosure($valueArray['value'], $withHiddenImports, $useAC)
);
}
}
Expand Down Expand Up @@ -2133,7 +2133,6 @@ public function getResourceDescription(
return $fetchedDesc;
}


// ------------------------------------------------------------------------
// --- Protected Methods --------------------------------------------------
// ------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
<sparql xmlns="http://www.w3.org/2005/sparql-results#">

<?php
function compat_htmlentities ($string, $flags = null, $encoding = null, $double_encode = true) {
function compat_htmlentities ($string, $flags = null, $encoding = null, $double_encode = false) {
if ($flags === null) {
$flags = ENT_COMPAT;
if (defined("ENT_HTML401")) {
$flags = $flags | ENT_HTML401;
}
$flags = ENT_COMPAT | ENT_HTML401;
}
if ($encoding === null) {
$encoding = ini_get("default_charset");
if ($encoding === '') {
$encoding = 'UTF-8';
}
}

return htmlentities ($string, $flags, $encoding, $double_encode);
}
?>
Expand Down
11 changes: 1 addition & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@
<testsuite name="Erfurt Unit Tests">
<directory suffix="Test.php">tests/unit</directory>
</testsuite>
<testsuite name="Erfurt Virtuoso Integration Tests">
<testsuite name="Erfurt Integration Tests">
<directory suffix="Test.php">tests/integration</directory>
</testsuite>
<testsuite name="Erfurt ZendDB Integration Tests">
<directory suffix="Test.php">tests/integration</directory>
</testsuite>
<logging>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
<log type="coverage-html" target="./build/coverage" title="OntoWiki"/>
<log type="junit" target="./build/logs/junit.xml"/>
</logging>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./library/Erfurt</directory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class Erfurt_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
2 => " * This file is part of the {@link http://erfurt-framework.org Erfurt} project.\n",
3 => " *\n",
4 => "",
5 => " * @license http://opensource.org/licenses/gpl-license.php "
. "GNU General Public License (GPL)\n",
5 => " * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)\n",
6 => " */",
);

Expand Down
Loading

0 comments on commit 2964447

Please sign in to comment.