Skip to content
Permalink
Browse files
Using composer for dependencies
- Switched to composer version of phpunit and phpcs
- Add composer file and fix some things to work with composer erfurt
- Remove ARC2, whichis not used in OntoWiki
- Remove Copy of Mimeparser and use it from composer
- Use bitworking/mimeparse from composer
- Add Unit Test for Mimeparser
- Use phpunit from composer in Makefile
- composer now downloads rdfauthor and places it into libraries, removed git-submodule things from Makefile
- Remove libraries/ from classpath
- added getcomposer actualized deploy
- getcomposer -> get the composer.phar
- deploy-> now gets libraries through composer
- Makefile fixing little errors, creating phpunit.xml in src
- Add my phpunit.xml
- Add install target, equal to deploy
- Add extension tests
- Update ruleset to work with current code sniffer release
- cleaned makefile changed test-calls
- deleted old codesniffer things, added new in Makefile + phpcbf;getting weird make error after executing make codesniffer, though it works
- Fix cases for RDFauthor
  • Loading branch information
white-gecko authored and pfrischmuth committed Mar 7, 2016
1 parent a8eb80e commit e03c0731c2580a5dc6fc5efcc7ada71fb963e549
Show file tree
Hide file tree
Showing 83 changed files with 140 additions and 16,423 deletions.
@@ -37,3 +37,5 @@ build/
# vagrant stuff
Vagrantfile
.vagrant

/vendor/
@@ -1,6 +1,3 @@
[submodule "libraries/RDFauthor"]
path = libraries/RDFauthor
url = git://github.com/AKSW/RDFauthor.git
[submodule "libraries/Erfurt"]
path = libraries/Erfurt
url = git://github.com/AKSW/Erfurt.git
241 Makefile
@@ -1,6 +1,6 @@
ZENDVERSION=1.12.9
ZEND2VERSION=2.2.2

PHPUNIT = ./vendor/bin/phpunit
PHPCS = ./vendor/bin/phpcs
PHPCBF = ./vendor/bin/phpcbf
default:
@echo "Typical targets your could want to reach:"
@echo ""
@@ -19,72 +19,43 @@ default:
help:
@echo "Please use: (e.g. make deploy)"
@echo " deploy ..................... Runs everything which is needed for a deployment"
@echo " install .................... Make directories, zend and libraries"
@echo " install .................... Make directories and libraries"
@echo " help ....................... This help screen"
@echo " help-cs .................... Show help for code sniffing targets"
@echo " help-test .................. Show help for test related targets"
@echo " -------------------------------------------------------------------"
@echo " vagrant .................... Prepare environment to run with Vagrant (no zend)"
@echo " vagrant .................... Prepare environment to run with Vagrant"
@echo " vagrant-clean .............. Removes owdev box in order to ensure you have the latest version"
@echo " directories ................ Create cache/log dir and chmod environment"
@echo " zend ....................... Download and install Zend under libraries"
@echo " libraries .................. Zend, Erfurt and RDFauthor submodules (read-write)"
@echo " erfurt ..................... Clone under libraries"
@echo " rdfauthor .................. Clone under libraries"
@echo " pull ....................... 'git pull' for all repos"
@echo " fetch ...................... 'git fetch' for all repos"
@echo " fetch-all .................. 'git fetch --all', i.e. fetch all repos on all remotes"
@echo " add-upstream ............... Adds standard AKSW git repo as remote/upstream"
@echo " status ..................... 'git status' for all repos"
@echo " branch-check ............... 'git rev-parse' for all repos"
@echo " clean ...................... Deletes all log and cache files"
@echo " install-test-environment ... Install neccessary software (PHPUnit,...))"
@echo " odbctest ................... Executes some tests to check the Virtuoso connection"

help-cs:
@echo "Please use: (e.g. make cs-install)"
@echo " cs-install ............................ Install CodeSniffer"
@echo " cs-uninstall .......................... Uninstall CodeSniffer"
@echo " cs-install-submodule MPATH=<path> ..... Install CodeSniffer on a submodule,"
@echo " <path> must by the relative path to the submodule"
@echo " cs-uninstall-submodule MPATH=<path> ... Uninstall CodeSniffer on a submodule,"
@echo " <path> must by the relative path to the submodule"
@echo " cs-enable ............................. Enable CodeSniffer to check code before every commit"
@echo " cs-disable ............................ Disable CodeSniffer code checking"
@echo " cs-check-commit ....................... Run pre-commit code checking manually"
@echo " cs-check-commit-emacs ................. Same as cs-check-commit with emacs output"
@echo " cs-check-commit-intensive ............. Run pre-commit code checking"
@echo " manually with stricter coding standard"
@echo " cs-check .............................. Run complete code checking"
@echo " cs-check-full ......................... Run complete code checking with detailed output"
@echo " cs-check-emacs ........................ Run complete code checking with with emacs output"
@echo " cs-check-blame ........................ Run complete code checking with blame list output"
@echo " cs-check-intensive .................... Run complete code checking with"
@echo " stricter coding standard"
@echo " cs-check-intensive-full ............... Run complete code checking with"
@echo " stricter coding standard and detailed output"
@echo " possible Parameter:"
@echo " > CHECKPATH=<path> ................. Run code checking on specific relative path"
@echo " > SNIFFS=<sniff 1>,<sniff 2> ... Run code checking on specific sniffs"
@echo " > OPTIONS=<option> ............. Run code checking with specific CodeSniffer options"
@echo "Please use: (e.g. make codesniffer)"
@echo " codesniffer ............................ Run CodeSniffer"
@echo " codebeautifier ......................... Run CodeBeautifier"

help-test:
@echo " test ......................... Execute unit, integration and extension tests"
@echo " test-unit .................... Run OntoWiki unit tests"
@echo " test-unit-cc ................. Same as above plus code coverage report"
@echo " test-integration-virtuoso .... Run OntoWiki integration tests with virtuoso"
@echo " test-integration-virtuoso-cc . Same as above plus code coverage report"
@echo " test-integration-mysql ....... Run OntoWiki integration tests with mysql"
@echo " test-integration-mysql-cc .... Same as above plus code coverage report"
@echo " test-extensions .............. Run tests for extensions"

# top level target

deploy: directories clean zend submodules
getcomposer: #seems that there is no way to constantly get the newest version(install way outdates with new versions)
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === 'fd26ce67e3b237fffd5e5544b45b0d92c41a4afe3e3f778e942e43ce6be197b9cdc7c251dcde6e2a52297ea269370680') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar self-update

install: deploy

install: directories libraries
deploy: directories clean composer-install

vagrant: directories clean submodules-developer
vagrant: directories clean #add composer install
rm -rf libraries/Zend # vagrant has own zend
rm -f Vagrantfile
!(ls $(PWD)/application/scripts/Vagrantfile > /dev/null 2> /dev/null) || ln -s $(PWD)/application/scripts/Vagrantfile $(PWD)/Vagrantfile
@@ -98,108 +69,31 @@ vagrant-clean:
vagrant box remove owdev

clean:
rm -rf cache/* logs/*
rm -rf cache/* logs/* libraries/*

directories: clean
mkdir -p logs cache
chmod 777 logs cache extensions

libraries: zend submodules-developer

submodules: # read-only
git submodule init
git config submodule.libraries/Erfurt.url "https://github.com/AKSW/Erfurt.git"
git config submodule.libraries/RDFauthor.url "https://github.com/AKSW/RDFauthor.git"
git submodule update

submodules-developer: # read-write
git submodule init
git config submodule.libraries/Erfurt.url "git@github.com:AKSW/Erfurt.git"
git config submodule.libraries/RDFauthor.url "git@github.com:AKSW/RDFauthor.git"
git submodule update

# developer targets

pull:
git pull
git submodule foreach git pull

fetch:
git fetch
git submodule foreach git fetch

fetch-all:
# Remember to add the aprorpriate upstream sources frist
# e.g. by using `make add-upstream`
git fetch --all
git submodule foreach git fetch --all

add-upstream:
git remote add upstream git://github.com/AKSW/OntoWiki.git

info:
@git --no-pager log -1 --oneline --decorate
@git submodule foreach git --no-pager log -1 --oneline --decorate

status:
git status -sb
git submodule foreach git status -sb

branch-check:
@git rev-parse --abbrev-ref HEAD
@git submodule foreach git rev-parse --abbrev-ref HEAD

# libraries

ZENDFILEBASE="ZendFramework-${ZENDVERSION}-minimal"
ZENDURL="https://packages.zendframework.com/releases/ZendFramework-${ZENDVERSION}/${ZENDFILEBASE}.tar.gz"
zend:
rm -rf libraries/Zend
curl -L -# -O ${ZENDURL} || wget ${ZENDURL}
tar xzf ${ZENDFILEBASE}.tar.gz
mv ${ZENDFILEBASE}/library/Zend libraries
rm -rf ${ZENDFILEBASE}.tar.gz ${ZENDFILEBASE}

ZEND2FILEBASE="ZendFramework-minimal-${ZEND2VERSION}"
ZEND2URL="https://packages.zendframework.com/releases/ZendFramework-${ZEND2VERSION}/${ZEND2FILEBASE}.tgz"
zend2:
rm -rf libraries/Zend
curl -L -# -O ${ZEND2URL} || wget ${ZEND2URL}
tar xzf ${ZEND2FILEBASE}.tgz
mv ${ZEND2FILEBASE}/library/Zend libraries
rm -rf ${ZEND2FILEBASE}.tgz ${ZEND2FILEBASE}

rdfauthor:
rm -rf libraries/RDFauthor
@echo 'Cloning RDFauthor into libraries/RDFauthor ...'
git clone git@github.com:AKSW/RDFauthor.git libraries/RDFauthor

composer-install: #add difference for user and dev (with phpunit etc and without)
php composer.phar install
# test stuff

test-directories:
rm -rf application/tests/cache application/tests/unit/cache application/tests/integration/cache
mkdir -p application/tests/cache application/tests/unit/cache application/tests/integration/cache

test-unit: test-directories
@cd application/tests && phpunit --bootstrap Bootstrap.php unit/

test-unit-cc: test-directories
@cd application/tests/unit && phpunit
$(PHPUNIT) --testsuite "OntoWiki Unit Tests"

test-integration-virtuoso: test-directories
@cd application/tests && EF_STORE_ADAPTER=virtuoso phpunit --bootstrap Bootstrap.php integration/

test-integration-virtuoso-cc: test-directories
@cd application/tests/integration && EF_STORE_ADAPTER=virtuoso phpunit
EF_STORE_ADAPTER=virtuoso $(PHPUNIT) --testsuite "OntoWiki Virtuoso Integration Tests"

test-integration-mysql: test-directories
@cd application/tests && EF_STORE_ADAPTER=zenddb phpunit --bootstrap Bootstrap.php integration/
EF_STORE_ADAPTER=zenddb $(PHPUNIT) --testsuite "OntoWiki Virtuoso Integration Tests"

test-integration-mysql-cc: test-directories
@cd application/tests/integration && EF_STORE_ADAPTER=zenddb phpunit

test-extensions: directories
@phpunit --bootstrap application/tests/BootstrapExtensions.php extensions
test-extensions: #directories
$(PHPUNIT) --testsuite "OntoWiki Extensions Tests"

test:
make test-unit
@@ -217,20 +111,6 @@ test:
make test-extensions


install-test-environment:
sudo apt-get install php-pear
sudo pear config-set auto_discover 1
sudo pear channel-update pear.php.net
sudo pear upgrade pear
sudo pear install -a pear.phpunit.de/PHPUnit
sudo pear install phpunit/PHPUnit_Selenium
sudo pear install phpunit/DbUnit

erfurt@:
rm -rf libraries/Erfurt
@echo 'Cloning Erfurt into libraries/Erfurt ...'
git clone git@github.com:AKSW/Erfurt.git libraries/Erfurt

odbctest:
@application/scripts/odbctest.php

@@ -248,72 +128,19 @@ debianize:


# coding standard

STANDARD =application/tests/CodeSniffer/Standards/Ontowiki/ruleset.xml
# #### config ####
# cs-script path
CSSPATH = application/tests/CodeSniffer/
# ignore pattern
IGNOREPATTERN = libraries,extensions/exconf/pclzip.lib.php,extensions/exconf/Archive.php,application/scripts,extensions/markdown/parser/markdown.php,extensions/queries/lib,extensions/queries/old

# Parameter check
ifndef CHECKPATH
CHECKPATH = "./"
endif
ifdef SNIFFS
SNIFFSTR = "--sniffs="$(SNIFFS)
else
SNIFFSTR =
endif

REQUESTSTR = --ignore=$(IGNOREPATTERN) $(OPTIONS) $(SNIFFSTR) $(CHECKPATH)

cs-default:
chmod ugo+x "$(CSSPATH)cs-scripts.sh"

cs-install: cs-default
$(CSSPATH)cs-scripts.sh -i

cs-install-submodule: cs-submodule-check cs-default
$(CSSPATH)cs-scripts.sh -f $(CSSPATH) -m $(MPATH)

cs-uninstall-submodule: cs-submodule-check cs-default
$(CSSPATH)cs-scripts.sh -n $(MPATH)

cs-uninstall: cs-default
$(CSSPATH)cs-scripts.sh -u

cs-enable: cs-default
$(CSSPATH)cs-scripts.sh -f $(CSSPATH) -e

cs-disable: cs-default
$(CSSPATH)cs-scripts.sh -d
# ignore pattern
IGNOREPATTERN =libraries,extensions/exconf/pclzip.lib.php,extensions/exconf/Archive.php,application/scripts,extensions/markdown/parser/markdown.php,vendor

cs-check-commit:
$(CSSPATH)cs-scripts.sh -p ""
cs-check-commit-emacs:
$(CSSPATH)cs-scripts.sh -p "-remacs"
cs-check-commit-intensive:
$(CSSPATH)cs-scripts.sh -p "-s"
REQUESTSTR =-p --standard=$(STANDARD) --ignore=$(IGNOREPATTERN) --extensions=php */

cs-check:
@$(CSSPATH)cs-scripts.sh -c "-s --report=summary $(REQUESTSTR)"
cs-check-intensive:
@$(CSSPATH)cs-scripts.sh -s -c "-s --report=summary $(REQUESTSTR)"
cs-check-intensive-full:
@$(CSSPATH)cs-scripts.sh -s -c "-s --report=full $(REQUESTSTR)"
cs-check-full:
@$(CSSPATH)cs-scripts.sh -c "-s --report=full $(REQUESTSTR)"
cs-check-emacs:
@$(CSSPATH)cs-scripts.sh -c "--report=emacs $(REQUESTSTR)"
cs-check-blame:
@$(CSSPATH)cs-scripts.sh -c "--report=gitblame $(REQUESTSTR)"
codesniffer:
$(PHPCS) $(REQUESTSTR)

cs-submodule-check:
ifndef MPATH
@echo "You must Set a path to the submodule."
@echo "Example: MPATH=path/to/the/submodule/"
@exit 1
endif
codebeautifier:
$(PHPCBF) $(REQUESTSTR)

# other stuff

@@ -314,15 +314,14 @@ public static function getUriLocalPart($uri)
* @return string
*/
public static function matchMimetypeFromRequest(
Zend_Controller_Request_Abstract $request,
Zend_Controller_Request_Http $request,
array $supportedMimetypes
) {
// get accept header
$acceptHeader = strtolower($request->getHeader('Accept'));

require_once 'Mimeparse.php';
try {
$match = @Mimeparse::best_match($supportedMimetypes, $acceptHeader);
$match = \Bitworking\Mimeparse::bestMatch($supportedMimetypes, $acceptHeader);
} catch (Exception $e) {
$match = '';
}
@@ -437,4 +436,3 @@ static public function to_stdclass_recursive($o)
return $ret;
}
}

@@ -42,29 +42,12 @@
// path to OntoWiki
define('_OWROOT', ONTOWIKI_ROOT);

// add libraries to include path
$includePath = get_include_path() . PATH_SEPARATOR;
$includePath .= _TESTROOT . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'application/classes/' . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'libraries/' . PATH_SEPARATOR;

$includePath .= ONTOWIKI_ROOT . 'libraries/Erfurt/library' . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'libraries/Erfurt/tests/unit' . PATH_SEPARATOR; // for test base class
set_include_path($includePath);
require_once(ONTOWIKI_ROOT . '/vendor/autoload.php');

// start dummy session before any PHPUnit output
require_once 'Zend/Session/Namespace.php';
$session = new Zend_Session_Namespace('OntoWiki_Test');

// Zend_Loader for class autoloading
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('OntoWiki_');
$loader->registerNamespace('Erfurt_');
//$loader->registerNamespace('PHPUnit_');

// Access Erfurt app for constant loading etc.
Erfurt_App::getInstance(false);

/** OntoWiki */
require_once 'OntoWiki.php';

0 comments on commit e03c073

Please sign in to comment.