Skip to content

Commit 05a86d9

Browse files
Upgrade to Laravel 11 (#58)
Co-authored-by: manuel <[email protected]>
1 parent ed978fc commit 05a86d9

File tree

10 files changed

+48
-43
lines changed

10 files changed

+48
-43
lines changed

.github/workflows/code-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: 🔥 Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: 8.1
23+
php-version: 8.3
2424
coverage: none
2525
tools: cs2pr, pint
2626

.github/workflows/run-tests.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ jobs:
1616
fail-fast: true
1717
matrix:
1818
os: [ ubuntu-latest ]
19-
php: [ 8.1, 8.2 ]
20-
laravel: [ "^9.0", "^10.0" ]
19+
php: [ 8.2, 8.3 ]
20+
laravel: [ "^10.0", "^11.0" ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
include:
23-
- laravel: "^9.0"
24-
testbench: "^7.0"
25-
enum: "^5.0"
26-
- laravel: "^9.0"
27-
testbench: "^7.0"
28-
enum: "^6.0"
2923
- laravel: "^10.0"
3024
testbench: "^8.0"
3125
enum: "^6.0"
26+
- laravel: "^11.0"
27+
testbench: "^9.0"
28+
enum: "^6.0"
3229

3330
name: P${{ matrix.php }} - L${{ matrix.laravel }} - E${{ matrix.enum }} - ${{ matrix.stability }} - ${{ matrix.os }}
3431

composer.json

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "simplesquid/nova-enum-field",
33
"description": "A Laravel Nova field to add enums to resources.",
4+
"license": "MIT",
45
"keywords": [
56
"simplesquid",
67
"laravel",
@@ -9,8 +10,6 @@
910
"enum",
1011
"nova-enum-field"
1112
],
12-
"homepage": "https://github.com/simplesquid/nova-enum-field",
13-
"license": "MIT",
1413
"authors": [
1514
{
1615
"name": "Matthew Poulter",
@@ -19,27 +18,30 @@
1918
"role": "Developer"
2019
}
2120
],
22-
"repositories": [
23-
{
24-
"type": "composer",
25-
"url": "https://nova.laravel.com"
26-
}
27-
],
21+
"homepage": "https://github.com/simplesquid/nova-enum-field",
2822
"require": {
29-
"php": "^8.0",
23+
"php": "^8.1",
3024
"bensampo/laravel-enum": "^5.0 || ^6.0",
31-
"illuminate/support": "^9.0 || ^10.0",
25+
"illuminate/support": "^10.0 || ^11.0",
3226
"laravel/nova": "^4.0"
3327
},
3428
"require-dev": {
35-
"joshgaber/novaunit": "^3.1",
29+
"ergebnis/composer-normalize": "^2.44",
3630
"laravel/pint": "^1.2",
3731
"mockery/mockery": "^1.3.3",
38-
"nunomaduro/collision": "^6.1 || ^7.0",
39-
"orchestra/testbench": "^7.0 || ^8.0",
40-
"phpunit/phpunit": "^9.3.3",
41-
"symfony/var-dumper": "^6.0"
32+
"nunomaduro/collision": "^7.0 || ^8.0",
33+
"orchestra/testbench": "^8.0 || ^9.0",
34+
"phpunit/phpunit": "^10.1",
35+
"quotevelocity/novaunit": "^4.0",
36+
"symfony/var-dumper": "^6.0 || ^7.0"
4237
},
38+
"repositories": [
39+
{
40+
"type": "composer",
41+
"url": "https://nova.laravel.com"
42+
}
43+
],
44+
"minimum-stability": "stable",
4345
"autoload": {
4446
"psr-4": {
4547
"SimpleSquid\\Nova\\Fields\\Enum\\": "src"
@@ -50,16 +52,18 @@
5052
"SimpleSquid\\Nova\\Fields\\Enum\\Tests\\": "tests"
5153
}
5254
},
55+
"config": {
56+
"allow-plugins": {
57+
"ergebnis/composer-normalize": true
58+
},
59+
"sort-packages": true
60+
},
5361
"extra": {
5462
"laravel": {
5563
"providers": []
5664
}
5765
},
5866
"scripts": {
5967
"test": "vendor/bin/phpunit --colors=always"
60-
},
61-
"config": {
62-
"sort-packages": true
63-
},
64-
"minimum-stability": "stable"
68+
}
6569
}

phpunit.xml.dist

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
colors="true">
6-
<coverage>
7-
<include>
8-
<directory suffix=".php">src</directory>
9-
</include>
10-
</coverage>
5+
colors="true"
6+
>
117
<testsuites>
128
<testsuite name="Simple Squid Test Suite">
139
<directory>tests/Fields</directory>
1410
<directory>tests/Filters</directory>
1511
</testsuite>
1612
</testsuites>
13+
<coverage/>
14+
<source>
15+
<include>
16+
<directory>src</directory>
17+
</include>
18+
</source>
1719
<php>
1820
<env name="DB_CONNECTION" value="mysql"/>
1921
<env name="DB_USERNAME" value="root"/>
2022
<env name="DB_DATABASE" value="nova_enum_field"/>
2123
<env name="DB_HOST" value="127.0.0.1"/>
2224
<env name="DB_PORT" value="3306"/>
25+
<env name="DB_COLLATION" value="utf8mb4_unicode_ci"/>
2326
</php>
2427
</phpunit>

src/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function (NovaRequest $request, $model, $attribute, $requestAttribute) {
3636
public function attach($class)
3737
{
3838
return $this->options($class::asSelectArray())
39-
->rules($this->nullable ? 'nullable' : 'required', new EnumValue($class, false));
39+
->rules($this->nullable ? 'nullable' : 'required', new EnumValue($class, false));
4040
}
4141

4242
public function nullable($nullable = true, $values = null)

tests/Fields/FieldTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public function it_starts_with_no_options_and_rules()
3434
/** @test */
3535
public function it_allows_an_enum_to_be_attached()
3636
{
37-
$this->assertObjectHasAttribute('optionsCallback', $this->field);
37+
$this->assertIsObject($this->field);
38+
$this->assertTrue(property_exists($this->field, 'optionsCallback'));
3839
}
3940

4041
/** @test */
@@ -60,6 +61,6 @@ public function it_can_be_nullable()
6061

6162
$this->assertNotContains('required', $this->field->rules);
6263
$this->assertContains('nullable', $this->field->rules);
63-
$this->assertFalse($this->field->isRequired(new NovaRequest()));
64+
$this->assertFalse($this->field->isRequired(new NovaRequest));
6465
}
6566
}

tests/Fields/FlaggedFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function it_resolves_enum_values()
9393
/** @test */
9494
public function it_fills_database_with_flagged_enum_value()
9595
{
96-
$request = new NovaRequest();
96+
$request = new NovaRequest;
9797
$request->query->add(['enum' => json_encode($this->values)]);
9898

9999
$this->field->fill($request, $this->model);

tests/Fields/IntegerFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function it_displays_enum_description()
4444
/** @test */
4545
public function it_fills_database_with_enum_value()
4646
{
47-
$request = new NovaRequest();
47+
$request = new NovaRequest;
4848
$request->query->add(['enum' => IntegerEnum::Subscriber]);
4949

5050
$this->field->fill($request, $this->model);

tests/Fields/NoCastsFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function it_displays_enum_description()
4444
/** @test */
4545
public function it_fills_database_with_enum_value()
4646
{
47-
$request = new NovaRequest();
47+
$request = new NovaRequest;
4848
$request->query->add(['enum' => StringEnum::Subscriber]);
4949

5050
$this->field->fill($request, $this->model);

tests/Fields/StringFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function it_displays_enum_description()
4444
/** @test */
4545
public function it_fills_database_with_enum_value()
4646
{
47-
$request = new NovaRequest();
47+
$request = new NovaRequest;
4848
$request->query->add(['enum' => StringEnum::Subscriber]);
4949

5050
$this->field->fill($request, $this->model);

0 commit comments

Comments
 (0)