From b946f1e754ffb80af1d8cd1236322beee25b1a19 Mon Sep 17 00:00:00 2001 From: Tom Spencer Date: Thu, 10 Feb 2022 14:17:30 +0800 Subject: [PATCH] Update supported versions of PHP and composer packages (#10) --- .gitignore | 5 ++--- .travis.yml | 21 +++++++++-------- composer.json | 35 +++++++++++++++++++++-------- phpunit.xml | 29 ------------------------ phpunit.xml.dist | 26 +++++++++++++++++++++ src/CollectorInterface.php | 2 +- src/ExampleCollector.php | 2 +- src/MetricsController.php | 2 +- src/PrometheusExporter.php | 2 +- src/PrometheusFacade.php | 2 +- src/PrometheusServiceProvider.php | 2 +- src/StorageAdapterFactory.php | 6 ++++- src/routes.php | 5 +++-- tests/MetricsControllerTest.php | 7 ++++-- tests/PrometheusExporterTest.php | 7 ++++-- tests/StorageAdapterFactoryTest.php | 14 +++++++++++- 16 files changed, 103 insertions(+), 64 deletions(-) delete mode 100644 phpunit.xml create mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore index ba93dc5..bcec9e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .idea +.phpunit.cache composer.lock +phpunit.xml vendor -bin -coverage -coverage.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 92fb328..86b8a96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,19 @@ +dist: focal + language: php php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 + - 7.4 + - 8.0 + +branches: + only: + - master before_install: + - echo "extension = apcu.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini -before_script: - - composer install - -script: ./vendor/bin/phpunit --configuration phpunit.xml +script: + - composer test diff --git a/composer.json b/composer.json index 46d3ef1..0d5a744 100644 --- a/composer.json +++ b/composer.json @@ -7,13 +7,17 @@ { "name": "Superbalist.com a division of Takealot Online (Pty) Ltd", "email": "info@superbalist.com" + }, + { + "name": "Thomas Spencer", + "email": "tomspencer244@gmail.com" } ], "require": { - "php": ">=5.6.0", - "illuminate/support": "^5.3 || ^6.0 || ^7.0 || ^8.0", - "illuminate/routing": "^5.3 || ^6.0 || ^7.0 || ^8.0", - "jimdo/prometheus_client_php": "^0.9.0" + "php": "^7.4 || ^8.0", + "illuminate/routing": "^8.50", + "illuminate/support": "^8.50", + "promphp/prometheus_client_php": "^2.0" }, "autoload": { "psr-4": { @@ -22,9 +26,6 @@ } }, "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, "laravel": { "providers": [ "Healthengine\\LaravelPrometheusExporter\\PrometheusServiceProvider" @@ -35,7 +36,23 @@ } }, "require-dev": { - "phpunit/phpunit": "^5.5", - "mockery/mockery": "^1.2.2" + "mockery/mockery": "^1.5", + "orchestra/testbench": "^6.3", + "phpunit/phpunit": "^9.4" + }, + "config": { + "sort-packages": true + }, + "suggest": { + "ext-apcu": "To use the APCu driver." + }, + "scripts": { + "phpunit": "@php vendor/bin/phpunit", + "test": [ + "@composer update --prefer-lowest", + "@composer phpunit", + "@composer update", + "@composer phpunit" + ] } } diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 59500d1..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ./tests/ - - - - - ./src/ - - - - - - - - \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..a7b5c50 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,26 @@ + + + + + src + + + + + ./tests/ + + + \ No newline at end of file diff --git a/src/CollectorInterface.php b/src/CollectorInterface.php index 5ac17a9..3e80591 100644 --- a/src/CollectorInterface.php +++ b/src/CollectorInterface.php @@ -1,6 +1,6 @@ markTestSkipped('APCu extension is not loaded'); + } + + if (!apcu_enabled()) { + $this->markTestSkipped('APCu is not enabled'); + } + $factory = new StorageAdapterFactory(); $adapter = $factory->make('apc'); $this->assertInstanceOf(APC::class, $adapter);