From 593be6b5d02c5566b9172b64694472f71b8b7ab9 Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Fri, 1 Feb 2019 11:57:41 +0100 Subject: [PATCH] Implemented minor documentation and continuous integration --- .gitlab-ci.yml | 80 ++++++++++++++++++++++++++++++++++++ .travis.yml | 12 ++++++ src/Config/config.routes.php | 19 ++++++++- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100644 .travis.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..37621d3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,80 @@ +before_script: +# Install dependencies +- set -xe +- apt-get update -yqq +- apt-get install git zip unzip -yqq + +stages: + - build + - test + - deploy + +build:composer: + image: php:7.2 + stage: build + script: + - curl -sS https://getcomposer.org/installer | php + - php composer.phar install + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor/ + +test:7.1: + stage: test + image: php:7.1 + script: + - vendor/bin/phpunit -c test/phpunit.xml + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor + +test:7.2: + stage: test + image: php:7.2 + script: + - vendor/bin/phpunit -c test/phpunit.xml + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor/ + +test:7.3: + stage: test + image: php:7.3 + script: + - vendor/bin/phpunit -c test/phpunit.xml + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor/ + +test:coverage: + stage: test + image: php:7.2 + script: + - pecl install xdebug + - docker-php-ext-enable xdebug + - vendor/bin/phpunit -c test/phpunit.xml --coverage-text + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor/ + +release: + stage: deploy + image: php:7.2 + only: + - master + script: + - vendor/bin/phpunit -c test/phpunit.xml --coverage-text + artifacts: + name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}" + paths: + - build/ + expire_in: 3 weeks + cache: + key: "$CI_BUILD_REF_$CI_BUILD_REF_NAME" + paths: + - vendor/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4930ba4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: php + +php: + - 7.1 + - 7.2 + - 7.3 + +script: + - php vendor/bin/phpunit -v -c test/phpunit.xml --coverage-text + +before_script: + - composer install diff --git a/src/Config/config.routes.php b/src/Config/config.routes.php index 8503dce..3f4a2e3 100644 --- a/src/Config/config.routes.php +++ b/src/Config/config.routes.php @@ -35,7 +35,24 @@ */ /** - * @todo Add documentation + * A route consists of two parts: a 'routeString' and 'routeConfig'. The routeString will be matched against the provided path. + * + * Possible values: + * Default callable: Adds a route that changes the URL structure. Sends all matches to the defaultCallable router + * 'routingString' + * + * Custom callable: Adds a route that sends all matches to the provided callable. Allows user to replace defaultCallable + * 'routingString' => array('callable' => array(CALLABLE)) + * + * Dynamic rewrite: Adds a route that rewrites an URL to a specific controller and method configuration, using a callable. The callable can dynamically determine which page to load. + * 'routingString' => CALLABLE + * + * Static rewrite: Adds a route that rewrites and URL to a specific controller and method using a fixed route. This allows for pre-determined rewrites of pages. + * 'routingString' => ['viewType' => 'someType', 'viewName' => 'someName', 'viewMethod' => 'someMethod', 'viewParameters' => 'someParameters'] + * + * Example routingString: '/^(?P.*?)(|\/(?P.*?)(|\/(?P.*?)))(|\.(?P.*?))$/' + * A routeString has to contain viewName, viewMethod, viewParameters and viewType in order to be processed by defaultCallable. */ + return array( );