diff --git a/.gitignore b/.gitignore index d2a4c00..c1fcba1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /tests/coverage composer.lock .idea +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index c763d7b..4ad775c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - '7.2' + - '7.3' install: composer install script: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml after_success: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d362cc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM php:7.3-fpm-alpine + +# The following labels need to be set as part of the docker build process. +# org.opencontainers.image.created +# org.opencontainers.image.revision +LABEL org.opencontainers.image.url="https://laravel.com" \ + org.opencontainers.image.documentation="https://github.com/generationtux/php-healthz/blob/master/README.md" \ + org.opencontainers.image.source="https://github.com/generationtux/php-healthz/Dockerfile" \ + org.opencontainers.image.vendor="Generation Tux " \ + org.opencontainers.image.title="Laravel 6.x" \ + org.opencontainers.image.description="PHP built for use with the Laravel/Lumen framework" \ + com.generationtux.php.backend="fpm" + +USER root + +COPY ./docker/installComposer.sh /tmp/installComposer.sh + +RUN apk --no-cache --update add bash ca-certificates libpq postgresql-dev curl git curl git mysql-client unzip wget zip postgresql-client \ + && apk add --no-cache --virtual build-dependencies autoconf build-base g++ make \ + && pecl install redis xdebug \ + && docker-php-ext-install bcmath opcache pdo_mysql pdo_pgsql pcntl \ + && docker-php-ext-enable bcmath opcache redis xdebug \ + && chmod +x /tmp/installComposer.sh \ + && /tmp/installComposer.sh \ + && chown www-data:www-data /usr/local/bin/composer \ + && apk del --purge autoconf build-dependencies g++ make \ + && chown -R www-data:www-data /var/www + +WORKDIR /var/www + +USER www-data:www-data diff --git a/composer.json b/composer.json index 3dd79a1..ab5a19e 100644 --- a/composer.json +++ b/composer.json @@ -26,17 +26,18 @@ ] }, "require": { - "guzzlehttp/guzzle": "~6.0", + "php": ">=7.3", + "guzzlehttp/guzzle": "^6.2", "aws/aws-sdk-php": "~3.0", - "illuminate/contracts": "^6.0", - "illuminate/database": "^6.0", - "illuminate/queue": "^6.0", - "illuminate/console": "^6.0", - "twig/twig": "~1.0" + "illuminate/contracts": "^7.0", + "illuminate/database": "^7.0", + "illuminate/queue": "^7.0", + "illuminate/console": "^7.0", + "twig/twig": "~3.0" }, "require-dev": { - "phpunit/phpunit": "^7.0", - "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^8.5", + "mockery/mockery": "^1.2.1", "gecko-packages/gecko-memcache-mock": "^1.0" }, "extra": { diff --git a/docker-compose.yaml b/docker-compose.yaml index 06cd7c7..b747ab8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,9 @@ version: '3' services: app: - image: gentux/php:lumen-5.6-ci + build: + context: . + dockerfile: ./Dockerfile volumes: - ./:/var/www ports: diff --git a/docker/installComposer.sh b/docker/installComposer.sh new file mode 100755 index 0000000..b034dea --- /dev/null +++ b/docker/installComposer.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_SIGNATURE=$(php -r "echo hash_file('sha384', 'composer-setup.php');") + +if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then + >&2 echo 'ERROR: Invalid installer signature' + rm composer-setup.php + exit 1 +fi + +php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet +RESULT=$? +rm composer-setup.php +if [[ "$RESULT" -eq "0" ]]; then + composer global require hirak/prestissimo +fi; +exit $RESULT +Terms diff --git a/phpunit.xml b/phpunit.xml index 5b8e91e..60690ea 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,8 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="true" - syntaxCheck="false"> + stopOnFailure="true"> ./tests/ diff --git a/readme.md b/readme.md index 07bfa44..2cbd217 100644 --- a/readme.md +++ b/readme.md @@ -237,3 +237,39 @@ public function run() throw new HealthWarningException("The check didn't fail, but here ye be warned."); } ``` + + +## Contributing + +### What you need +* [docker & docker-compose](https://docs.docker.com/compose/install/) +* a fork of this repo + +### Bringing up the development environment + +```sh +docker-compose up -d +``` + +### Exec into the container +```sh +docker-compose exec app bash +``` +### Composer install +```sh +composer install +``` + +### Running the tests +```sh +./vendor/bin/phpunit +``` + + +### Finally +Make your changes and add any needed tests around said changes. +Then open a pull request into the generationtux repository. + + + + diff --git a/src/Checks/General/DebugHealthCheck.php b/src/Checks/General/DebugHealthCheck.php index 1e0f35b..bd6639f 100644 --- a/src/Checks/General/DebugHealthCheck.php +++ b/src/Checks/General/DebugHealthCheck.php @@ -29,11 +29,11 @@ public function __construct($env = 'APP_DEBUG') /** * Check if the app is in debug mode * - * @return mixed + * @return void * * @throws HealthWarningException */ - public function run() + public function run(): void { $debug = getenv($this->env) == 'true'; diff --git a/src/Checks/General/EnvHealthCheck.php b/src/Checks/General/EnvHealthCheck.php index cc63185..979c666 100644 --- a/src/Checks/General/EnvHealthCheck.php +++ b/src/Checks/General/EnvHealthCheck.php @@ -29,8 +29,10 @@ public function __construct($env = 'APP_ENV') /** * Run the health check + * + * @throws HealthWarningException */ - public function run() + public function run(): void { $env = getenv($this->env) ?: 'UNKNOWN'; if ($env == 'UNKNOWN') { diff --git a/src/Checks/General/HttpHealthCheck.php b/src/Checks/General/HttpHealthCheck.php index b787e2b..57da612 100644 --- a/src/Checks/General/HttpHealthCheck.php +++ b/src/Checks/General/HttpHealthCheck.php @@ -6,6 +6,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\Request; use Gentux\Healthz\HealthCheck; +use Psr\Http\Message\ResponseInterface; /** * Health check for HTTP endpoints @@ -41,11 +42,11 @@ public function __construct(Request $request, $expectedStatusCode = 200, array $ /** * Send the request * - * @return mixed + * @return ResponseInterface * - * @throws HealthFailureException + * @throws HealthFailureException|RequestException */ - public function run() + public function run(): ResponseInterface { try { $response = $this->guzzle()->send( @@ -156,7 +157,7 @@ public function guzzle() * * @return string */ - public function description() + public function description(): ?string { $description = $this->description; diff --git a/src/Checks/General/MemcachedHealthCheck.php b/src/Checks/General/MemcachedHealthCheck.php index 90f6d6c..7799b0e 100644 --- a/src/Checks/General/MemcachedHealthCheck.php +++ b/src/Checks/General/MemcachedHealthCheck.php @@ -31,9 +31,11 @@ public function __construct($memcached = null) /** * Check for connection to memcached servers * - * @return mixed + * @return void + * + * @throws HealthFailureException */ - public function run() + public function run(): void { if (count($this->servers())) { $this->memcached->addServers($this->servers()); @@ -64,7 +66,7 @@ public function run() * * @return self */ - public function addServer($server, $port = 11211, $weight = 0) + public function addServer($server, $port = 11211, $weight = 0): HealthCheck { $this->servers[] = [$server, $port, $weight]; @@ -76,7 +78,7 @@ public function addServer($server, $port = 11211, $weight = 0) * * @return array */ - public function servers() + public function servers(): array { return $this->servers; } @@ -88,7 +90,7 @@ public function servers() * * @return self */ - public function setOptions(array $options) + public function setOptions(array $options): HealthCheck { $this->options = $options; @@ -100,7 +102,7 @@ public function setOptions(array $options) * * @return array */ - public function options() + public function options(): array { return $this->options; } @@ -113,7 +115,7 @@ public function options() * * @return self */ - public function setAuth($username, $password) + public function setAuth($username, $password): HealthCheck { $this->username = $username; $this->password = $password; @@ -126,7 +128,7 @@ public function setAuth($username, $password) * * @return string|null */ - public function username() + public function username(): ?string { return $this->username; } @@ -136,7 +138,7 @@ public function username() * * @return string|null */ - public function password() + public function password(): ?string { return $this->password; } diff --git a/src/Checks/Laravel/DatabaseHealthCheck.php b/src/Checks/Laravel/DatabaseHealthCheck.php index d229434..ba7e71a 100644 --- a/src/Checks/Laravel/DatabaseHealthCheck.php +++ b/src/Checks/Laravel/DatabaseHealthCheck.php @@ -42,11 +42,11 @@ public function __construct(DatabaseManager $db = null) /** * Check database connection * - * @return mixed + * @return void * * @throws HealthFailureException */ - public function run() + public function run(): void { try { $name = $this->connection(); @@ -63,7 +63,7 @@ public function run() * * @return null|string */ - public function connection() + public function connection(): ?string { return $this->connection; } @@ -72,8 +72,10 @@ public function connection() * Set the connection name * * @param string $connection + * + * @return void */ - public function setConnection($connection) + public function setConnection($connection): void { $this->connection = $connection; } @@ -81,8 +83,10 @@ public function setConnection($connection) /** * If no description property is defined, use the connection * name instead ('default' if connection is also null). + * + * @return string */ - public function description() + public function description(): string { $description = $this->description; diff --git a/src/Checks/Laravel/QueueHealthCheck.php b/src/Checks/Laravel/QueueHealthCheck.php index d75d3a6..5252938 100644 --- a/src/Checks/Laravel/QueueHealthCheck.php +++ b/src/Checks/Laravel/QueueHealthCheck.php @@ -45,12 +45,12 @@ public function __construct(QueueManager $queue = null) /** * Check database connection * - * @return mixed + * @return void * * @throws HealthFailureException * @throws HealthWarningException */ - public function run() + public function run(): void { $name = $this->name(); $queue = $this->queue->connection($name); @@ -68,8 +68,10 @@ public function run() * Run the health check against an sqs queue * * @param SqsQueue $queue + * + * @return void */ - protected function runSqsCheck(SqsQueue $queue) + protected function runSqsCheck(SqsQueue $queue): void { $url = $queue->getQueue(null); $queue->getSqs()->getQueueAttributes(['QueueUrl' => $url]); @@ -82,8 +84,10 @@ protected function runSqsCheck(SqsQueue $queue) * just set the status. * * @param SyncQueue $queue + * + * @return void */ - protected function runSyncCheck(SyncQueue $queue) + protected function runSyncCheck(SyncQueue $queue): void { $this->setStatus('connected to Sync queue'); } @@ -93,7 +97,7 @@ protected function runSyncCheck(SyncQueue $queue) * * @return null|string */ - public function name() + public function name(): ?string { return $this->name; } @@ -102,8 +106,10 @@ public function name() * Set the queue name * * @param string $name + * + * @return void */ - public function setName($name) + public function setName($name): void { $this->name = $name; } @@ -111,9 +117,9 @@ public function setName($name) /** * If no description property is defined, use the queue name instead. * - * @return string + * @return string|null */ - public function description() + public function description(): ?string { $description = $this->description ?: $this->name(); diff --git a/src/HealthCheck.php b/src/HealthCheck.php index 9161e1c..4da347b 100644 --- a/src/HealthCheck.php +++ b/src/HealthCheck.php @@ -39,7 +39,7 @@ abstract public function run(); * * @return string */ - public function title() + public function title(): string { $title = $this->title; @@ -58,7 +58,7 @@ public function title() * * @return $this */ - public function setTitle($title) + public function setTitle($title): self { $this->title = $title; @@ -70,7 +70,7 @@ public function setTitle($title) * * @return null|string */ - public function description() + public function description(): ?string { return $this->description; } @@ -82,7 +82,7 @@ public function description() * * @return $this */ - public function setDescription($description) + public function setDescription($description): self { $this->description = $description; @@ -97,7 +97,7 @@ public function setDescription($description) * * @return null|string */ - public function status() + public function status(): ?string { return $this->status; } @@ -109,10 +109,10 @@ public function status() * * @return $this */ - public function setStatus($status) + public function setStatus($status): self { $this->status = $status; - return $status; + return $this; } } diff --git a/src/HealthResult.php b/src/HealthResult.php index e632b7a..c2bca4c 100644 --- a/src/HealthResult.php +++ b/src/HealthResult.php @@ -18,6 +18,12 @@ class HealthResult /** @var HealthCheck */ protected $check; + /** + * HealthResult constructor. + * + * @param $result + * @param HealthCheck $check + */ public function __construct($result, HealthCheck $check) { $this->result = $result; @@ -29,7 +35,7 @@ public function __construct($result, HealthCheck $check) * * @return bool */ - public function failed() + public function failed(): bool { return $this->result() === self::RESULT_FAILURE; } @@ -39,7 +45,7 @@ public function failed() * * @return bool */ - public function passed() + public function passed(): bool { return $this->result() === self::RESULT_SUCCESS; } @@ -49,30 +55,42 @@ public function passed() * * @return bool */ - public function warned() + public function warned(): bool { return $this->result() === self::RESULT_WARNING; } /** Getters: information about the health check */ - public function title() + /** + * @return string + */ + public function title(): string { return $this->check->title(); } - public function description() + /** + * @return string + */ + public function description(): string { return $this->check->description(); } - public function status() + /** + * @return string|null + */ + public function status(): ?string { return $this->check->status(); } - public function result() + /** + * @return int + */ + public function result(): int { return $this->result; } -} \ No newline at end of file +} diff --git a/src/Healthz.php b/src/Healthz.php index 344c090..9cac6f8 100644 --- a/src/Healthz.php +++ b/src/Healthz.php @@ -34,7 +34,7 @@ public function __construct($healthChecks = []) * * @return $this */ - public function push(HealthCheck $healthCheck) + public function push(HealthCheck $healthCheck): self { return $this->stackPush($healthCheck); } @@ -44,7 +44,7 @@ public function push(HealthCheck $healthCheck) * * @return ResultStack */ - public function run() + public function run(): ResultStack { $results = []; @@ -73,7 +73,7 @@ public function run() * * @return string */ - public function html(ResultStack $results=null) + public function html(ResultStack $results=null): string { if ($results === null) { $results = $this->run(); diff --git a/src/ResultStack.php b/src/ResultStack.php index 4f6e670..d1a8384 100644 --- a/src/ResultStack.php +++ b/src/ResultStack.php @@ -15,12 +15,22 @@ class ResultStack Stack::push as stackPush; } + /** + * ResultStack constructor. + * + * @param array $results + */ public function __construct(array $results=[]) { $this->items = $results; } - public function push(HealthResult $result) + /** + * @param HealthResult $result + * + * @return Stack + */ + public function push(HealthResult $result): ResultStack { return $this->stackPush($result); } @@ -30,7 +40,7 @@ public function push(HealthResult $result) * * @return bool */ - public function hasFailures() + public function hasFailures(): bool { $hasFailure = false; foreach ($this->all() as $result) { @@ -48,7 +58,7 @@ public function hasFailures() * * @return bool */ - public function hasWarnings() + public function hasWarnings(): bool { $hasWarning = false; foreach($this->all() as $result) { diff --git a/src/Support/HealthzArtisanCommand.php b/src/Support/HealthzArtisanCommand.php index 8920780..43d22d7 100644 --- a/src/Support/HealthzArtisanCommand.php +++ b/src/Support/HealthzArtisanCommand.php @@ -28,7 +28,7 @@ public function __construct(Healthz $checks) * * @return int */ - public function handle() + public function handle(): int { if (count($this->checks->all()) == 0) { $this->comment("No health checks registered. Be sure to register Gentux\Healthz\Healthz in a service provider. See github.com/generationtux/php-healthz for more info."); @@ -51,8 +51,10 @@ public function handle() * Output message about health check result * * @param HealthResult $result + * + * @return void */ - protected function outputCheckResult(HealthResult $result) + protected function outputCheckResult(HealthResult $result): void { $message = $result->title() . ": " . $result->status(); @@ -70,4 +72,4 @@ protected function outputCheckResult(HealthResult $result) $this->comment($message); } } -} \ No newline at end of file +} diff --git a/src/Support/Stack.php b/src/Support/Stack.php index 5f588d1..b0bd3dd 100644 --- a/src/Support/Stack.php +++ b/src/Support/Stack.php @@ -14,29 +14,44 @@ trait Stack /** * @return array */ - public function all() + public function all(): array { return $this->items; } - public function push($item) + /** + * @param $item + * + * @return $this + */ + public function push($item): self { $this->items[] = $item; return $this; } - public function merge(array $items) + /** + * @param array $items + * + * @return $this + */ + public function merge(array $items): self { $this->items = array_merge($this->items, $items); return $this; } - public function replace(array $items) + /** + * @param array $items + * + * @return $this + */ + public function replace(array $items): self { $this->items = $items; return $this; } -} \ No newline at end of file +} diff --git a/tests/Checks/General/DebugHealthCheckTest.php b/tests/Checks/General/DebugHealthCheckTest.php index 2db5652..6f6bafc 100644 --- a/tests/Checks/General/DebugHealthCheckTest.php +++ b/tests/Checks/General/DebugHealthCheckTest.php @@ -6,7 +6,7 @@ class DebugHealthCheckTest extends \TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); $this->debug = new DebugHealthCheck(); @@ -29,10 +29,10 @@ public function run_sets_the_description_to_off() /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthWarningException */ public function run_throws_warning_exception_if_debug_is_on() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthWarningException::class); $this->debug = new DebugHealthCheck('DEBUG_CUSTOM'); putenv('DEBUG_CUSTOM=true'); diff --git a/tests/Checks/General/EnvHealthCheckTest.php b/tests/Checks/General/EnvHealthCheckTest.php index 0035691..f8138bc 100644 --- a/tests/Checks/General/EnvHealthCheckTest.php +++ b/tests/Checks/General/EnvHealthCheckTest.php @@ -10,7 +10,7 @@ class EnvHealthCheckTest extends \TestCase /** @var EnvHealthCheck */ protected $env; - public function setUp() + public function setUp(): void { parent::setUp(); $this->env = new EnvHealthCheck('CUSTOM_ENV'); @@ -32,10 +32,10 @@ public function sets_the_status_to_the_current_environment() /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthWarningException */ public function unknown_environment_emits_a_warning() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthWarningException::class); putenv('CUSTOM_ENV='); $this->env->run(); } diff --git a/tests/Checks/General/HttpHealthCheckTest.php b/tests/Checks/General/HttpHealthCheckTest.php index cb1d02e..4e353b3 100644 --- a/tests/Checks/General/HttpHealthCheckTest.php +++ b/tests/Checks/General/HttpHealthCheckTest.php @@ -21,7 +21,7 @@ class HttpHealthCheckTest extends \TestCase /** @var HttpHealthCheck */ protected $http; - public function setUp() + public function setUp(): void { parent::setUp(); $this->request = Mockery::mock(Request::class); @@ -77,14 +77,15 @@ public function run_sends_the_request() $this->guzzle->shouldReceive('send')->with($this->request, [])->once()->andReturn($response); $this->http->run(); + $this->assertTrue(true); } /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthFailureException */ public function run_throws_an_exception_if_the_expected_response_code_doesnt_match() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthFailureException::class); $response = Mockery::mock(Response::class); $response->shouldReceive('getStatusCode')->andReturn(201); @@ -106,6 +107,7 @@ public function run_catches_guzzle_exceptions_to_compare_status_code() $this->http->setExpectedStatusCode(404); $this->http->run(); // no exceptions, should pass + $this->assertTrue(true); } /** @test */ diff --git a/tests/Checks/General/MemcachedHealthCheckTest.php b/tests/Checks/General/MemcachedHealthCheckTest.php index e533321..608e8d2 100644 --- a/tests/Checks/General/MemcachedHealthCheckTest.php +++ b/tests/Checks/General/MemcachedHealthCheckTest.php @@ -23,7 +23,7 @@ class MemcachedHealthCheckTest extends \TestCase /** @var MemcachedHealthCheck */ protected $health; - public function setUp() + public function setUp(): void { parent::setUp(); $this->memcached = Mockery::mock(MemcachedMock::class); @@ -81,14 +81,15 @@ public function run_builds_memcached_instance_and_tests_connection() $this->memcached->shouldReceive('set')->with('test.connection', 'success', 1)->once()->andReturn(true); $this->health->run(); + $this->assertTrue(true); } /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthFailureException */ public function run_throws_failure_exception_if_memcached_cant_set_test_value() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthFailureException::class); $this->memcached->shouldReceive('set')->with('test.connection', 'success', 1)->once()->andReturn(false); $this->health->run(); } diff --git a/tests/Checks/Laravel/DatabaseHealthCheckTest.php b/tests/Checks/Laravel/DatabaseHealthCheckTest.php index eaa5e40..20b5ab8 100644 --- a/tests/Checks/Laravel/DatabaseHealthCheckTest.php +++ b/tests/Checks/Laravel/DatabaseHealthCheckTest.php @@ -16,7 +16,7 @@ class DatabaseHealthCheckTest extends \TestCase /** @var DatabaseHealthCheck */ protected $db; - public function setUp() + public function setUp(): void { parent::setUp(); $this->manager = Mockery::mock(DatabaseManager::class); @@ -64,10 +64,10 @@ public function uses_the_connection_name_set_to_resolve_a_laravel_db_connection( /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthFailureException */ public function throws_health_failure_when_laravel_runs_into_trouble() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthFailureException::class); $this->manager->shouldReceive('connection')->andThrow(new \Exception()); $this->db->run(); } diff --git a/tests/Checks/Laravel/QueueHealthCheckTest.php b/tests/Checks/Laravel/QueueHealthCheckTest.php index fcc871e..164221f 100644 --- a/tests/Checks/Laravel/QueueHealthCheckTest.php +++ b/tests/Checks/Laravel/QueueHealthCheckTest.php @@ -19,7 +19,7 @@ class QueueHealthCheckTest extends \TestCase /** @var QueueHealthCheck */ protected $queue; - public function setUp() + public function setUp(): void { parent::setUp(); $this->manager = Mockery::mock(QueueManager::class); @@ -90,10 +90,10 @@ public function checks_status_of_sync_queue() /** * @test - * @expectedException \Gentux\Healthz\Exceptions\HealthWarningException */ public function throws_warning_if_queue_driver_is_not_supported() { + $this->expectException(\Gentux\Healthz\Exceptions\HealthWarningException::class); $redis = Mockery::mock(RedisQueue::class); $this->manager->shouldReceive('connection')->andReturn($redis); diff --git a/tests/HealthCheckTest.php b/tests/HealthCheckTest.php index 3c512e7..1ef376d 100644 --- a/tests/HealthCheckTest.php +++ b/tests/HealthCheckTest.php @@ -13,7 +13,7 @@ class HealthCheckTest extends \TestCase /** @var MockCheckTitle */ protected $checkWithTitle; - public function setUp() + public function setUp(): void { parent::setUp(); $this->check = new MockCheck(); diff --git a/tests/HealthResultTest.php b/tests/HealthResultTest.php index 00cfd05..3a37af2 100644 --- a/tests/HealthResultTest.php +++ b/tests/HealthResultTest.php @@ -15,7 +15,7 @@ class HealthResultTest extends \TestCase /** @var HealthResult*/ protected $resultFailure; - public function setUp() + public function setUp(): void { parent::setUp(); $check = Mockery::mock(HealthCheck::class); diff --git a/tests/HealthzTest.php b/tests/HealthzTest.php index d2cf7cd..ac366c0 100644 --- a/tests/HealthzTest.php +++ b/tests/HealthzTest.php @@ -20,7 +20,7 @@ class HealthzTest extends \TestCase /** @var Healthz */ protected $healthz; - public function setUp() + public function setUp(): void { parent::setUp(); $this->check1 = Mockery::mock(HealthCheck::class); diff --git a/tests/ResultStackTest.php b/tests/ResultStackTest.php index 64593b0..e47b531 100644 --- a/tests/ResultStackTest.php +++ b/tests/ResultStackTest.php @@ -18,7 +18,7 @@ class ResultStackTest extends \TestCase /** @var HealthResult */ protected $checkWarned; - public function setUp() + public function setUp(): void { $this->checkPassed = Mockery::mock(HealthResult::class); $this->checkPassed->shouldReceive('failed')->andReturn(false); diff --git a/tests/TestCase.php b/tests/TestCase.php index e888df3..24e31ac 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,7 +3,7 @@ class TestCase extends \PHPUnit\Framework\TestCase { - public function tearDown() + public function tearDown(): void { Mockery::close(); parent::tearDown();