Skip to content

Commit 99ec962

Browse files
authored
Merge pull request #117 from beyondcode/updates
Laravel 11 compatibility & more
2 parents e6d36fe + 71cccbc commit 99ec962

13 files changed

+102
-81
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ composer.lock
33
docs
44
vendor
55
coverage
6-
.idea
6+
.idea
7+
.phpunit.result.cache
8+
.phpunit.cache
9+
.vscode

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Perform Self-Diagnosis Tests On Your Laravel Application
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/beyondcode/laravel-self-diagnosis.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-self-diagnosis)
4-
[![Build Status](https://img.shields.io/travis/beyondcode/laravel-self-diagnosis/master.svg?style=flat-square)](https://travis-ci.org/beyondcode/laravel-self-diagnosis)
5-
[![Quality Score](https://img.shields.io/scrutinizer/g/beyondcode/laravel-self-diagnosis.svg?style=flat-square)](https://scrutinizer-ci.com/g/beyondcode/laravel-self-diagnosis)
64
[![Total Downloads](https://img.shields.io/packagist/dt/beyondcode/laravel-self-diagnosis.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-self-diagnosis)
75

86
This package allows you to run self-diagnosis tests on your Laravel application. It comes with multiple checks out of the box and allows you to add custom checks yourself.
@@ -50,8 +48,6 @@ You can install the package via composer:
5048
composer require beyondcode/laravel-self-diagnosis
5149
```
5250

53-
If you're using Laravel 5.5+ the `SelfDiagnosisServiceProvider` will be automatically registered for you.
54-
5551
## Usage
5652

5753
Just call the artisan command to start the checks:

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.1|^8.0",
19+
"php": "^8.2",
2020
"composer/semver": "^1.4|^3.0",
2121
"geerlingguy/ping": "^1.1",
22-
"illuminate/support": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0",
23-
"vlucas/phpdotenv": "~2.5|~3.3|^4.0|^5.0"
22+
"illuminate/support": "^9.0|^10.0|^11.0",
23+
"vlucas/phpdotenv": "^5.0"
2424
},
2525
"require-dev": {
2626
"larapack/dd": "^1.0",
2727
"mockery/mockery": "^1.0",
28-
"orchestra/testbench": "~3.5|~3.8",
29-
"phpunit/phpunit": "^7.0|^8.0",
28+
"orchestra/testbench": "^7.0|^8.0",
29+
"phpunit/phpunit": "^9.5.10",
3030
"predis/predis": "^1.1",
3131
"scrutinizer/ocular": "^1.5"
3232
},

phpunit.xml.dist

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="BeyondCode Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
22-
<logging>
23-
<log type="tap" target="build/report.tap"/>
24-
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-html" target="build/coverage"/>
26-
<log type="coverage-text" target="build/coverage.txt"/>
27-
<log type="coverage-clover" target="build/logs/clover.xml"/>
28-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd">
3+
<coverage>
4+
<report>
5+
<clover outputFile="build/logs/clover.xml"/>
6+
<html outputDirectory="build/coverage"/>
7+
<text outputFile="build/coverage.txt"/>
8+
</report>
9+
</coverage>
10+
<testsuites>
11+
<testsuite name="BeyondCode Test Suite">
12+
<directory>tests</directory>
13+
</testsuite>
14+
</testsuites>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
2918
</phpunit>

phpunit.xml.dist.bak

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="BeyondCode Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>

src/Checks/ComposerWithDevDependenciesIsUpToDate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public function check(array $config): bool
4343

4444
$this->output = $this->composer->installDryRun($additionalOptions);
4545

46-
return Str::contains($this->output, ['Nothing to install or update', 'Nothing to install, update or remove']);
46+
return Str::contains($this->output, [
47+
'Nothing to install or update',
48+
'Nothing to install, update or remove',
49+
'Package operations: 0 installs, 0 updates, 0 removals'
50+
]);
4751
}
4852

4953
/**

src/Checks/ComposerWithoutDevDependenciesIsUpToDate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public function check(array $config): bool
4343

4444
$this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions);
4545

46-
return Str::contains($this->output, ['Nothing to install or update', 'Nothing to install, update or remove']);
46+
return Str::contains($this->output, [
47+
'Nothing to install or update',
48+
'Nothing to install, update or remove',
49+
'Package operations: 0 installs, 0 updates, 0 removals'
50+
]);
4751
}
4852

4953
/**

src/Checks/ExampleEnvironmentVariablesAreUpToDate.php

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,14 @@ public function name(array $config): string
2929
*/
3030
public function check(array $config): bool
3131
{
32-
if (method_exists(Dotenv::class, 'createImmutable')) {
33-
return $this->checkForDotEnvV4();
34-
}
32+
$examples = Dotenv::createMutable(base_path(), '.env.example');
33+
$examples = $examples->safeLoad();
3534

36-
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
37-
$examples = Dotenv::create(base_path(), '.env.example');
38-
$actual = Dotenv::create(base_path(), '.env');
39-
} else {
40-
$examples = new Dotenv(base_path(), '.env.example');
41-
$actual = new Dotenv(base_path(), '.env');
42-
}
35+
$actual = Dotenv::createMutable(base_path(), '.env');
36+
$actual = $actual->safeLoad();
4337

44-
$examples->safeLoad();
45-
$actual->safeLoad();
46-
47-
$this->envVariables = Collection::make($actual->getEnvironmentVariableNames())
48-
->diff($examples->getEnvironmentVariableNames());
49-
50-
return $this->envVariables->isEmpty();
51-
}
52-
53-
/**
54-
* Perform the verification of this check for DotEnv v4.
55-
*
56-
* @return bool
57-
*/
58-
private function checkForDotEnvV4(): bool
59-
{
60-
$examples = Dotenv::createImmutable(base_path(), '.env.example');
61-
$actual = Dotenv::createImmutable(base_path(), '.env');
62-
63-
$this->envVariables = Collection::make($actual->safeLoad())
64-
->diffKeys($examples->safeLoad())
38+
$this->envVariables = Collection::make($actual)
39+
->diffKeys($examples)
6540
->keys();
6641

6742
return $this->envVariables->isEmpty();

tests/Console/Kernel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace BeyondCode\SelfDiagnosis\Tests\Console;
4+
5+
class Kernel extends \Illuminate\Foundation\Console\Kernel
6+
{
7+
}

tests/HorizonIsRunningTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace BeyondCode\SelfDiagnosis\Tests;
44

55
use Illuminate\Support\Facades\Artisan;
6-
use Orchestra\Testbench\TestCase;
76
use BeyondCode\SelfDiagnosis\Checks\HorizonIsRunning;
87

98
class HorizonIsRunningTest extends TestCase
109
{
10+
1111
/** @test */
1212
public function it_succeeds_when_horizon_is_running()
1313
{

0 commit comments

Comments
 (0)