mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-20 11:49:31 -06:00
108 lines
3.6 KiB
PHP
108 lines
3.6 KiB
PHP
<?php
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('create returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get(route('staff.articles.create'));
|
|
|
|
$response->assertOk();
|
|
$response->assertViewIs('Staff.article.create');
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
test('destroy returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$article = \App\Models\Article::factory()->create();
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->delete(route('staff.articles.destroy', [$article]));
|
|
|
|
$response->assertOk();
|
|
$this->assertModelMissing($article);
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
test('edit returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$article = \App\Models\Article::factory()->create();
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get(route('staff.articles.edit', [$article]));
|
|
|
|
$response->assertOk();
|
|
$response->assertViewIs('Staff.article.edit');
|
|
$response->assertViewHas('article', $article);
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
test('index returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$articles = \App\Models\Article::factory()->times(3)->create();
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get(route('staff.articles.index'));
|
|
|
|
$response->assertOk();
|
|
$response->assertViewIs('Staff.article.index');
|
|
$response->assertViewHas('articles', $articles);
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
test('store validates with a form request', function (): void {
|
|
$this->assertActionUsesFormRequest(
|
|
\App\Http\Controllers\Staff\ArticleController::class,
|
|
'store',
|
|
\App\Http\Requests\Staff\StoreArticleRequest::class
|
|
);
|
|
});
|
|
|
|
test('store returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->post(route('staff.articles.store'), [
|
|
// TODO: send request data
|
|
]);
|
|
|
|
$response->assertOk();
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
test('update validates with a form request', function (): void {
|
|
$this->assertActionUsesFormRequest(
|
|
\App\Http\Controllers\Staff\ArticleController::class,
|
|
'update',
|
|
\App\Http\Requests\Staff\UpdateArticleRequest::class
|
|
);
|
|
});
|
|
|
|
test('update returns an ok response', function (): void {
|
|
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
|
|
|
$article = \App\Models\Article::factory()->create();
|
|
$user = \App\Models\User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->post(route('staff.articles.update', [$article]), [
|
|
// TODO: send request data
|
|
]);
|
|
|
|
$response->assertOk();
|
|
|
|
// TODO: perform additional assertions
|
|
});
|
|
|
|
// test cases...
|