Skip to content

Commit

Permalink
Merge pull request #2 from Morning-Train/feature/laravel-11
Browse files Browse the repository at this point in the history
Feature/laravel 11
  • Loading branch information
SimonJnsson authored Apr 15, 2024
2 parents 8223296 + d2696fb commit 42dc610
Show file tree
Hide file tree
Showing 23 changed files with 473 additions and 29 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,15 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1, 8.0]
laravel: [10.*, 9.*, 8.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: ^6.23
exclude:
- laravel: 10.*
php: 8.0
- laravel: 8.*
php: 8.2
php: [8.2]
laravel: [11.*]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -40,7 +28,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
Expand Down
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
}
],
"require": {
"php": "^8.0",
"laravel/framework": "^8.71|^9.0|^10.0"
"php": "^8.2",
"laravel/framework": "^11.0"
},
"require-dev": {
"phpunit/phpunit": "^9.4",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^6.24|^7.0|^8.0"
"orchestra/testbench": "^9.0",
"pestphp/pest": "^2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -38,7 +38,10 @@
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
Expand Down
10 changes: 6 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
Expand All @@ -18,4 +15,9 @@
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
14 changes: 14 additions & 0 deletions stubs/cast.inbound.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;

class {{ class }} implements CastsInboundAttributes
{
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
19 changes: 19 additions & 0 deletions stubs/cast.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class {{ class }} implements CastsAttributes
{
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}

public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
11 changes: 11 additions & 0 deletions stubs/class.invokable.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace {{ namespace }};

class {{ class }}
{
public function __invoke(): void
{

}
}
8 changes: 8 additions & 0 deletions stubs/class.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

class {{ class }}
{

}
30 changes: 30 additions & 0 deletions stubs/controller.nested.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
40 changes: 40 additions & 0 deletions stubs/controller.nested.singleton.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function create({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function edit({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
29 changes: 29 additions & 0 deletions stubs/controller.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace {{ namespace }};

use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;

class {{ class }} extends Controller
{
public function store(Request $request): never
{
abort(404);
}

public function show()
{
//
}

public function update(Request $request)
{
//
}

public function destroy(): never
{
abort(404);
}
}
39 changes: 39 additions & 0 deletions stubs/controller.singleton.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace {{ namespace }};

use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;

class {{ class }} extends Controller
{
public function create(): never
{
abort(404);
}

public function store(Request $request): never
{
abort(404);
}

public function show()
{
//
}

public function edit()
{
//
}

public function update(Request $request)
{
//
}

public function destroy(): never
{
abort(404);
}
}
8 changes: 8 additions & 0 deletions stubs/enum.backed.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

enum {{ class }}: {{ type }}
{
//
}
8 changes: 8 additions & 0 deletions stubs/enum.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

enum {{ class }}
{
//
}
39 changes: 39 additions & 0 deletions stubs/mail.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class {{ class }} extends Mailable
{
use Queueable, SerializesModels;

public function __construct(): void
{
//
}

public function envelope(): Envelope
{
return new Envelope(
subject: '{{ subject }}',
);
}

public function content(): Content
{
return new Content(
markdown: 'markdown.view.name',
);
}

public function attachments(): array
{
return [];
}
}
43 changes: 43 additions & 0 deletions stubs/markdown-mail.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class {{ class }} extends Mailable
{
use Queueable;
use SerializesModels;

public function __construct()
{
//
}

public function envelope(): Envelope
{
return new Envelope(
subject: '{{ subject }}',
);
}

public function content(): Content
{
return new Content(
markdown: '{{ view }}',
);
}

/**
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}
Loading

0 comments on commit 42dc610

Please sign in to comment.