From ec631823b93ac1dcc464e911f00e219988c5906d Mon Sep 17 00:00:00 2001 From: Marley Rae Date: Mon, 25 Apr 2022 19:50:01 -0700 Subject: [PATCH] testin --- app/Http/Controllers/JoinedController.php | 12 +- app/Http/Livewire/Admin/ListFanlistings.php | 28 ++++ app/Http/Requests/StoreJoinedRequest.php | 6 +- artisan | 0 composer.json | 4 +- composer.lock | 145 +++++++++++++++++- database/factories/UserFactory.php | 42 ----- database/seeders/JoinedSeeder.php | 3 +- public/css/admin/style.css | 13 +- resources/sass/admin/_modules.scss | 7 + resources/sass/admin/_vars.scss | 1 + resources/views/admin/joined/index.blade.php | 34 +--- resources/views/admin/layout.blade.php | 4 + .../livewire/admin/list-fanlistings.blade.php | 49 ++++++ .../vendor/livewire/simple-tailwind.blade.php | 31 ++++ .../views/vendor/livewire/tailwind.blade.php | 56 +++++++ routes/web.php | 16 +- tests/Feature/Joined/CreateTest.php | 102 ++++++++++++ tests/Feature/Joined/IndexTest.php | 13 ++ tests/Feature/JoinedTest.php | 90 ----------- 20 files changed, 471 insertions(+), 185 deletions(-) create mode 100644 app/Http/Livewire/Admin/ListFanlistings.php mode change 100644 => 100755 artisan delete mode 100644 database/factories/UserFactory.php create mode 100644 resources/views/livewire/admin/list-fanlistings.blade.php create mode 100644 resources/views/vendor/livewire/simple-tailwind.blade.php create mode 100644 resources/views/vendor/livewire/tailwind.blade.php create mode 100644 tests/Feature/Joined/CreateTest.php create mode 100644 tests/Feature/Joined/IndexTest.php delete mode 100644 tests/Feature/JoinedTest.php diff --git a/app/Http/Controllers/JoinedController.php b/app/Http/Controllers/JoinedController.php index fc9578d..05cf561 100644 --- a/app/Http/Controllers/JoinedController.php +++ b/app/Http/Controllers/JoinedController.php @@ -17,9 +17,7 @@ public function __construct() public function index() { $collective = auth_collective(); - return view('admin.joined.index')->with([ - 'joined' => $collective->joined()->paginate(8), - ]); + return view('admin.joined.index'); } public function create() @@ -40,7 +38,13 @@ public function store(StoreJoinedRequest $request) ]); Joined::store($validated); - return redirect()->route('joined.index')->with('success', 'Fanlisting added.'); + return redirect()->route('admin.joined.index')->with('success', 'Fanlisting added.'); + } + + public function approve(Joined $joined) + { + $joined->approve(); + return redirect()->route('admin.joined.index')->with('success', 'Fanlisting approved.'); } public function show(Joined $joined) diff --git a/app/Http/Livewire/Admin/ListFanlistings.php b/app/Http/Livewire/Admin/ListFanlistings.php new file mode 100644 index 0000000..49f8b47 --- /dev/null +++ b/app/Http/Livewire/Admin/ListFanlistings.php @@ -0,0 +1,28 @@ +class == 'joined') { + $fanlistings = auth_collective()->joined()->paginate(8); + } else if ($this->class == 'owned') { + // + } + + return view('livewire.admin.list-fanlistings', [ + 'fanlistings' => $fanlistings, + ]); + } +} diff --git a/app/Http/Requests/StoreJoinedRequest.php b/app/Http/Requests/StoreJoinedRequest.php index b60a3d4..10325cc 100644 --- a/app/Http/Requests/StoreJoinedRequest.php +++ b/app/Http/Requests/StoreJoinedRequest.php @@ -2,7 +2,9 @@ namespace App\Http\Requests; +use App\Models\Joined; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Auth; class StoreJoinedRequest extends FormRequest { @@ -13,7 +15,7 @@ class StoreJoinedRequest extends FormRequest */ public function authorize() { - return true; + return $this->user()->can('create', Joined::class); } /** @@ -32,4 +34,4 @@ public function rules() 'approved' => ['nullable', 'boolean'], ]; } -} +} \ No newline at end of file diff --git a/artisan b/artisan old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json index 70ee27f..83d99ff 100644 --- a/composer.json +++ b/composer.json @@ -9,13 +9,15 @@ "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^9.2", "laravel/sanctum": "^2.14.1", - "laravel/tinker": "^2.7" + "laravel/tinker": "^2.7", + "livewire/livewire": "^2.10" }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", + "pestphp/pest-plugin-faker": "^1.0", "pestphp/pest-plugin-laravel": "^1.2", "phpunit/phpunit": "^9.5.10", "spatie/laravel-ignition": "^1.0" diff --git a/composer.lock b/composer.lock index 3a670e3..31affea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cb04fd9a53709c6f2ef827bfaf387e82", + "content-hash": "599c7b7d23bd5330b16dc91c44fd08af", "packages": [ { "name": "brick/math", @@ -1598,6 +1598,79 @@ ], "time": "2022-04-17T13:12:02+00:00" }, + { + "name": "livewire/livewire", + "version": "v2.10.5", + "source": { + "type": "git", + "url": "https://github.com/livewire/livewire.git", + "reference": "9ea6237760f627b3b6a05d15137880780ac843b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/livewire/livewire/zipball/9ea6237760f627b3b6a05d15137880780ac843b5", + "reference": "9ea6237760f627b3b6a05d15137880780ac843b5", + "shasum": "" + }, + "require": { + "illuminate/database": "^7.0|^8.0|^9.0", + "illuminate/support": "^7.0|^8.0|^9.0", + "illuminate/validation": "^7.0|^8.0|^9.0", + "league/mime-type-detection": "^1.9", + "php": "^7.2.5|^8.0", + "symfony/http-kernel": "^5.0|^6.0" + }, + "require-dev": { + "calebporzio/sushi": "^2.1", + "laravel/framework": "^7.0|^8.0|^9.0", + "mockery/mockery": "^1.3.1", + "orchestra/testbench": "^5.0|^6.0|^7.0", + "orchestra/testbench-dusk": "^5.2|^6.0|^7.0", + "phpunit/phpunit": "^8.4|^9.0", + "psy/psysh": "@stable" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Livewire\\LivewireServiceProvider" + ], + "aliases": { + "Livewire": "Livewire\\Livewire" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Livewire\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Caleb Porzio", + "email": "calebporzio@gmail.com" + } + ], + "description": "A front-end framework for Laravel.", + "support": { + "issues": "https://github.com/livewire/livewire/issues", + "source": "https://github.com/livewire/livewire/tree/v2.10.5" + }, + "funding": [ + { + "url": "https://github.com/livewire", + "type": "github" + } + ], + "time": "2022-04-07T21:38:12+00:00" + }, { "name": "monolog/monolog", "version": "2.5.0", @@ -5857,6 +5930,76 @@ ], "time": "2021-01-03T15:53:42+00:00" }, + { + "name": "pestphp/pest-plugin-faker", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-faker.git", + "reference": "9d93419f1f47ffd856ee544317b2f9144a129044" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-faker/zipball/9d93419f1f47ffd856ee544317b2f9144a129044", + "reference": "9d93419f1f47ffd856ee544317b2f9144a129044", + "shasum": "" + }, + "require": { + "fakerphp/faker": "^1.9.1", + "pestphp/pest": "^1.0", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "pestphp/pest-dev-tools": "dev-master" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/Faker.php" + ], + "psr-4": { + "Pest\\Faker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest Faker Plugin", + "keywords": [ + "faker", + "framework", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-faker/tree/v1.0.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2021-01-03T15:42:35+00:00" + }, { "name": "pestphp/pest-plugin-laravel", "version": "v1.2.0", diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php deleted file mode 100644 index 23b61d2..0000000 --- a/database/factories/UserFactory.php +++ /dev/null @@ -1,42 +0,0 @@ - - */ -class UserFactory extends Factory -{ - /** - * Define the model's default state. - * - * @return array - */ - public function definition() - { - return [ - 'name' => $this->faker->name(), - 'email' => $this->faker->unique()->safeEmail(), - 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'remember_token' => Str::random(10), - ]; - } - - /** - * Indicate that the model's email address should be unverified. - * - * @return static - */ - public function unverified() - { - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); - } -} diff --git a/database/seeders/JoinedSeeder.php b/database/seeders/JoinedSeeder.php index 6910507..11e461a 100644 --- a/database/seeders/JoinedSeeder.php +++ b/database/seeders/JoinedSeeder.php @@ -16,10 +16,9 @@ class JoinedSeeder extends Seeder */ public function run() { - $cats = Category::all(); Joined::factory() ->count(50) - ->hasAttached($cats->random()) + ->hasAttached(Category::inRandomOrder()->limit(rand(0,10))) ->create(); } } diff --git a/public/css/admin/style.css b/public/css/admin/style.css index 41297cf..9903cf3 100644 --- a/public/css/admin/style.css +++ b/public/css/admin/style.css @@ -6,18 +6,20 @@ .form__input--file::-webkit-file-upload-button { margin-right: 5px; line-height: normal; cursor: pointer; + text-decoration: none; border-color: #7874ff; background-color: #e4e3ff; color: #7874ff; -webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s; transition: background-color 0.4s, border-color 0.4s, color 0.4s; } -.pagination__item, .pagination__item--disabled, .pagination__item--active, .l-page-nav__link, .form__input--file::file-selector-button, .form__btn { +.pagination__item, .pagination__item--disabled, .pagination__item--active, .btn--table, .l-page-nav__link, .form__input--file::file-selector-button, .form__btn { border: 1px solid #7874ff; padding: 5px 10px; margin-right: 5px; line-height: normal; cursor: pointer; + text-decoration: none; border-color: #7874ff; background-color: #e4e3ff; color: #7874ff; @@ -30,7 +32,7 @@ .form__input--file:hover::-webkit-file-upload-button { -webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s; transition: background-color 0.4s, border-color 0.4s, color 0.4s; } -.pagination__item:hover, .pagination__item--disabled:hover, .pagination__item--active:hover, .l-page-nav__link:hover, .form__input--file:hover::file-selector-button, .form__btn:hover { +.pagination__item:hover, .pagination__item--disabled:hover, .pagination__item--active:hover, .btn--table:hover, .l-page-nav__link:hover, .form__input--file:hover::file-selector-button, .form__btn:hover { border-color: #de7cff; background-color: #f8e5ff; color: #de7cff; @@ -43,7 +45,7 @@ .form__input--file:focus::-webkit-file-upload-button { -webkit-transition: background-color 0.4s, border-color 0.4s, color 0.4s; transition: background-color 0.4s, border-color 0.4s, color 0.4s; } -.pagination__item:focus, .pagination__item--disabled:focus, .pagination__item--active:focus, .l-page-nav__link:focus, .form__input--file:focus::file-selector-button, .form__btn:focus { +.pagination__item:focus, .pagination__item--disabled:focus, .pagination__item--active:focus, .btn--table:focus, .l-page-nav__link:focus, .form__input--file:focus::file-selector-button, .form__btn:focus { border-color: #de7cff; background-color: #f8e5ff; color: #de7cff; @@ -360,6 +362,11 @@ .pagination__item:not(:last-child), .pagination__item--disabled:not(:last-child) border-right: none; } +/* ----------------------------------------------------------------------------------- &BTNS ---- */ +.btn--table { + margin: 0; +} + .text--error { color: #e20000; } diff --git a/resources/sass/admin/_modules.scss b/resources/sass/admin/_modules.scss index eb63e4d..be65ec7 100644 --- a/resources/sass/admin/_modules.scss +++ b/resources/sass/admin/_modules.scss @@ -36,4 +36,11 @@ .pagination__item--disabled, .pagination__item--active { @extend .pagination__item; @extend %disabled; +} + +/* ----------------------------------------------------------------------------------- &BTNS ---- */ + +.btn--table { + @extend %btn; + margin: 0; } \ No newline at end of file diff --git a/resources/sass/admin/_vars.scss b/resources/sass/admin/_vars.scss index 6f0c7d8..d030df8 100644 --- a/resources/sass/admin/_vars.scss +++ b/resources/sass/admin/_vars.scss @@ -56,6 +56,7 @@ $c-red: #e20000; margin-right: 5px; line-height: normal; cursor: pointer; + text-decoration: none; @include hover; } diff --git a/resources/views/admin/joined/index.blade.php b/resources/views/admin/joined/index.blade.php index d79c098..748b328 100644 --- a/resources/views/admin/joined/index.blade.php +++ b/resources/views/admin/joined/index.blade.php @@ -7,37 +7,5 @@ @section('pg-title', 'Joined') @section('content') -@inject('Category', 'App\Models\Category') - - - - - - {{-- link --}} - - - - - - - - @foreach ($joined as $fl) - - - - - - - - - - @endforeach - -
{{-- approved --}}SubjectCategoriesImageActions
- @if (!$fl->approved) - × - @endif - {{ $fl->subject }}{{ $fl->listCategories() }}
- - {{ $joined->links() }} + @endsection \ No newline at end of file diff --git a/resources/views/admin/layout.blade.php b/resources/views/admin/layout.blade.php index 4c53a30..ef9c804 100644 --- a/resources/views/admin/layout.blade.php +++ b/resources/views/admin/layout.blade.php @@ -8,6 +8,8 @@ + +
@@ -54,5 +56,7 @@
+ + \ No newline at end of file diff --git a/resources/views/livewire/admin/list-fanlistings.blade.php b/resources/views/livewire/admin/list-fanlistings.blade.php new file mode 100644 index 0000000..b25eabc --- /dev/null +++ b/resources/views/livewire/admin/list-fanlistings.blade.php @@ -0,0 +1,49 @@ +
+ + + + + {{-- link --}} + + + + + + + + @foreach ($fanlistings as $fl) + + + + + + + + + + + + + @endforeach + +
{{-- approved --}}SubjectCategoriesImageActions
+ @if (!$fl->approved) + × + @endif + {{ $fl->subject }}{{ $fl->listCategories() }} + @if ($class == 'joined') + + Approve + + @elseif ($class == 'owned') + View + @endif + + Edit + + +
+ + {{ $fanlistings->links() }} +
diff --git a/resources/views/vendor/livewire/simple-tailwind.blade.php b/resources/views/vendor/livewire/simple-tailwind.blade.php new file mode 100644 index 0000000..f33ccb3 --- /dev/null +++ b/resources/views/vendor/livewire/simple-tailwind.blade.php @@ -0,0 +1,31 @@ +
+ @if ($paginator->hasPages()) + + @endif +
\ No newline at end of file diff --git a/resources/views/vendor/livewire/tailwind.blade.php b/resources/views/vendor/livewire/tailwind.blade.php new file mode 100644 index 0000000..67d1469 --- /dev/null +++ b/resources/views/vendor/livewire/tailwind.blade.php @@ -0,0 +1,56 @@ +
+ @if ($paginator->hasPages()) + @php(isset($this->numberOfPaginatorsRendered[$paginator->getPageName()]) ? $this->numberOfPaginatorsRendered[$paginator->getPageName()]++ : $this->numberOfPaginatorsRendered[$paginator->getPageName()] = 1) + + + @endif +
diff --git a/routes/web.php b/routes/web.php index efc70b4..d6a56d9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,18 +32,20 @@ Route::get('/fanatic', [CollectiveController::class, 'dashboard'])->name('admin.dashboard'); Route::delete('/fanatic', [SessionsController::class, 'destroy'])->name('admin.sessions.destroy'); - Route::get('/fanatic/joined', [JoinedController::class, 'index']) + Route::get('/fanatic/joined', [JoinedController::class, 'index']) ->name('admin.joined.index'); - Route::get('/fanatic/joined/create', [JoinedController::class, 'create']) + Route::get('/fanatic/joined/create', [JoinedController::class, 'create']) ->name('admin.joined.create'); - Route::post('/fanatic/joined', [JoinedController::class, 'store']) + Route::post('/fanatic/joined', [JoinedController::class, 'store']) ->name('admin.joined.store'); - Route::get('/admin/joined/{joined}', [JoinedController::class, 'show']) + Route::patch('/fanatic/joined/{joined}/approve', [JoinedController::class, 'approve']) + ->name('admin.joined.approve'); + Route::get('/fanatic/joined/{joined}', [JoinedController::class, 'show']) ->name('admin.joined.show'); - Route::get('/admin/joined/{joined}/edit', [JoinedController::class, 'edit']) + Route::get('/fanatic/joined/{joined}/edit', [JoinedController::class, 'edit']) ->name('admin.joined.edit'); - Route::patch('/admin/joined/{joined}', [JoinedController::class, 'update']) + Route::patch('/fanatic/joined/{joined}', [JoinedController::class, 'update']) ->name('admin.joined.update'); - Route::delete('/admin/joined/{joined}', [JoinedController::class, 'destroy']) + Route::delete('/fanatic/joined/{joined}', [JoinedController::class, 'destroy']) ->name('admin.joined.destroy'); }); diff --git a/tests/Feature/Joined/CreateTest.php b/tests/Feature/Joined/CreateTest.php new file mode 100644 index 0000000..d459d0c --- /dev/null +++ b/tests/Feature/Joined/CreateTest.php @@ -0,0 +1,102 @@ +user = Collective::first(); + $this->request = [ + 'categories' => [rand(1,57), rand(1,57), rand(1,57)], + 'url' => faker()->url, + 'subject' => faker()->word, + 'approved' => faker()->boolean, + ]; +}); + +it('gets joined create', function () { + $response = $this->actingAs($this->user)->get('fanatic/joined/create'); + $response->assertViewIs('admin.joined.create'); +}); + +it('does not show create to guests', function () { + $response = $this->get('/fanatic/joined/create'); + $response->assertRedirect('/fanatic/login'); +}); + +it('validates correct joined create form', function () { + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertValid(); +}); + +it('fails missing categories', function () { + unset($this->request['categories']); + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails incorrect category format', function () { + $this->request['categories'] = rand(1,57); + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails incorrect category item format', function () { + $this->request['categories'][] = 'a'; + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails non-existant category', function () { + $invalidCat = (Category::all()->count()) + 10; + $this->request['categories'][] = $invalidCat; + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails missing url', function () { + unset($this->request['url']); + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails incorrect url format', function () { + $this->request['url'] = faker()->word; + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails missing subject', function () { + unset($this->request['subject']); + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('fails non-string subject', function () { + $this->request['subject'] = 34950; + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); + +it('validates empty approved', function () { + unset($this->request['approved']); + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertValid(); +}); + +it('fails non-bool approved', function () { + $this->request['approved'] = 'text'; + $response = $this->actingAs($this->user)->post('/fanatic/joined', $this->request); + + $response->assertInvalid(); +}); \ No newline at end of file diff --git a/tests/Feature/Joined/IndexTest.php b/tests/Feature/Joined/IndexTest.php new file mode 100644 index 0000000..767f681 --- /dev/null +++ b/tests/Feature/Joined/IndexTest.php @@ -0,0 +1,13 @@ +actingAs(Collective::first())->get('/fanatic/joined'); + $response->assertViewIs('admin.joined.index'); +}); + +it('does not show index to guests', function () { + $response = $this->get('/fanatic/joined'); + $response->assertRedirect('/fanatic/login'); +}); \ No newline at end of file diff --git a/tests/Feature/JoinedTest.php b/tests/Feature/JoinedTest.php deleted file mode 100644 index a30c6f4..0000000 --- a/tests/Feature/JoinedTest.php +++ /dev/null @@ -1,90 +0,0 @@ -user = Collective::first(); -}); - -test('get joined index', function () { - $response = $this->actingAs($this->user)->get('fanatic/joined'); - $response->assertViewIs('admin.joined.index'); -}); - -test('get joined create', function () { - $response = $this->actingAs($this->user)->get('fanatic/joined/create'); - $response->assertViewIs('admin.joined.create'); -}); - -test('valid joined form passes create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'categories' => [3, 10], - 'url' => 'http://punkfairie.net', - 'subject' => 'Test', - ]); - - $response->assertValid(); -}); - -test('invalid category response does not pass create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'categories' => 4, - 'url' => 'http://punkfairie.net', - 'subject' => 'Test', - ]); - - $response->assertInvalid(); -}); - -test('invalid url does not pass create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'categories' => [4], - 'url' => 'hello', - 'subject' => 'Test', - ]); - - $response->assertInvalid(); -}); - -test('missing category does not pass create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'url' => 'https://punkfairie.net', - 'subject' => 'Test', - ]); - - $response->assertInvalid(); -}); - -test('missing subject does not pass create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'categories' => [1,5], - 'url' => 'https://punkfairie.net', - ]); - - $response->assertInvalid(); -}); - -test('missing url does not pass create validation', function () { - $response = $this->actingAs($this->user)->post('/fanatic/joined', [ - 'categories' => [2], - 'subject' => 'Test', - ]); - - $response->assertInvalid(); -}); - -// test('can upload joined button on create', function () { -// Storage::fake('local'); -// $file = UploadedFile::fake()->image('code.png'); - -// $response = $this->actingAs($this->user)->post('/fanatic/joined', [ -// 'categories' => [3, 10], -// 'url' => 'http://punkfairie.net', -// 'subject' => 'Test', -// 'image' => $file, -// ]); - -// Storage::disk('local')->assertExists($file->hashName()); -// }); \ No newline at end of file