Skip to content

Commit f577c81

Browse files
Merge pull request #4 from intouchinsight/ip-8350-adding-laravel-12-support
IP 8350: Adding Laravel 12 Support
2 parents 380aec4 + 99c0a86 commit f577c81

File tree

6 files changed

+84
-59
lines changed

6 files changed

+84
-59
lines changed

.github/workflows/tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches: [ "**" ]
5+
pull_request:
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
php: ["8.3", "8.4"]
14+
laravel: ["11", "12"]
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
coverage: none
25+
tools: composer
26+
extensions: json, mbstring, ctype, openssl, tokenizer, pdo, curl
27+
28+
- name: Validate composer.json
29+
run: composer validate --no-check-publish
30+
31+
- name: Install deps for Laravel ${{ matrix.laravel }}
32+
shell: bash
33+
run: |
34+
composer update --no-interaction --prefer-dist --ansi \
35+
--with "illuminate/support:^${{ matrix.laravel }}" \
36+
--with-all-dependencies
37+
38+
- name: Run tests
39+
run: vendor/bin/phpunit --no-coverage
40+
41+
phplint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 10
47+
- uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: '8.3'
50+
coverage: xdebug
51+
52+
- name: Install dependencies
53+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
54+
55+
- name: Run laravel pint
56+
run: ./vendor/bin/pint --test

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
}
1616
},
1717
"require": {
18-
"php": "^8.0",
18+
"php": "^8.3|^8.4",
1919
"aws/aws-sdk-php": "^3.20",
20-
"illuminate/support": "^10|^11"
20+
"illuminate/support": "^11.0|^12.0"
2121
},
2222
"require-dev": {
2323
"laravel/pint": "^1.15",
2424
"mockery/mockery": "^1.4.4",
25-
"laravel/framework": "^10|^11",
26-
"phpunit/phpunit": "^10.0",
27-
"squizlabs/php_codesniffer": "^2.8",
28-
"scrutinizer/ocular": "^1.9",
29-
"symfony/console": "^6.0"
25+
"laravel/framework": "^11.0|^12.0",
26+
"phpunit/phpunit": "^10.0|^11.0",
27+
"squizlabs/php_codesniffer": "^3.7",
28+
"symfony/console": "^6.0|^7.0"
3029
},
3130
"scripts": {
3231
"cs": "phpcs --standard=psr2 src/",

src/LaravelCacheAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Laravel Cache Adapter for AWS Credential Caching.
45
*

src/ServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Laravel Cache Adapter for AWS Credential Caching.
45
*

tests/LaravelCacheAdapterTest.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use LukeWaite\LaravelAwsCacheAdapter\LaravelCacheAdapter;
66
use Mockery as m;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\TestCase;
89

910
class LaravelCacheAdapterTest extends TestCase
@@ -13,12 +14,12 @@ class LaravelCacheAdapterTest extends TestCase
1314

1415
protected $repository;
1516

16-
public function tearDown(): void
17+
protected function tearDown(): void
1718
{
1819
m::close();
1920
}
2021

21-
public function setUp(): void
22+
protected function setUp(): void
2223
{
2324
$this->manager = m::mock('Illuminate\Cache\CacheManager');
2425
$this->manager->shouldReceive('store')
@@ -27,51 +28,62 @@ public function setUp(): void
2728
->andReturn($this->repository = m::mock('StdClass'));
2829
}
2930

30-
public function testGetWithPrefix()
31+
#[Test]
32+
public function test_get_with_prefix()
3133
{
3234
$this->repository->shouldReceive('get')->with('aws_credentials_testkey')->once()->andReturn('testValue');
3335

3436
$adapter = new LaravelCacheAdapter($this->manager, 'file', 'test');
3537
$this->assertEquals('testValue', $adapter->get('key'));
3638
}
3739

38-
public function testRemoveWithoutPrefix()
40+
#[Test]
41+
public function test_remove_without_prefix()
3942
{
4043
$this->repository->shouldReceive('forget')->with('aws_credentials_key_to_remove')->once();
4144

4245
$adapter = new LaravelCacheAdapter($this->manager, 'file', '');
4346
$adapter->remove('key_to_remove');
47+
$this->assertTrue(true); // Add assertion to avoid risky test
4448
}
4549

46-
public function testSetLessThan60SecondsRoundsUp()
50+
#[Test]
51+
public function test_set_less_than60_seconds_rounds_up()
4752
{
4853
$this->repository->shouldReceive('put')->with('aws_credentials_key', 'value', 1)->once();
4954

5055
$adapter = new LaravelCacheAdapter($this->manager, 'file', '');
5156
$adapter->set('key', 'value', 59);
57+
$this->assertTrue(true); // Add assertion to avoid risky test
5258
}
5359

54-
public function testSetGreaterThan60SecondsRoundsDown()
60+
#[Test]
61+
public function test_set_greater_than60_seconds_rounds_down()
5562
{
5663
$this->repository->shouldReceive('put')->with('aws_credentials_key', 'value', 1)->once();
5764

5865
$adapter = new LaravelCacheAdapter($this->manager, 'file', '');
5966
$adapter->set('key', 'value', 61);
67+
$this->assertTrue(true); // Add assertion to avoid risky test
6068
}
6169

62-
public function testSetGreaterThan120SecondsRoundsDown()
70+
#[Test]
71+
public function test_set_greater_than120_seconds_rounds_down()
6372
{
6473
$this->repository->shouldReceive('put')->with('aws_credentials_key', 'value', 2)->once();
6574

6675
$adapter = new LaravelCacheAdapter($this->manager, 'file', '');
6776
$adapter->set('key', 'value', 121);
77+
$this->assertTrue(true); // Add assertion to avoid risky test
6878
}
6979

70-
public function testSet0Retains0()
80+
#[Test]
81+
public function test_set0_retains0()
7182
{
7283
$this->repository->shouldReceive('put')->with('aws_credentials_key', 'value', 0)->once();
7384

7485
$adapter = new LaravelCacheAdapter($this->manager, 'file', '');
7586
$adapter->set('key', 'value', 0);
87+
$this->assertTrue(true); // Add assertion to avoid risky test
7688
}
7789
}

0 commit comments

Comments
 (0)