mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-04-14 03:32:01 +02:00
Refactor model controller tests
This commit is contained in:
parent
83dc0b5e54
commit
79a6c34a09
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@
|
||||
/public/mix-manifest.json
|
||||
/resources/lang/vendor
|
||||
/storage/*.key
|
||||
/tests/Controller/logs
|
||||
/vendor
|
||||
/.idea
|
||||
/.tmp
|
||||
|
@ -35,6 +35,8 @@ class LinkControllerTest extends TestCase
|
||||
Http::fake([
|
||||
'example.com' => Http::response($testHtml, 200),
|
||||
]);
|
||||
|
||||
Queue::fake();
|
||||
}
|
||||
|
||||
public function testIndexView(): void
|
||||
@ -43,7 +45,7 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('links');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($link->url);
|
||||
}
|
||||
|
||||
@ -51,14 +53,12 @@ class LinkControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('links/create');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Add Link');
|
||||
}
|
||||
|
||||
public function testMinimalStoreRequest(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$response = $this->post('links', [
|
||||
'url' => 'https://example.com',
|
||||
]);
|
||||
@ -75,8 +75,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testFullStoreRequest(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$tag = factory(Tag::class)->create();
|
||||
$list = factory(LinkList::class)->create();
|
||||
|
||||
@ -102,8 +100,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithPrivateDefault(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
Setting::create([
|
||||
'user_id' => 1,
|
||||
'key' => 'links_private_default',
|
||||
@ -128,8 +124,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithDuplicate(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
factory(Link::class)->create([
|
||||
'url' => 'https://example.com/',
|
||||
]);
|
||||
@ -151,8 +145,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithBrokenUrl(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
Http::fake([
|
||||
'example.com' => Http::response('', 500),
|
||||
]);
|
||||
@ -177,8 +169,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithContinue(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$response = $this->post('links', [
|
||||
'url' => 'https://example.com',
|
||||
'reload_view' => '1',
|
||||
@ -193,8 +183,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithoutArchiveBackup(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
Setting::create([
|
||||
'user_id' => 1,
|
||||
'key' => 'archive_backups_enabled',
|
||||
@ -215,8 +203,6 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testStoreRequestWithoutPrivateArchiveBackup(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
Setting::create([
|
||||
'user_id' => 1,
|
||||
'key' => 'archive_backups_enabled',
|
||||
@ -258,7 +244,7 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('links/1');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($link->url);
|
||||
}
|
||||
|
||||
@ -268,7 +254,7 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('links/1/edit');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Edit Link');
|
||||
}
|
||||
|
||||
@ -276,8 +262,7 @@ class LinkControllerTest extends TestCase
|
||||
{
|
||||
$baseLink = factory(Link::class)->create();
|
||||
|
||||
$response = $this->post('links/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('links/1', [
|
||||
'url' => 'https://new-example.com',
|
||||
'title' => 'New Title',
|
||||
'description' => 'New Description',
|
||||
@ -304,8 +289,7 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForUpdate(): void
|
||||
{
|
||||
$response = $this->post('links/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('links/1', [
|
||||
'link_id' => '1',
|
||||
'url' => 'https://new-example.com',
|
||||
'title' => 'New Title',
|
||||
@ -315,7 +299,7 @@ class LinkControllerTest extends TestCase
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUniquePropertyValidation(): void
|
||||
@ -323,8 +307,7 @@ class LinkControllerTest extends TestCase
|
||||
factory(Link::class)->create(['url' => 'https://old-example.com']);
|
||||
$baseLink = factory(Link::class)->create();
|
||||
|
||||
$response = $this->post('links/2', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('links/2', [
|
||||
'link_id' => $baseLink->id,
|
||||
'url' => 'https://old-example.com',
|
||||
'title' => 'New Title',
|
||||
@ -343,8 +326,7 @@ class LinkControllerTest extends TestCase
|
||||
{
|
||||
$baseLink = factory(Link::class)->create();
|
||||
|
||||
$response = $this->post('links/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('links/1', [
|
||||
'link_id' => $baseLink->id,
|
||||
//'url' => 'https://new-example.com',
|
||||
'title' => 'New Title',
|
||||
@ -363,9 +345,7 @@ class LinkControllerTest extends TestCase
|
||||
{
|
||||
factory(Link::class)->create();
|
||||
|
||||
$response = $this->post('links/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->delete('links/1');
|
||||
|
||||
$response->assertRedirect('links');
|
||||
|
||||
@ -376,11 +356,9 @@ class LinkControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForDelete(): void
|
||||
{
|
||||
$response = $this->post('links/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->delete('links/1');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testCheckToggleRequest(): void
|
||||
|
@ -5,14 +5,12 @@ namespace Tests\Controller\Models;
|
||||
use App\Models\LinkList;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ListControllerTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
use DatabaseMigrations;
|
||||
use RefreshDatabase;
|
||||
|
||||
private $user;
|
||||
|
||||
@ -33,7 +31,7 @@ class ListControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('lists');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($list->name);
|
||||
}
|
||||
|
||||
@ -41,7 +39,7 @@ class ListControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('lists/create');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Add List');
|
||||
}
|
||||
|
||||
@ -52,8 +50,7 @@ class ListControllerTest extends TestCase
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists/1');
|
||||
$response->assertRedirect('lists/1');
|
||||
|
||||
$databaseList = LinkList::first();
|
||||
|
||||
@ -68,8 +65,7 @@ class ListControllerTest extends TestCase
|
||||
'is_private' => '1',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists/1');
|
||||
$response->assertRedirect('lists/1');
|
||||
|
||||
$databaseList = LinkList::first();
|
||||
|
||||
@ -90,8 +86,7 @@ class ListControllerTest extends TestCase
|
||||
'is_private' => usersettings('lists_private_default'),
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists/1');
|
||||
$response->assertRedirect('lists/1');
|
||||
|
||||
$databaseList = LinkList::first();
|
||||
|
||||
@ -106,8 +101,7 @@ class ListControllerTest extends TestCase
|
||||
'reload_view' => '1',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists/create');
|
||||
$response->assertRedirect('lists/create');
|
||||
|
||||
$databaseList = LinkList::first();
|
||||
|
||||
@ -134,7 +128,7 @@ class ListControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('lists/1');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($list->name);
|
||||
}
|
||||
|
||||
@ -146,7 +140,7 @@ class ListControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('lists/1/edit');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Edit List')
|
||||
->assertSee('Update List');
|
||||
}
|
||||
@ -155,7 +149,7 @@ class ListControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('lists/1/edit');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUpdateResponse(): void
|
||||
@ -164,15 +158,13 @@ class ListControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('lists/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('lists/1', [
|
||||
'list_id' => $baseList->id,
|
||||
'name' => 'New Test List',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists/1');
|
||||
$response->assertRedirect('lists/1');
|
||||
|
||||
$updatedLink = $baseList->fresh();
|
||||
|
||||
@ -181,14 +173,13 @@ class ListControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForUpdate(): void
|
||||
{
|
||||
$response = $this->post('lists/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('lists/1', [
|
||||
'list_id' => '1',
|
||||
'name' => 'New Test List',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUniquePropertyValidation(): void
|
||||
@ -202,8 +193,7 @@ class ListControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('lists/2', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('lists/2', [
|
||||
'list_id' => $baseList->id,
|
||||
'name' => 'Taken List Name',
|
||||
'is_private' => '0',
|
||||
@ -220,8 +210,7 @@ class ListControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('lists/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('lists/1', [
|
||||
'list_id' => $baseList->id,
|
||||
//'name' => 'New Test List',
|
||||
'is_private' => '0',
|
||||
@ -238,12 +227,9 @@ class ListControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('lists/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->deleteJson('lists/1');
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('lists');
|
||||
$response->assertRedirect('lists');
|
||||
|
||||
$databaseList = LinkList::withTrashed()->first();
|
||||
|
||||
@ -253,10 +239,8 @@ class ListControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForDelete(): void
|
||||
{
|
||||
$response = $this->post('lists/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->delete('lists/1');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,12 @@ use App\Models\Link;
|
||||
use App\Models\Note;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class NoteControllerTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
use DatabaseMigrations;
|
||||
use RefreshDatabase;
|
||||
|
||||
private $user;
|
||||
|
||||
@ -36,8 +34,7 @@ class NoteControllerTest extends TestCase
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('links/1');
|
||||
$response->assertRedirect('links/1');
|
||||
|
||||
$this->assertEquals('Lorem ipsum dolor', $link->notes()->first()->note);
|
||||
}
|
||||
@ -58,8 +55,7 @@ class NoteControllerTest extends TestCase
|
||||
'is_private' => usersettings('notes_private_default'),
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('links/1');
|
||||
$response->assertRedirect('links/1');
|
||||
|
||||
$this->assertTrue($link->notes()->first()->is_private);
|
||||
}
|
||||
@ -87,7 +83,7 @@ class NoteControllerTest extends TestCase
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testEditView(): void
|
||||
@ -96,7 +92,7 @@ class NoteControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('notes/1/edit');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Edit Note');
|
||||
}
|
||||
|
||||
@ -104,22 +100,20 @@ class NoteControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('notes/1/edit');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUpdateResponse(): void
|
||||
{
|
||||
$baseNote = factory(Note::class)->create();
|
||||
|
||||
$response = $this->post('notes/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('notes/1', [
|
||||
'link_id' => $baseNote->link_id,
|
||||
'note' => 'Lorem ipsum dolor est updated',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('links/' . $baseNote->link_id);
|
||||
$response->assertRedirect('links/' . $baseNote->link_id);
|
||||
|
||||
$updatedLink = $baseNote->fresh();
|
||||
|
||||
@ -128,22 +122,20 @@ class NoteControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForUpdate(): void
|
||||
{
|
||||
$response = $this->post('notes/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('notes/1', [
|
||||
'link_id' => '1',
|
||||
'note' => 'Lorem ipsum dolor est updated',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testValidationErrorForUpdate(): void
|
||||
{
|
||||
$baseNote = factory(Note::class)->create();
|
||||
|
||||
$response = $this->post('notes/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('notes/1', [
|
||||
'note_id' => $baseNote->id,
|
||||
//'note' => 'Lorem ipsum dolor est updated',
|
||||
'is_private' => '0',
|
||||
@ -164,12 +156,9 @@ class NoteControllerTest extends TestCase
|
||||
'link_id' => $link->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('notes/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->deleteJson('notes/1');
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('links/' . $note->link_id);
|
||||
$response->assertRedirect('links/' . $note->link_id);
|
||||
|
||||
$databaseNote = Note::withTrashed()->first();
|
||||
|
||||
@ -178,10 +167,8 @@ class NoteControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForDelete(): void
|
||||
{
|
||||
$response = $this->post('notes/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->deleteJson('notes/1');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,12 @@ namespace Tests\Controller\Models;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Tag;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TagControllerTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
use DatabaseMigrations;
|
||||
use RefreshDatabase;
|
||||
|
||||
private $user;
|
||||
|
||||
@ -33,7 +31,7 @@ class TagControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('tags');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($tag->name);
|
||||
}
|
||||
|
||||
@ -41,7 +39,7 @@ class TagControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('tags/create');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Add Tag');
|
||||
}
|
||||
|
||||
@ -52,8 +50,7 @@ class TagControllerTest extends TestCase
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('tags/1');
|
||||
$response->assertRedirect('tags/1');
|
||||
|
||||
$databaseList = Tag::first();
|
||||
|
||||
@ -73,8 +70,7 @@ class TagControllerTest extends TestCase
|
||||
'is_private' => usersettings('tags_private_default'),
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('tags/1');
|
||||
$response->assertRedirect('tags/1');
|
||||
|
||||
$databaseList = Tag::first();
|
||||
|
||||
@ -89,8 +85,7 @@ class TagControllerTest extends TestCase
|
||||
'reload_view' => '1',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('tags/create');
|
||||
$response->assertRedirect('tags/create');
|
||||
|
||||
$databaseList = Tag::first();
|
||||
|
||||
@ -117,7 +112,7 @@ class TagControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('tags/1');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee($tag->name);
|
||||
}
|
||||
|
||||
@ -129,7 +124,7 @@ class TagControllerTest extends TestCase
|
||||
|
||||
$response = $this->get('tags/1/edit');
|
||||
|
||||
$response->assertStatus(200)
|
||||
$response->assertOk()
|
||||
->assertSee('Edit Tag')
|
||||
->assertSee('Update Tag');
|
||||
}
|
||||
@ -138,7 +133,7 @@ class TagControllerTest extends TestCase
|
||||
{
|
||||
$response = $this->get('tags/1/edit');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUpdateResponse(): void
|
||||
@ -147,15 +142,13 @@ class TagControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('tags/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('tags/1', [
|
||||
'tag_id' => $baseTag->id,
|
||||
'name' => 'New Test Tag',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('tags/1');
|
||||
$response->assertRedirect('tags/1');
|
||||
|
||||
$updatedLink = $baseTag->fresh();
|
||||
|
||||
@ -164,14 +157,13 @@ class TagControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForUpdate(): void
|
||||
{
|
||||
$response = $this->post('tags/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('tags/1', [
|
||||
'tag_id' => '1',
|
||||
'name' => 'New Test Tag',
|
||||
'is_private' => '0',
|
||||
]);
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function testUniquePropertyValidation(): void
|
||||
@ -185,8 +177,7 @@ class TagControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('tags/2', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('tags/2', [
|
||||
'tag_id' => $baseTag->id,
|
||||
'name' => 'taken-tag-name',
|
||||
'is_private' => '0',
|
||||
@ -203,8 +194,7 @@ class TagControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('tags/1', [
|
||||
'_method' => 'patch',
|
||||
$response = $this->patch('tags/1', [
|
||||
'tag_id' => $baseTag->id,
|
||||
//'name' => 'New Test Tag',
|
||||
'is_private' => '0',
|
||||
@ -221,12 +211,9 @@ class TagControllerTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$response = $this->post('tags/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->delete('tags/1');
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('tags');
|
||||
$response->assertRedirect('tags');
|
||||
|
||||
$databaseTag = Tag::withTrashed()->first();
|
||||
|
||||
@ -236,10 +223,8 @@ class TagControllerTest extends TestCase
|
||||
|
||||
public function testMissingModelErrorForDelete(): void
|
||||
{
|
||||
$response = $this->post('tags/1', [
|
||||
'_method' => 'delete',
|
||||
]);
|
||||
$response = $this->delete('tags/1');
|
||||
|
||||
$response->assertStatus(404);
|
||||
$response->assertNotFound();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user