Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Update supported versions of PHP and composer packages (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
tspencer244 authored Feb 10, 2022
1 parent 783b457 commit b946f1e
Show file tree
Hide file tree
Showing 16 changed files with 103 additions and 64 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.idea
.phpunit.cache
composer.lock
phpunit.xml
vendor
bin
coverage
coverage.xml
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 26 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
{
"name": "Superbalist.com a division of Takealot Online (Pty) Ltd",
"email": "[email protected]"
},
{
"name": "Thomas Spencer",
"email": "[email protected]"
}
],
"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": {
Expand All @@ -22,9 +26,6 @@
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Healthengine\\LaravelPrometheusExporter\\PrometheusServiceProvider"
Expand All @@ -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"
]
}
}
29 changes: 0 additions & 29 deletions phpunit.xml

This file was deleted.

26 changes: 26 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnSkipped="true"
failOnWarning="true"
verbose="true">
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="laravel-prometheus-exporter/tests">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/CollectorInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

interface CollectorInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/ExampleCollector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use Prometheus\Gauge;

Expand Down
2 changes: 1 addition & 1 deletion src/MetricsController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Routing\Controller;
Expand Down
2 changes: 1 addition & 1 deletion src/PrometheusExporter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use InvalidArgumentException;
use Prometheus\CollectorRegistry;
Expand Down
2 changes: 1 addition & 1 deletion src/PrometheusFacade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use Illuminate\Support\Facades\Facade;

Expand Down
2 changes: 1 addition & 1 deletion src/PrometheusServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
Expand Down
6 changes: 5 additions & 1 deletion src/StorageAdapterFactory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace Superbalist\LaravelPrometheusExporter;
namespace Healthengine\LaravelPrometheusExporter;

use InvalidArgumentException;
use Prometheus\Exception\StorageException;
use Prometheus\Storage\Adapter;
use Prometheus\Storage\APC;
use Prometheus\Storage\InMemory;
Expand All @@ -17,6 +18,9 @@ class StorageAdapterFactory
* @param array $config
*
* @return Adapter
*
* @throws InvalidArgumentException When value of `$driver` is not supported.
* @throws StorageException When using APCu driver and the extension is either not installed or not enabled.
*/
public function make($driver, array $config = [])
{
Expand Down
5 changes: 3 additions & 2 deletions src/routes.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/** @var \Illuminate\Routing\Route $route */
use Illuminate\Support\Facades\Route;

$route = Route::get(
config('prometheus.metrics_route_path'),
\Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
\Healthengine\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
);

if ($name = config('prometheus.metrics_route_name')) {
Expand Down
7 changes: 5 additions & 2 deletions tests/MetricsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
use Mockery;
use PHPUnit\Framework\TestCase;
use Prometheus\RenderTextFormat;
use Superbalist\LaravelPrometheusExporter\MetricsController;
use Superbalist\LaravelPrometheusExporter\PrometheusExporter;
use Healthengine\LaravelPrometheusExporter\MetricsController;
use Healthengine\LaravelPrometheusExporter\PrometheusExporter;

/**
* @covers \Healthengine\LaravelPrometheusExporter\MetricsController
*/
class MetricsControllerTest extends TestCase
{
public function testConstruct()
Expand Down
7 changes: 5 additions & 2 deletions tests/PrometheusExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
use Prometheus\Counter;
use Prometheus\Gauge;
use Prometheus\Histogram;
use Superbalist\LaravelPrometheusExporter\CollectorInterface;
use Superbalist\LaravelPrometheusExporter\PrometheusExporter;
use Healthengine\LaravelPrometheusExporter\CollectorInterface;
use Healthengine\LaravelPrometheusExporter\PrometheusExporter;

/**
* @covers \Healthengine\LaravelPrometheusExporter\PrometheusExporter
*/
class PrometheusExporterTest extends TestCase
{
public function testConstruct()
Expand Down
14 changes: 13 additions & 1 deletion tests/StorageAdapterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
namespace Tests;

use PHPUnit\Framework\TestCase;
use Prometheus\Exception\StorageException;
use Prometheus\Storage\APC;
use Prometheus\Storage\InMemory;
use Prometheus\Storage\Redis;
use Superbalist\LaravelPrometheusExporter\StorageAdapterFactory;
use Healthengine\LaravelPrometheusExporter\StorageAdapterFactory;

/**
* @covers \Healthengine\LaravelPrometheusExporter\StorageAdapterFactory
*/
class StorageAdapterFactoryTest extends TestCase
{
public function testMakeMemoryAdapter()
Expand All @@ -19,6 +23,14 @@ public function testMakeMemoryAdapter()

public function testMakeApcAdapter()
{
if (!extension_loaded('apcu')) {
$this->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);
Expand Down

0 comments on commit b946f1e

Please sign in to comment.