Files
UNIT3D/tests/Feature/Http/Controllers/HomeControllerTest.php
2023-07-11 16:48:07 -04:00

71 lines
2.6 KiB
PHP

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
use App\Models\Article;
use App\Models\Bookmark;
use App\Models\FeaturedTorrent;
use App\Models\FreeleechToken;
use App\Models\Group;
use App\Models\Movie;
use App\Models\Poll;
use App\Models\Post;
use App\Models\Topic;
use App\Models\Torrent;
use App\Models\Tv;
use App\Models\User;
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.');
$poll = Poll::factory()->create();
$articles = Article::factory()->times(3)->create();
$users = User::factory()->times(3)->create();
$groups = Group::factory()->times(3)->create();
$torrents = Torrent::factory()->times(3)->create();
$movies = Movie::factory()->times(3)->create();
$tvs = Tv::factory()->times(3)->create();
$topics = Topic::factory()->times(3)->create();
$posts = Post::factory()->times(3)->create();
$featuredTorrents = FeaturedTorrent::factory()->times(3)->create();
$freeleechTokens = FreeleechToken::factory()->times(3)->create();
$bookmarks = Bookmark::factory()->times(3)->create();
$user = User::factory()->create();
$response = $this->actingAs($user)->get(route('home.index'));
$response->assertOk();
$response->assertViewIs('home.index');
$response->assertViewHas('user', $user);
$response->assertViewHas('personal_freeleech');
$response->assertViewHas('users', $users);
$response->assertViewHas('groups', $groups);
$response->assertViewHas('articles', $articles);
$response->assertViewHas('newest');
$response->assertViewHas('seeded');
$response->assertViewHas('dying');
$response->assertViewHas('leeched');
$response->assertViewHas('dead');
$response->assertViewHas('topics', $topics);
$response->assertViewHas('posts', $posts);
$response->assertViewHas('featured');
$response->assertViewHas('poll', $poll);
$response->assertViewHas('uploaders');
$response->assertViewHas('past_uploaders');
$response->assertViewHas('freeleech_tokens');
$response->assertViewHas('bookmarks', $bookmarks);
// TODO: perform additional assertions
});
// test cases...