Add Workbench config

This commit is contained in:
philipp lang 2024-01-03 11:10:59 +01:00
parent 22d7841d5a
commit 17afb48028
14 changed files with 48 additions and 44 deletions

View File

@ -5,10 +5,15 @@
"license": "MIT", "license": "MIT",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Zoomyboy\\MedialibraryHelper\\Tests\\": "tests/",
"Zoomyboy\\MedialibraryHelper\\": "src/" "Zoomyboy\\MedialibraryHelper\\": "src/"
} }
}, },
"autoload-dev": {
"psr-4": {
"Zoomyboy\\MedialibraryHelper\\Tests\\": "tests/",
"Workbench\\App\\": "tests/workbench/app/"
}
},
"authors": [ "authors": [
{ {
"name": "Philipp Lang", "name": "Philipp Lang",
@ -28,7 +33,20 @@
}, },
"scripts": { "scripts": {
"post-autoload-dump": [ "post-autoload-dump": [
"@clear",
"@prepare",
"@php vendor/bin/testbench package:discover --ansi" "@php vendor/bin/testbench package:discover --ansi"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve"
],
"test": [
"@php vendor/bin/pest"
] ]
}, },
"config": { "config": {

17
composer.lock generated
View File

@ -8682,16 +8682,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "fakerphp/faker", "name": "fakerphp/faker",
"version": "v1.23.0", "version": "v1.23.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/FakerPHP/Faker.git", "url": "https://github.com/FakerPHP/Faker.git",
"reference": "e3daa170d00fde61ea7719ef47bb09bb8f1d9b01" "reference": "bfb4fe148adbf78eff521199619b93a52ae3554b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/FakerPHP/Faker/zipball/e3daa170d00fde61ea7719ef47bb09bb8f1d9b01", "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/bfb4fe148adbf78eff521199619b93a52ae3554b",
"reference": "e3daa170d00fde61ea7719ef47bb09bb8f1d9b01", "reference": "bfb4fe148adbf78eff521199619b93a52ae3554b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8717,11 +8717,6 @@
"ext-mbstring": "Required for multibyte Unicode string functionality." "ext-mbstring": "Required for multibyte Unicode string functionality."
}, },
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-main": "v1.21-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Faker\\": "src/Faker/" "Faker\\": "src/Faker/"
@ -8744,9 +8739,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/FakerPHP/Faker/issues", "issues": "https://github.com/FakerPHP/Faker/issues",
"source": "https://github.com/FakerPHP/Faker/tree/v1.23.0" "source": "https://github.com/FakerPHP/Faker/tree/v1.23.1"
}, },
"time": "2023-06-12T08:44:38+00:00" "time": "2024-01-02T13:46:09+00:00"
}, },
{ {
"name": "hamcrest/hamcrest-php", "name": "hamcrest/hamcrest-php",

7
testbench.yaml Normal file
View File

@ -0,0 +1,7 @@
providers:
- Spatie\MediaLibrary\MediaLibraryServiceProvider
- Spatie\LaravelData\LaravelDataServiceProvider
- Zoomyboy\MedialibraryHelper\ServiceProvider
migrations:
- tests/workbench/database/migrations

View File

@ -3,8 +3,8 @@
namespace Zoomyboy\MedialibraryHelper\Tests\Feature; namespace Zoomyboy\MedialibraryHelper\Tests\Feature;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaChange; use Workbench\App\Events\MediaChange;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaDestroyed; use Workbench\App\Events\MediaDestroyed;
test('it deletes multiple media', function () { test('it deletes multiple media', function () {
$this->auth()->registerModel()->withoutExceptionHandling(); $this->auth()->registerModel()->withoutExceptionHandling();

View File

@ -3,7 +3,7 @@
namespace Zoomyboy\MedialibraryHelper\Tests\Feature; namespace Zoomyboy\MedialibraryHelper\Tests\Feature;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaChange; use Workbench\App\Events\MediaChange;
test('it can reorder media', function () { test('it can reorder media', function () {
Event::fake(); Event::fake();

View File

@ -3,7 +3,7 @@
namespace Zoomyboy\MedialibraryHelper\Tests\Feature; namespace Zoomyboy\MedialibraryHelper\Tests\Feature;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaChange; use Workbench\App\Events\MediaChange;
test('it updates a single files properties', function () { test('it updates a single files properties', function () {
Event::fake(); Event::fake();

View File

@ -4,8 +4,8 @@ namespace Zoomyboy\MedialibraryHelper\Tests\Feature;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaChange; use Workbench\App\Events\MediaChange;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaStored; use Workbench\App\Events\MediaStored;
test('it uploads a single file to a single file collection', function () { test('it uploads a single file to a single file collection', function () {
$this->auth()->registerModel(); $this->auth()->registerModel();

View File

@ -4,30 +4,14 @@ namespace Zoomyboy\MedialibraryHelper\Tests;
use Illuminate\Http\File; use Illuminate\Http\File;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase as BaseTestCase; use Orchestra\Testbench\TestCase as BaseTestCase;
use Spatie\LaravelData\LaravelDataServiceProvider; use Workbench\App\Models\Post;
use Spatie\MediaLibrary\MediaLibraryServiceProvider;
use Zoomyboy\MedialibraryHelper\ServiceProvider;
use Zoomyboy\MedialibraryHelper\Tests\Models\Post;
class TestCase extends BaseTestCase class TestCase extends BaseTestCase
{ {
/**
* Define database migrations.
*/
protected function defineDatabaseMigrations(): void
{
$this->loadMigrationsFrom(__DIR__ . '/migrations');
}
protected function getPackageProviders($app): array use WithWorkbench;
{
return [
ServiceProvider::class,
MediaLibraryServiceProvider::class,
LaravelDataServiceProvider::class,
];
}
/** /**
* Generate a pdf file with a filename and get path. * Generate a pdf file with a filename and get path.

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Zoomyboy\MedialibraryHelper\Tests\Events; namespace Workbench\App\Events;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Zoomyboy\MedialibraryHelper\Tests\Events; namespace Workbench\App\Events;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Zoomyboy\MedialibraryHelper\Tests\Events; namespace Workbench\App\Events;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Zoomyboy\MedialibraryHelper\Tests\Models; namespace Workbench\App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
@ -8,9 +8,9 @@ use Illuminate\Support\Str;
use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia; use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media; use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaChange; use Workbench\App\Events\MediaChange;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaDestroyed; use Workbench\App\Events\MediaDestroyed;
use Zoomyboy\MedialibraryHelper\Tests\Events\MediaStored; use Workbench\App\Events\MediaStored;
class Post extends Model implements HasMedia class Post extends Model implements HasMedia
{ {