From f3bd01f799ef8c033498ff387a5c5c9a87c171fd Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Wed, 5 Sep 2018 18:10:04 +0200 Subject: [PATCH 01/11] List used zend dependencies as a Dependency of the project --- .gitignore | 2 ++ composer.json | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e69de29..7579f74 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor +composer.lock diff --git a/composer.json b/composer.json index e02d8af..bfdeac7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,10 @@ ], "require": { "php": "^5.6 || ^7.0", - "sentry/sentry": "^1.9.2" + "sentry/sentry": "^1.9.2", + "zendframework/zend-eventmanager": "^2.5|| ^3.0", + "zendframework/zend-mvc": "^2.5 || ^3.0", + "zendframework/zend-log": "^2.5 || ^3.0" }, "conflict": { "zendframework/zendframework": "<3.0.0" From 96811c515ca5478144a21708cf47c216e30dd357 Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Fri, 19 Oct 2018 20:11:30 +0200 Subject: [PATCH 02/11] Install PHPUnit as dev-dependency --- composer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bfdeac7..a84c0cd 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,16 @@ "zendframework/zend-mvc": "^2.5 || ^3.0", "zendframework/zend-log": "^2.5 || ^3.0" }, + "require-dev": { + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.5" + }, "conflict": { "zendframework/zendframework": "<3.0.0" }, "autoload": { "psr-0": { - "ZendSentry": "src/" + "ZendSentry": "src/", + "ZendSentryTests": "tests/" }, "classmap": [ "./Module.php" From 903bfbeb8838c2d7d0605854d683bfc5fbc00fab Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Fri, 19 Oct 2018 22:43:55 +0200 Subject: [PATCH 03/11] Write first tests --- phpunit.xml | 26 +++++++++++++++++ tests/ZendSentryTest/ModuleTest.php | 45 +++++++++++++++++++++++++++++ tests/bootstrap.php | 18 ++++++++++++ tests/configuration.php.dist | 2 ++ 4 files changed, 91 insertions(+) create mode 100644 phpunit.xml create mode 100644 tests/ZendSentryTest/ModuleTest.php create mode 100644 tests/bootstrap.php create mode 100644 tests/configuration.php.dist diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..31a9fc0 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + ./tests/ZendSentryTest + + + + + + ./src + ./../Module.php + + + + + + + + diff --git a/tests/ZendSentryTest/ModuleTest.php b/tests/ZendSentryTest/ModuleTest.php new file mode 100644 index 0000000..efe756d --- /dev/null +++ b/tests/ZendSentryTest/ModuleTest.php @@ -0,0 +1,45 @@ +module = new ZendSentryModule(); + } + + public function testDefaultModuleConfig() + { + $expectedConfig = []; + + $actualConfig = $this->module->getConfig(); + + $this->assertEquals($expectedConfig, $actualConfig); + } + + public function testAutoloaderConfig() + { + $expectedConfig = [ + StandardAutoloader::class => [ + 'namespaces' => [ + 'ZendSentry' => realpath(__DIR__. '/../../src/ZendSentry') + ] + ] + ]; + + $actualConfig = $this->module->getAutoloaderConfig(); + + $this->assertEquals($expectedConfig, $actualConfig); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..393ff00 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,18 @@ +add('ZendSentryTest', __DIR__); + +if (!$config = @include 'configuration.php') { + $config = require 'configuration.php.dist'; +} diff --git a/tests/configuration.php.dist b/tests/configuration.php.dist new file mode 100644 index 0000000..d266508 --- /dev/null +++ b/tests/configuration.php.dist @@ -0,0 +1,2 @@ + Date: Fri, 19 Oct 2018 22:57:37 +0200 Subject: [PATCH 04/11] Add Travis.yml --- .travis.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5221886 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,39 @@ +language: php + +matrix: + fast_finish: true + include: + - env: TEST_DIR=. + php: 5.6 + - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + php: 5.6 + - env: TEST_DIR=. + php: 7.0 + - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + php: 7.0 + - env: TEST_DIR=. + php: 7.1 + - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + php: 7.1 + - env: TEST_DIR=. + php: 7.2 + - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + php: 7.2 + - env: TEST_DIR=. + php: 7.3 + - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + php: 7.3 + +before_install: +- composer self-update + +install: +- composer update -o $COMPOSER_FLAGS + +script: +- ./vendor/bin/phpunit + +cache: + directories: + - vendor + - $HOME/.composer/cache From dff73995e0a9acb9d762df55531b9870f6578db7 Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Fri, 19 Oct 2018 23:06:03 +0200 Subject: [PATCH 05/11] Conver matrix into jobs --- .travis.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5221886..8aa4bb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,27 @@ language: php -matrix: - fast_finish: true +jobs: include: - - env: TEST_DIR=. + - stage: Unit tests + - env: php: 5.6 - - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + - env: COMPOSER_FLAGS="--prefer-lowest" php: 5.6 - - env: TEST_DIR=. + - env: php: 7.0 - - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + - env: COMPOSER_FLAGS="--prefer-lowest" php: 7.0 - - env: TEST_DIR=. + - env: php: 7.1 - - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + - env: COMPOSER_FLAGS="--prefer-lowest" php: 7.1 - - env: TEST_DIR=. + - env: php: 7.2 - - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + - env: COMPOSER_FLAGS="--prefer-lowest" php: 7.2 - - env: TEST_DIR=. + - env: php: 7.3 - - env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest" + - env: COMPOSER_FLAGS="--prefer-lowest" php: 7.3 before_install: From 023d83f22ce16e0fab3b25aa36684b811ccb857a Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Fri, 19 Oct 2018 23:12:51 +0200 Subject: [PATCH 06/11] Drop PHP 5.6 support Since the code already uses the return types there is no way of running this in PHP 5.6 --- .travis.yml | 7 ++----- composer.json | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8aa4bb1..3ac245a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,10 @@ language: php +sudo: false jobs: include: - stage: Unit tests - - env: - php: 5.6 - - env: COMPOSER_FLAGS="--prefer-lowest" - php: 5.6 - - env: + env: php: 7.0 - env: COMPOSER_FLAGS="--prefer-lowest" php: 7.0 diff --git a/composer.json b/composer.json index a84c0cd..6a1b3fa 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ } ], "require": { - "php": "^5.6 || ^7.0", + "php": ">=7.0", "sentry/sentry": "^1.9.2", "zendframework/zend-eventmanager": "^2.5|| ^3.0", "zendframework/zend-mvc": "^2.5 || ^3.0", From f42d5318b4a5d597f7f4cd58b23dbf8ef815ea77 Mon Sep 17 00:00:00 2001 From: markushausammann Date: Sat, 20 Oct 2018 16:58:17 +0200 Subject: [PATCH 07/11] small adjustments for initial testing setup --- .gitignore | 2 +- phpunit.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7579f74..4c6d6ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ vendor -composer.lock +tests/logs diff --git a/phpunit.xml b/phpunit.xml index 31a9fc0..57f8482 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,7 +7,7 @@ stopOnFailure="false" processIsolation="false" > - + ./tests/ZendSentryTest @@ -21,6 +21,6 @@ - + From 5f2e8f1bed4754145f587145fb2ffed601967a4c Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 20 Oct 2018 17:12:45 +0200 Subject: [PATCH 08/11] whitespace fix --- tests/ZendSentryTest/ModuleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ZendSentryTest/ModuleTest.php b/tests/ZendSentryTest/ModuleTest.php index efe756d..8d98e9c 100644 --- a/tests/ZendSentryTest/ModuleTest.php +++ b/tests/ZendSentryTest/ModuleTest.php @@ -33,7 +33,7 @@ public function testAutoloaderConfig() $expectedConfig = [ StandardAutoloader::class => [ 'namespaces' => [ - 'ZendSentry' => realpath(__DIR__. '/../../src/ZendSentry') + 'ZendSentry' => realpath(__DIR__.'/../../src/ZendSentry') ] ] ]; From 4045dd3c38704f247b4d28794731ae5d4d23cf98 Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 20 Oct 2018 17:34:00 +0200 Subject: [PATCH 09/11] add travis batch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 173d613..e49cb1e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ A Zend Framework 3 module that lets you log exceptions, errors or whatever you wish to the Sentry.io service. -Scrutizier analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/build.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/build-status/master) +Scrutizier analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry) ZendSentry is released under the MIT License. From 17253156f4aba9a95c2b23a4090195d981fa67cd Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 20 Oct 2018 17:41:57 +0200 Subject: [PATCH 10/11] nicer layout for batches --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e49cb1e..63a5383 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ A Zend Framework 3 module that lets you log exceptions, errors or whatever you wish to the Sentry.io service. -Scrutizier analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry) +Static analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) + +Travis: [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry) ZendSentry is released under the MIT License. From 9b42711a5bf382c917336ccea8e11b999c90118f Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 20 Oct 2018 17:45:19 +0200 Subject: [PATCH 11/11] meh... text and batches in one line looks shit --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 63a5383..6fc3b27 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ A Zend Framework 3 module that lets you log exceptions, errors or whatever you wish to the Sentry.io service. -Static analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) - -Travis: [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry) ZendSentry is released under the MIT License.