Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Laravel 11 #58

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: 🔥 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
coverage: none
tools: cs2pr, pint

Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2 ]
laravel: [ "^9.0", "^10.0" ]
php: [ 8.2 ]
laravel: [ "^10.0", "^11.0" ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: "^9.0"
testbench: "^7.0"
enum: "^5.0"
- laravel: "^9.0"
testbench: "^7.0"
enum: "^6.0"
- laravel: "^10.0"
testbench: "^8.0"
enum: "^6.0"
- laravel: "^11.0"
testbench: "^9.0"
enum: "^6.0"

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

Expand Down
80 changes: 40 additions & 40 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
{
"name": "simplesquid/nova-enum-field",
"description": "A Laravel Nova field to add enums to resources.",
"keywords": [
"name" : "simplesquid/nova-enum-field",
"description" : "A Laravel Nova field to add enums to resources.",
"keywords" : [
"simplesquid",
"laravel",
"nova",
"field",
"enum",
"nova-enum-field"
],
"homepage": "https://github.com/simplesquid/nova-enum-field",
"license": "MIT",
"authors": [
"homepage" : "https://github.com/simplesquid/nova-enum-field",
"license" : "MIT",
"authors" : [
{
"name": "Matthew Poulter",
"email": "matthew.poulter@simplesquid.co.za",
"homepage": "https://simplesquid.co.za/",
"role": "Developer"
"name" : "Matthew Poulter",
"email" : "matthew.poulter@simplesquid.co.za",
"homepage" : "https://simplesquid.co.za/",
"role" : "Developer"
}
],
"repositories": [
"repositories" : [
{
"type": "composer",
"url": "https://nova.laravel.com"
"type" : "composer",
"url" : "https://nova.laravel.com"
}
],
"require": {
"php": "^8.0",
"bensampo/laravel-enum": "^5.0 || ^6.0",
"illuminate/support": "^9.0 || ^10.0",
"laravel/nova": "^4.0"
"require" : {
"php" : "^8.1",
"bensampo/laravel-enum" : "^5.0 || ^6.0",
"illuminate/support" : "^10.0 || ^11.0",
"laravel/nova" : "^4.0"
},
"require-dev": {
"joshgaber/novaunit": "^3.1",
"laravel/pint": "^1.2",
"mockery/mockery": "^1.3.3",
"nunomaduro/collision": "^6.1 || ^7.0",
"orchestra/testbench": "^7.0 || ^8.0",
"phpunit/phpunit": "^9.3.3",
"symfony/var-dumper": "^6.0"
"require-dev" : {
"joshgaber/novaunit" : "^3.1",
"laravel/pint" : "^1.2",
"mockery/mockery" : "^1.3.3",
"nunomaduro/collision" : "^7.0 || ^8.0",
"orchestra/testbench" : "^8.0 || ^9.0",
"phpunit/phpunit" : "^10.0",
"symfony/var-dumper" : "^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
"SimpleSquid\\Nova\\Fields\\Enum\\": "src"
"autoload" : {
"psr-4" : {
"SimpleSquid\\Nova\\Fields\\Enum\\" : "src"
}
},
"autoload-dev": {
"psr-4": {
"SimpleSquid\\Nova\\Fields\\Enum\\Tests\\": "tests"
"autoload-dev" : {
"psr-4" : {
"SimpleSquid\\Nova\\Fields\\Enum\\Tests\\" : "tests"
}
},
"extra": {
"laravel": {
"providers": []
"extra" : {
"laravel" : {
"providers" : []
}
},
"scripts": {
"test": "vendor/bin/phpunit --colors=always"
"scripts" : {
"test" : "vendor/bin/phpunit --colors=always"
},
"config": {
"sort-packages": true
"config" : {
"sort-packages" : true
},
"minimum-stability": "stable"
"minimum-stability" : "stable"
}
16 changes: 7 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Simple Squid Test Suite">
<directory>tests/Fields</directory>
<directory>tests/Filters</directory>
</testsuite>
</testsuites>
<coverage/>
<php>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_DATABASE" value="nova_enum_field"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3306"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function (NovaRequest $request, $model, $attribute, $requestAttribute) {
public function attach($class)
{
return $this->options($class::asSelectArray())
->rules($this->nullable ? 'nullable' : 'required', new EnumValue($class, false));
->rules($this->nullable ? 'nullable' : 'required', new EnumValue($class, false));
}

public function nullable($nullable = true, $values = null)
Expand Down
3 changes: 2 additions & 1 deletion tests/Fields/FieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function it_starts_with_no_options_and_rules()
/** @test */
public function it_allows_an_enum_to_be_attached()
{
$this->assertObjectHasAttribute('optionsCallback', $this->field);
$this->assertIsObject($this->field);
$this->assertTrue(property_exists($this->field, 'optionsCallback'));
}

/** @test */
Expand Down
Loading