Skip to content

Commit 33aad61

Browse files
Merge pull request #92 from TheDragonCode/4.x
Drop Laravel 6-10 and PHP 8.0-8.1 support
2 parents b66e145 + 45407af commit 33aad61

File tree

6 files changed

+46
-79
lines changed

6 files changed

+46
-79
lines changed

.github/workflows/phpunit.yml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,8 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [ "8.0", "8.1", "8.2", "8.3" ]
13-
laravel: [ "6.0", "7.0", "8.0", "9.0", "10.0", "11.0" ]
14-
exclude:
15-
- laravel: "6.0"
16-
php: "8.1"
17-
18-
- laravel: "6.0"
19-
php: "8.2"
20-
21-
- laravel: "6.0"
22-
php: "8.3"
23-
24-
- laravel: "7.0"
25-
php: "8.1"
26-
27-
- laravel: "7.0"
28-
php: "8.2"
29-
30-
- laravel: "7.0"
31-
php: "8.3"
32-
33-
- laravel: "9.0"
34-
php: "8.3"
35-
36-
- laravel: "10.0"
37-
php: "8.0"
38-
39-
- laravel: "11.0"
40-
php: "8.0"
41-
42-
- laravel: "11.0"
43-
php: "8.1"
12+
php: [ "8.2", "8.3", "8.4" ]
13+
laravel: [ "11.0" ]
4414

4515
name: PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}
4616

UPGRADE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
### PHP 8.2 Required
66

7-
Laravel Cache now required PHP 8.2.0 or greater.
7+
`Laravel Cache` now required PHP 8.2.0 or greater.
8+
9+
### Laravel 11+ Required
10+
11+
`Laravel Cache` now required Laravel Framework 11 or greater.
812

913
### Composer Dependencies
1014

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
}
3434
],
3535
"require": {
36-
"php": "^8.0",
36+
"php": "^8.2",
3737
"dragon-code/support": "^6.11.3",
38-
"illuminate/contracts": "^10.0||^11.0",
39-
"illuminate/support": ">=6.0 <12.0"
38+
"illuminate/contracts": "^11.0",
39+
"illuminate/support": "^11.0"
4040
},
4141
"require-dev": {
4242
"nesbot/carbon": "^2.62",
43-
"orchestra/testbench": ">=4.0 <10.0",
44-
"phpunit/phpunit": "^8.5 || ^9.6 || ^10.0"
43+
"orchestra/testbench": "^8.0 || ^9.0",
44+
"phpunit/phpunit": "^10.0"
4545
},
4646
"conflict": {
4747
"andrey-helldar/cache": "*"
@@ -50,12 +50,12 @@
5050
"prefer-stable": true,
5151
"autoload": {
5252
"psr-4": {
53-
"DragonCode\\Cache\\": "src"
53+
"DragonCode\\Cache\\": "src/"
5454
}
5555
},
5656
"autoload-dev": {
5757
"psr-4": {
58-
"Tests\\": "tests"
58+
"Tests\\": "tests/"
5959
}
6060
},
6161
"config": {

phpunit.xml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="false"
11-
convertWarningsToExceptions="false"
12-
processIsolation="false"
13-
stopOnError="false"
14-
stopOnFailure="false"
15-
verbose="true"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
cacheResult="false"
167
>
17-
<coverage processUncoveredFiles="true">
18-
<include>
19-
<directory suffix=".php">./src</directory>
20-
</include>
8+
<coverage>
219
<report>
22-
<clover outputFile="build/logs/clover.xml"/>
23-
<html outputDirectory="build/logs/coverage"/>
24-
<text outputFile="build/logs/coverage.txt"/>
10+
<clover outputFile="build/logs/clover.xml" />
11+
<html outputDirectory="build/logs/coverage" />
12+
<text outputFile="build/logs/coverage.txt" />
2513
</report>
2614
</coverage>
2715
<php>
28-
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
29-
<env name="REDIS_HOST" value="127.0.0.1"/>
30-
<env name="REDIS_PORT" value="6379"/>
16+
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF" />
17+
<env name="REDIS_HOST" value="127.0.0.1" />
18+
<env name="REDIS_PORT" value="6379" />
3119
</php>
3220
<testsuites>
3321
<testsuite name="Test Suite">
34-
<directory suffix="Test.php">./tests</directory>
22+
<directory>./tests</directory>
3523
</testsuite>
3624
</testsuites>
25+
<source>
26+
<include>
27+
<directory>./src</directory>
28+
</include>
29+
</source>
3730
</phpunit>

src/Support/Ttl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function fromSeconds($seconds): int
3232

3333
public function fromDateTime(DateTimeInterface $date_time): int
3434
{
35-
$seconds = Carbon::now()->diffInRealSeconds($date_time);
35+
$seconds = Carbon::now()->diffInSeconds($date_time);
3636

3737
return $this->correct($seconds);
3838
}

tests/Support/TtlTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,39 @@
1818

1919
class TtlTest extends TestCase
2020
{
21-
public function testString()
21+
public function testString(): void
2222
{
2323
$this->assertSame(600, Ttl::fromMinutes('10'));
2424
$this->assertSame(10, Ttl::fromSeconds('10'));
2525
}
2626

27-
public function testInteger()
27+
public function testInteger(): void
2828
{
2929
$this->assertSame(600, Ttl::fromMinutes(10));
3030
$this->assertSame(10, Ttl::fromSeconds(10));
3131
}
3232

33-
public function testCarbon()
33+
public function testCarbon(): void
3434
{
3535
$ttl = Carbon::now()->addDay();
3636

37-
$expected = Carbon::now()->diffInRealSeconds($ttl);
37+
$expected = (int) Carbon::now()->diffInSeconds($ttl);
3838

3939
$this->assertSame($expected, Ttl::fromMinutes($ttl));
4040
$this->assertSame($expected, Ttl::fromSeconds($ttl));
4141
}
4242

43-
public function testDateTimeInterface()
43+
public function testDateTimeInterface(): void
4444
{
4545
$ttl = new DateTime('tomorrow');
4646

47-
$expected = Carbon::now()->diffInRealSeconds($ttl);
47+
$expected = (int) Carbon::now()->diffInSeconds($ttl);
4848

4949
$this->assertSame($expected, Ttl::fromMinutes($ttl));
5050
$this->assertSame($expected, Ttl::fromSeconds($ttl));
5151
}
5252

53-
public function testClosure()
53+
public function testClosure(): void
5454
{
5555
$ttl = function () {
5656
return $this->ttl;
@@ -60,7 +60,7 @@ public function testClosure()
6060
$this->assertSame(60, Ttl::fromSeconds($ttl));
6161
}
6262

63-
public function testObjectAsString()
63+
public function testObjectAsString(): void
6464
{
6565
$this->assertSame(18000, Ttl::fromMinutes(CustomObject::class));
6666
$this->assertSame(300, Ttl::fromSeconds(CustomObject::class));
@@ -78,7 +78,7 @@ public function testObjectAsString()
7878
$this->assertSame(3600, Ttl::fromSeconds('unknown'));
7979
}
8080

81-
public function testObjectAsObject()
81+
public function testObjectAsObject(): void
8282
{
8383
$this->assertSame(18000, Ttl::fromMinutes(new CustomObject()));
8484
$this->assertSame(300, Ttl::fromSeconds(new CustomObject()));
@@ -95,11 +95,11 @@ public function testObjectAsObject()
9595

9696
public function testInstances(): void
9797
{
98-
$this->assertSame(3600, Ttl::fromMinutes((new AsCarbon('foo'))->cacheTtl()));
99-
$this->assertSame(7200, Ttl::fromSeconds((new AsCarbon('bar'))->cacheTtl()));
98+
$this->assertSame(3599, Ttl::fromMinutes((new AsCarbon('foo'))->cacheTtl()));
99+
$this->assertSame(7199, Ttl::fromSeconds((new AsCarbon('bar'))->cacheTtl()));
100100

101-
$this->assertSame(3600, Ttl::fromMinutes((new AsDateTime('foo'))->cacheTtl()));
102-
$this->assertSame(7200, Ttl::fromSeconds((new AsDateTime('bar'))->cacheTtl()));
101+
$this->assertSame(3599, Ttl::fromMinutes((new AsDateTime('foo'))->cacheTtl()));
102+
$this->assertSame(7199, Ttl::fromSeconds((new AsDateTime('bar'))->cacheTtl()));
103103

104104
$this->assertSame(600, Ttl::fromMinutes((new AsInteger('foo'))->cacheTtl()));
105105
$this->assertSame(20, Ttl::fromSeconds((new AsInteger('bar'))->cacheTtl()));

0 commit comments

Comments
 (0)