Skip to content
New issue

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

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

Already on GitHub? # to your account

Laravel 11.x Support #57

Merged
merged 9 commits into from
Mar 18, 2024
Merged
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
24 changes: 10 additions & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: run-tests

on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main

jobs:
test:
Expand All @@ -13,23 +15,17 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1, 8.0]
laravel: [10.*, 9.*, 8.*]
php: [8.1, 8.2, 8.3]
laravel: ["10.*", "11.*"]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 9.*
testbench: ^7.0.0
- laravel: 8.*
testbench: ^6.23
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 8.*
php: 8.2
- laravel: 9.*
php: 8.2
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1

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

Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
}
],
"require": {
"php": "^8.0",
"coderflexx/laravel-presenter": "^1.1",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"php": "^8.1",
"coderflexx/laravel-presenter": "^2.0",
"illuminate/contracts": "^10.0|^11.0",
"jaybizzle/crawler-detect": "^1.2",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"nunomaduro/collision": "^5.10|^6.1|^7.0",
"nunomaduro/collision": "^7.0|^8.0",
"nunomaduro/larastan": "^1.0|^2.0",
"orchestra/testbench": "^6.23|^7.0.0|^8.0",
"pestphp/pest": "^1.22",
"pestphp/pest-plugin-laravel": "^1.1",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^1.22|^2.34",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand Down
6 changes: 3 additions & 3 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Coderflex\Laravisit\Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(TestCase::class, RefreshDatabase::class)
->in(__DIR__);
uses(TestCase::class)->in(__DIR__);

beforeEach()->setupDatabases();
8 changes: 6 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

use Coderflex\Laravisit\LaravisitServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Schema;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
abstract class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();

$this->setupDatabases($this->app);

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Coderflex\\Laravisit\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
Expand All @@ -24,14 +27,15 @@ protected function getPackageProviders($app)
];
}

public function getEnvironmentSetUp($app)
public function setupDatabases($app)
{
config()->set('database.default', 'sqlite');
config()->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
]);

Schema::dropAllTables();

// load laravisits migration
$migration = include __DIR__ . '/../database/migrations/create_laravisits_table.php.stub';
Expand Down