commit 1e43f3e3b231d6a70b5b768cb4fd872cecb7ec54 Author: Abel Hoogeveen Date: Wed Feb 27 13:05:01 2019 +0100 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c7b07b0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +.gitattributes export-ignore +.gitignore export-ignore +.gitlab-ci.yml export-ignore +test/ export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3331564 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +composer.lock +composer.phar +.idea/ +build/ +test/temp/ +vendor/ +application/ +www/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..14bb468 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,82 @@ +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: + - pecl install xdebug + - docker-php-ext-enable xdebug + - 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/LICENSE b/LICENSE new file mode 100644 index 0000000..82fedfb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-2019 TechFuze + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..27c7ff9 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +FuzeWorks::WebApp Component - Readme +=================== + +Version 1.2.0 + +A versatile PHP Framework built to perform. + +https://techfuze.net/fuzeworks + +Summary +------- + +The FuzeWorks is an intermediate component linking all FuzeWorks dependencies into one. This allows the ``FuzeWorks\Application`` +project to update using a single dependency. This component is not very useful independently. Please use the ``FuzeWorks/Application`` +project. + +Copyright +--------- + +Copyright © 2013 onwards -- TechFuze + +Certain libraries are copyrighted by their respective authors; +see the full copyright list for details. + +License +------- + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Licensing of current contributions +---------------------------------- + +Beginning on 2018-04-17, new contributions to this codebase are all licensed +under terms compatible with the MIT license. FuzeWorks is currently +transitioning older code to the MIT License, but work is not yet complete. + +Enjoy! +------ + +TechFuze \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..fe14ae3 --- /dev/null +++ b/composer.json @@ -0,0 +1,36 @@ +{ + "name": "fuzeworks/webappcomponent", + "description": "FuzeWorks WebAppComponent", + "license": ["MIT"], + "authors": [ + { + "name": "TechFuze", + "homepage": "https://techfuze.net" + }, + { + "name": "FuzeWorks Community", + "homepage": "https://techfuze.net/fuzeworks/contributors" + } + ], + "require": { + "php": ">=7.1.0", + "fuzeworks/core": "1.2.0-RC2", + "fuzeworks/mvcr": "1.2.0-RC2", + "fuzeworks/webcomponent": "1.2.0-RC1", + "fuzeworks/tracycomponent": "dev-master", + "fuzeworks/layout": "1.2.0-RC1", + "smarty/smarty": "~3.1.33", + "latte/latte": "~2.4.8", + "fuzeworks/database": "dev-master", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^7" + }, + "autoload": { + "psr-4": { + "FuzeWorks\\": "src/FuzeWorks/" + } + } + +} diff --git a/src/FuzeWorks/WebAppComponent.php b/src/FuzeWorks/WebAppComponent.php new file mode 100644 index 0000000..432ef28 --- /dev/null +++ b/src/FuzeWorks/WebAppComponent.php @@ -0,0 +1,83 @@ + $this]; + } + + public function onAddComponent(Configurator $configurator) + { + // Add dependencies + $webComponent = new WebComponent(); + + // If it is enabled to handle requests, forward this to the WebComponent + if ($this->willHandleRequest) + $webComponent->enableComponent(); + + // And add the component + $configurator->addComponent($webComponent); + $configurator->addComponent(new DatabaseComponent()); + $configurator->addComponent(new LayoutComponent()); + $configurator->addComponent(new TracyComponent()); + } + + public function onCreateContainer(Factory $container) + { + } + + public function enableWebRequest() + { + $this->willHandleRequest = true; + } + + public function disableWebRequest() + { + $this->willHandleRequest = false; + } +} \ No newline at end of file diff --git a/src/FuzeWorks/WebAppController.php b/src/FuzeWorks/WebAppController.php new file mode 100644 index 0000000..860d57a --- /dev/null +++ b/src/FuzeWorks/WebAppController.php @@ -0,0 +1,42 @@ +databases = Factory::getInstance()->databases; + } +} \ No newline at end of file diff --git a/src/FuzeWorks/WebAppView.php b/src/FuzeWorks/WebAppView.php new file mode 100644 index 0000000..3ad0d87 --- /dev/null +++ b/src/FuzeWorks/WebAppView.php @@ -0,0 +1,56 @@ +layouts = Factory::getInstance()->layouts; + } + +} \ No newline at end of file diff --git a/test/autoload.php b/test/autoload.php new file mode 100644 index 0000000..4b38e69 --- /dev/null +++ b/test/autoload.php @@ -0,0 +1,52 @@ + + + + + ./ + + + + + + + + + + + + + ../ + + ../vendor/ + ../test/ + + + + \ No newline at end of file diff --git a/test/webapp/WebAppComponentTest.php b/test/webapp/WebAppComponentTest.php new file mode 100644 index 0000000..2db6aac --- /dev/null +++ b/test/webapp/WebAppComponentTest.php @@ -0,0 +1,57 @@ +component = new WebAppComponent(); + } + + public function isInstance() + { + $this->assertInstanceOf('\FuzeWorks\WebAppComponent', $this->component); + } + +} diff --git a/test/webapp/WebAppTestAbstract.php b/test/webapp/WebAppTestAbstract.php new file mode 100644 index 0000000..a34a30f --- /dev/null +++ b/test/webapp/WebAppTestAbstract.php @@ -0,0 +1,60 @@ +config->discardConfigFiles(); + } +}