Skip to content

Commit 7b0322f

Browse files
Merge pull request #7 from kirschbaum-development/laravel-11
Laravel 11 Support
2 parents f7cbb2a + 94bfdcc commit 7b0322f

File tree

10 files changed

+93
-98
lines changed

10 files changed

+93
-98
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,34 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [7.4, 8.0, 8.1, 8.2, 8.3]
13-
laravel: [6.*, 7.*, 8.*, 9.*, 10.*]
12+
php: [8.0, 8.1, 8.2, 8.3]
13+
laravel: [8.*, 9.*, 10.*, 11.*]
1414
exclude:
15-
- php: 7.4
16-
laravel: 9.*
17-
- php: 7.4
18-
laravel: 10.*
19-
- php: 8.0
20-
laravel: 10.*
21-
- php: 8.1
22-
laravel: 6.*
23-
- php: 8.1
24-
laravel: 7.*
25-
- php: 8.2
26-
laravel: 6.*
27-
- php: 8.2
28-
laravel: 7.*
29-
- php: 8.2
30-
laravel: 8.*
31-
- php: 8.3
32-
laravel: 6.*
33-
- php: 8.3
34-
laravel: 7.*
35-
- php: 8.3
36-
laravel: 8.*
37-
- php: 8.3
38-
laravel: 9.*
15+
- laravel: 11.*
16+
php: 8.0
17+
- laravel: 11.*
18+
php: 8.1
19+
- laravel: 10.*
20+
php: 8.0
21+
- laravel: 8.*
22+
php: 8.1
23+
- laravel: 8.*
24+
php: 8.2
25+
- laravel: 9.*
26+
php: 8.2
27+
- laravel: 8.*
28+
php: 8.3
29+
- laravel: 9.*
30+
php: 8.3
3931
include:
32+
- laravel: 11.*
33+
testbench: 9.*
4034
- laravel: 10.*
4135
testbench: 8.*
4236
- laravel: 9.*
4337
testbench: 7.*
4438
- laravel: 8.*
4539
testbench: 6.*
46-
- laravel: 7.*
47-
testbench: 5.*
48-
- laravel: 6.*
49-
testbench: 4.*
5040

5141
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
5242

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
build/*
66
composer.lock
77
vendor/
8+
.phpunit.cache

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Laravel Preflight Checks
22

3-
![Laravel Supported Versions](https://img.shields.io/badge/laravel-6.x/7.x/8.x/9.x/10.x-green.svg)
3+
![Laravel Supported Versions](https://img.shields.io/badge/laravel-6.x/7.x/8.x/9.x/10.x/11.x-green.svg)
44
[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
55

66
Performs pre-flight checks to ensure configuration and setup for deployment or development.

composer.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,28 @@
88
"type": "library",
99
"license": "MIT",
1010
"authors": [
11+
{
12+
"name": "Victor Leite",
13+
"email": "[email protected]",
14+
"role": "Developer"
15+
},
1116
{
1217
"name": "Zack Teska",
13-
"email": "zack@kirschbaumdevelopment.com",
18+
"email": "hello@kirschbaumdevelopment.com",
1419
"role": "Developer"
1520
}
1621
],
1722
"require": {
18-
"php": "^7.4|^8.0",
19-
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
20-
"illuminate/pipeline": "^6.0|^7.0|^8.0|^9.0|^10.0"
23+
"php": "^8.0",
24+
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
25+
"illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0"
2126
},
2227
"require-dev": {
23-
"doctrine/dbal": "^2.0",
28+
"doctrine/dbal": "^2.0|^3.0|^4.0",
2429
"fakerphp/faker": "^1.9.1",
2530
"mockery/mockery": "^1.3.1",
26-
"orchestra/testbench": "4.*|5.*|6.*|7.*|8.*",
27-
"phpunit/phpunit": "^9.0"
31+
"orchestra/testbench": "4.*|5.*|6.*|7.*|8.*|9.*",
32+
"phpunit/phpunit": "^9.0|^10.0"
2833
},
2934
"autoload": {
3035
"psr-4": {

phpunit.xml.dist

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
bootstrap="vendor/autoload.php"
4-
backupGlobals="false"
5-
backupStaticAttributes="false"
6-
colors="true"
7-
verbose="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
13-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
14-
<coverage>
15-
<include>
16-
<directory suffix=".php">src/</directory>
17-
</include>
18-
</coverage>
19-
<testsuites>
20-
<testsuite name="Test Suite">
21-
<directory>tests</directory>
22-
</testsuite>
23-
</testsuites>
24-
<logging>
25-
<junit outputFile="build/report.junit.xml" />
26-
</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.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Test Suite">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<logging>
9+
<junit outputFile="build/report.junit.xml"/>
10+
</logging>
11+
<source>
12+
<include>
13+
<directory suffix=".php">src/</directory>
14+
</include>
15+
</source>
2716
</phpunit>

tests/Checks/BasePreflightCheckTest.php renamed to tests/Checks/BasePreflightCheck.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Kirschbaum\PreflightChecks\Tests\Checks;
44

5-
use Kirschbaum\PreflightChecks\Checks\PreflightCheck;
5+
use Orchestra\Testbench\TestCase;
66
use Kirschbaum\PreflightChecks\Checks\Result;
7+
use Kirschbaum\PreflightChecks\Checks\PreflightCheck;
78
use Kirschbaum\PreflightChecks\PreflightChecksServiceProvider;
89
use Kirschbaum\PreflightChecks\Tests\Helpers\CanAccessProtected;
9-
use Orchestra\Testbench\TestCase;
1010

11-
abstract class BasePreflightCheckTest extends TestCase
11+
abstract class BasePreflightCheck extends TestCase
1212
{
1313
use CanAccessProtected;
1414

@@ -17,11 +17,6 @@ abstract class BasePreflightCheckTest extends TestCase
1717
*/
1818
protected $preflightCheckClass;
1919

20-
protected function getPackageProviders($app)
21-
{
22-
return [PreflightChecksServiceProvider::class];
23-
}
24-
2520
public function checkConfigValues(PreflightCheck $preflightCheck)
2621
{
2722
$config = $this->getProtectedProperty($preflightCheck, 'requiredConfig');
@@ -36,6 +31,11 @@ public function checkConfigValues(PreflightCheck $preflightCheck)
3631
}
3732
}
3833

34+
protected function getPackageProviders($app)
35+
{
36+
return [PreflightChecksServiceProvider::class];
37+
}
38+
3939
protected function assertPassed(Result $result): void
4040
{
4141
$this->assertTrue($result->passed());

tests/Checks/ConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Kirschbaum\PreflightChecks\Tests\Checks;
44

5-
use Kirschbaum\PreflightChecks\Checks\Configuration;
65
use Kirschbaum\PreflightChecks\Checks\Result;
6+
use Kirschbaum\PreflightChecks\Checks\Configuration;
77

8-
class ConfigurationTest extends BasePreflightCheckTest
8+
class ConfigurationTest extends BasePreflightCheck
99
{
1010
protected $preflightCheckClass = Configuration::class;
1111

tests/Checks/DatabaseTest.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,33 @@
22

33
namespace Kirschbaum\PreflightChecks\Tests\Checks;
44

5+
use PDO;
6+
use Mockery;
7+
use PDOException;
8+
use Illuminate\Support\Facades\DB;
59
use Doctrine\DBAL\Driver\PDO\Exception;
610
use Doctrine\DBAL\Driver\PDOConnection;
7-
use Illuminate\Support\Facades\DB;
8-
use Kirschbaum\PreflightChecks\Checks\Database;
911
use Kirschbaum\PreflightChecks\Checks\Result;
10-
use Mockery;
11-
use PDO;
12-
use PDOException;
12+
use Kirschbaum\PreflightChecks\Checks\Database;
1313

14-
class DatabaseTest extends BasePreflightCheckTest
14+
class DatabaseTest extends BasePreflightCheck
1515
{
16-
protected $preflightCheckClass = Database::class;
17-
1816
private const TEST_DEFAULT_DB_CONNECTION = 'test_default';
1917

18+
protected $preflightCheckClass = Database::class;
19+
2020
protected function setUp(): void
2121
{
2222
parent::setUp();
2323

2424
config(['database.default' => static::TEST_DEFAULT_DB_CONNECTION]);
25+
config([
26+
'database.connections.' . static::TEST_DEFAULT_DB_CONNECTION => [
27+
'driver' => 'sqlite',
28+
'database' => ':memory:',
29+
'prefix' => '',
30+
],
31+
]);
2532
}
2633

2734
/**
@@ -55,7 +62,7 @@ public function testChecksDatabaseAccessible(?array $options, string $expectedCo
5562
$this->assertPassed($result);
5663
}
5764

58-
public function providesDatabaseScenarios()
65+
public static function providesDatabaseScenarios()
5966
{
6067
yield 'No options checks default' => [
6168
null,
@@ -72,7 +79,7 @@ public function providesDatabaseScenarios()
7279
static::TEST_DEFAULT_DB_CONNECTION,
7380
];
7481

75-
$testConnection = 'test_connection_'.mt_rand(100, 99999);
82+
$testConnection = 'test_connection_' . mt_rand(100, 99999);
7683

7784
yield 'Connection checks connection' => [
7885
['connection' => $testConnection],
@@ -92,7 +99,7 @@ public function testChecksDatabaseInaccessible()
9299
Mockery::mock(Connection::class)
93100
->shouldReceive('getPdo')
94101
->once()
95-
->andThrow(new Exception(Mockery::mock(PDOException::class)))
102+
->andThrow(new Exception(PDOException::class))
96103
->getMock()
97104
);
98105

tests/Checks/RedisTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
namespace Kirschbaum\PreflightChecks\Tests\Checks;
44

5+
use Mockery;
56
use Illuminate\Redis\Connections\Connection;
6-
use Illuminate\Support\Facades\Redis as RedisFacade;
77
use Kirschbaum\PreflightChecks\Checks\Redis;
88
use Kirschbaum\PreflightChecks\Checks\Result;
9-
use Mockery;
9+
use Illuminate\Support\Facades\Redis as RedisFacade;
1010

11-
class RedisTest extends BasePreflightCheckTest
11+
class RedisTest extends BasePreflightCheck
1212
{
1313
protected $preflightCheckClass = Redis::class;
1414

1515
/**
1616
* @test
1717
* @dataProvider providesConnectionScenarios
18+
*
19+
* @param mixed $options
20+
* @param mixed $expectedConnection
1821
*/
1922
public function testChecksRedisIsAccessible($options, $expectedConnection)
2023
{
@@ -43,7 +46,7 @@ public function testChecksRedisIsAccessible($options, $expectedConnection)
4346
$this->assertEquals($connectionInfo['os'], $resultData['info']['os']);
4447
}
4548

46-
public function providesConnectionScenarios()
49+
public static function providesConnectionScenarios()
4750
{
4851
return [
4952
'No options is default' => [

tests/Commands/PreflightCheckCommandTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@
22

33
namespace Kirschbaum\PreflightChecks\Tests\Commands;
44

5+
use Mockery;
56
use Illuminate\Config\Repository;
7+
use Orchestra\Testbench\TestCase;
68
use Illuminate\Support\Facades\App;
7-
use Kirschbaum\PreflightChecks\Checks\Exceptions\NoPreflightChecksDefinedException;
89
use Kirschbaum\PreflightChecks\PreflightChecksServiceProvider;
910
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\FailedCheck;
10-
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\OptionsCheck;
1111
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\PassedCheck;
12+
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\OptionsCheck;
1213
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\SkippedCheck;
1314
use Kirschbaum\PreflightChecks\Tests\Checks\Fixtures\SkippedFailedCheck;
14-
use Mockery;
15-
use Orchestra\Testbench\TestCase;
15+
use Kirschbaum\PreflightChecks\Checks\Exceptions\NoPreflightChecksDefinedException;
1616

1717
class PreflightCheckCommandTest extends TestCase
1818
{
19-
protected function getPackageProviders($app)
20-
{
21-
return [PreflightChecksServiceProvider::class];
22-
}
23-
2419
/**
2520
* @test
2621
* @dataProvider providesCommandScenarios
@@ -35,7 +30,7 @@ public function testPerformsPreflightChecks(array $config, int $expectedExitCode
3530
->assertExitCode($expectedExitCode);
3631
}
3732

38-
public function providesCommandScenarios()
33+
public static function providesCommandScenarios()
3934
{
4035
return [
4136
'Passes with no checks' => [
@@ -129,4 +124,9 @@ public function testEnvironmentIsCaseInsensitive()
129124
$this->artisan('preflight:check')
130125
->assertExitCode(0);
131126
}
127+
128+
protected function getPackageProviders($app)
129+
{
130+
return [PreflightChecksServiceProvider::class];
131+
}
132132
}

0 commit comments

Comments
 (0)