Skip to content

Commit c1cbc1b

Browse files
Merge pull request #1 from code16/php85-support
PHP8.5 Support
2 parents 4af99eb + 13045f2 commit c1cbc1b

File tree

7 files changed

+46
-30
lines changed

7 files changed

+46
-30
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
branches:
55
- main
6+
pull_request:
7+
branches:
8+
- main
69
jobs:
710

811
# Unit tests back (phpunit)
@@ -11,14 +14,10 @@ jobs:
1114
strategy:
1215
matrix:
1316
include:
14-
- php: 8.4
15-
env:
16-
LARAVEL: 10.*
17-
TESTBENCH: 8.*
1817
- php: 8.3
1918
env:
20-
LARAVEL: 10.*
21-
TESTBENCH: 8.*
19+
LARAVEL: 11.*
20+
TESTBENCH: 9.*
2221
- php: 8.4
2322
env:
2423
LARAVEL: 11.*
@@ -27,26 +26,38 @@ jobs:
2726
env:
2827
LARAVEL: 12.*
2928
TESTBENCH: 10.*
29+
- php: 8.5
30+
env:
31+
LARAVEL: 12.*
32+
TESTBENCH: 10.*
3033
env: ${{ matrix.env }}
3134
steps:
3235
- uses: actions/checkout@v4
36+
3337
- name: Setup PHP
3438
uses: shivammathur/setup-php@v2
3539
with:
3640
php-version: ${{ matrix.php }}
3741
extensions: mbstring, dom, fileinfo, mysql
42+
3843
- name: Get composer cache directory
3944
id: composer-cache
4045
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
46+
4147
- name: Cache composer dependencies
4248
uses: actions/cache@v4
4349
with:
4450
path: ${{ steps.composer-cache.outputs.dir }}
4551
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
4652
restore-keys: ${{ runner.os }}-composer-
53+
4754
- name: Install Composer dependencies
4855
run: |
4956
composer require "laravel/framework:${LARAVEL}" "orchestra/testbench:${TESTBENCH}" --no-interaction --no-update --prefer-dist
5057
composer update --prefer-stable --prefer-dist --no-interaction
58+
59+
- name: Run Security Audit
60+
run: composer audit
61+
5162
- name: Execute tests (Unit and Feature tests) via PHPUnit
5263
run: ./vendor/bin/phpunit

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"author": "Code 16",
1414
"require": {
1515
"php": "^8.0",
16-
"illuminate/contracts": "^10.0|^11.0|^12.0",
17-
"illuminate/support": "^10.0|^11.0|^12.0"
16+
"illuminate/contracts": "^11.0|^12.0",
17+
"illuminate/support": "^11.0|^12.0"
1818
},
1919
"require-dev": {
2020
"code16/pint-config": "^1.2",
21-
"laravel/framework": "^10.0|^11.0|^12.0",
21+
"laravel/framework": "^11.0|^12.0",
2222
"laravel/pint": "^1.21",
2323
"orchestra/testbench": "^8.0|^9.0|^10.0",
24-
"phpunit/phpunit": "^10.0|^11.0"
24+
"phpunit/phpunit": "^10.0|^11.0|^12.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

tests/Unit/Rules/EmbeddableUrlTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use Code16\Embed\Services\YouTube;
99
use Code16\Embed\Tests\EmbedTestCase;
1010
use Illuminate\Support\Facades\Validator;
11+
use PHPUnit\Framework\Attributes\Test;
1112

1213
class EmbeddableUrlTest extends EmbedTestCase
1314
{
14-
/** @test */
15+
#[Test]
1516
public function it_passes_a_validUrl_for_any_service()
1617
{
1718
$validUrls = [
@@ -33,7 +34,7 @@ public function it_passes_a_validUrl_for_any_service()
3334
$this->assertTrue(true);
3435
}
3536

36-
/** @test */
37+
#[Test]
3738
public function it_passes_for_an_allowed_service()
3839
{
3940
$url = 'https://www.youtube.com/embed/dQw4w9WgXcQ';
@@ -52,7 +53,7 @@ public function it_passes_for_an_allowed_service()
5253
$this->assertTrue(true);
5354
}
5455

55-
/** @test */
56+
#[Test]
5657
public function it_passes_for_multiple_allowed_services()
5758
{
5859
$validUrls = [
@@ -77,7 +78,7 @@ public function it_passes_for_multiple_allowed_services()
7778
$this->assertTrue(true);
7879
}
7980

80-
/** @test */
81+
#[Test]
8182
public function it_fails_for_an_invalid_url()
8283
{
8384
$exception = null;
@@ -94,7 +95,7 @@ function ($message) use (&$exception) {
9495
$this->assertNotNull($exception);
9596
}
9697

97-
/** @test */
98+
#[Test]
9899
public function it_fails_for_an_unsupported_service()
99100
{
100101
$exception = null;
@@ -112,7 +113,7 @@ function ($message) use (&$exception) {
112113
$this->assertNotNull($exception);
113114
}
114115

115-
/** @test */
116+
#[Test]
116117
public function it_replaces_supported_services_in_message_with_no_services_specified()
117118
{
118119
$url = 'https://www.real.com/video/xg4y8d';
@@ -133,7 +134,7 @@ protected function assertValidationMessage($url, $rule, $expectedMessage)
133134
$this->assertEquals($expectedMessage, $validator->messages()->get($attributeKey)[0]);
134135
}
135136

136-
/** @test */
137+
#[Test]
137138
public function it_replaces_supported_service_in_message()
138139
{
139140
$url = 'https://www.real.com/video/xg4y8d';
@@ -143,7 +144,7 @@ public function it_replaces_supported_service_in_message()
143144
$this->assertValidationMessage($url, $rule, $expectedMessage);
144145
}
145146

146-
/** @test */
147+
#[Test]
147148
public function it_replaces_supported_services_list_in_message()
148149
{
149150
$url = 'https://www.real.com/video/xg4y8d';

tests/Unit/ServiceBaseTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
use Code16\Embed\Tests\Fakes\Services\FakeServiceOne;
77
use Code16\Embed\Tests\Fakes\Services\FakeServiceTwo;
88
use Code16\Embed\ValueObjects\Url;
9+
use PHPUnit\Framework\Attributes\Test;
910

1011
class ServiceBaseTest extends EmbedTestCase
1112
{
12-
/** @test */
13+
#[Test]
1314
public function it_can_guess_view_name()
1415
{
1516
$this->assertEquals(
@@ -23,7 +24,7 @@ public function it_can_guess_view_name()
2324
);
2425
}
2526

26-
/** @test */
27+
#[Test]
2728
public function it_can_pass_view_data()
2829
{
2930
$this->assertEquals(

tests/Unit/ServiceFactoryTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use Code16\Embed\Tests\Fakes\Services\FakeServiceOne;
99
use Code16\Embed\Tests\Fakes\Services\FakeServiceTwo;
1010
use Code16\Embed\ValueObjects\Url;
11+
use PHPUnit\Framework\Attributes\Test;
1112

1213
class ServiceFactoryTest extends EmbedTestCase
1314
{
14-
/** @test */
15+
#[Test]
1516
public function it_can_get_a_service_by_url()
1617
{
1718
ServiceFactory::fake();
@@ -20,15 +21,15 @@ public function it_can_get_a_service_by_url()
2021
$this->assertInstanceOf(FakeServiceTwo::class, ServiceFactory::getByUrl(new Url('https://two.com')));
2122
}
2223

23-
/** @test */
24+
#[Test]
2425
public function it_throws_an_exception_if_no_service_exists_to_handle_the_url()
2526
{
2627
ServiceFactory::fake();
2728

2829
$this->assertNull(ServiceFactory::getByUrl(new Url('https://non-existing-service.com')));
2930
}
3031

31-
/** @test */
32+
#[Test]
3233
public function it_can_get_a_fallback_service()
3334
{
3435
$this->assertInstanceOf(Fallback::class,

tests/Unit/Services/ServiceTestCase.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
use Code16\Embed\ServiceContract;
66
use Code16\Embed\Tests\EmbedTestCase;
77
use Code16\Embed\ValueObjects\Url;
8+
use PHPUnit\Framework\Attributes\Test;
89

910
abstract class ServiceTestCase extends EmbedTestCase
1011
{
11-
/** @test */
12+
#[Test]
1213
public function it_renders_the_correct_view()
1314
{
1415
$this->assertEquals('embed::services.'.$this->expectedViewName(), $this->service()->fullViewName());
@@ -28,7 +29,7 @@ abstract protected function serviceClass(): string;
2829

2930
abstract protected function validUrls(): array;
3031

31-
/** @test */
32+
#[Test]
3233
public function it_detects_appropriate_urls()
3334
{
3435
foreach ($this->validUrls() as $url) {
@@ -39,7 +40,7 @@ public function it_detects_appropriate_urls()
3940
}
4041
}
4142

42-
/** @test */
43+
#[Test]
4344
public function it_has_expected_view_data()
4445
{
4546
foreach ($this->expectedViewData() as $key => $value) {

tests/Unit/ValueObjects/UrlTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,32 @@
55
use Code16\Embed\Tests\EmbedTestCase;
66
use Code16\Embed\ValueObjects\Url;
77
use InvalidArgumentException;
8+
use PHPUnit\Framework\Attributes\Test;
89

910
class UrlTest extends EmbedTestCase
1011
{
11-
/** @test */
12+
#[Test]
1213
public function it_accepts_a_valid_url()
1314
{
1415
$this->assertInstanceOf(Url::class, new Url('https://example.org'));
1516
$this->assertInstanceOf(Url::class, new Url('http://example.org'));
1617
}
1718

18-
/** @test */
19+
#[Test]
1920
public function it_throws_an_exception_for_an_invalid_url()
2021
{
2122
$this->expectException(InvalidArgumentException::class);
2223
new Url('not-a-val..id-url');
2324
}
2425

25-
/** @test */
26+
#[Test]
2627
public function it_can_be_cast_to_a_string()
2728
{
2829
$url = new Url('https://example.org');
2930
$this->assertEquals('https://example.org', (string) $url);
3031
}
3132

32-
/** @test */
33+
#[Test]
3334
public function it_attempts_to_prepend_https_if_missing()
3435
{
3536
$url = new Url('example.org');

0 commit comments

Comments
 (0)