Forum: - TipTap WYSIWYG editor with full toolbar - @emoji-mart/react emoji picker (consistent with tweets) - @mention autocomplete with user search API - Fix PHP 8.4 parse errors in Blade templates - Fix thread data display (paginator items) - Align forum page widths to max-w-5xl Discover: - Extract shared _nav.blade.php partial - Add missing nav links to for-you page - Add Following link for authenticated users Feed/Posts: - Post model, controllers, policies, migrations - Feed page components (PostComposer, FeedCard, etc) - Post reactions, comments, saves, reports, sharing - Scheduled publishing support - Link preview controller Profile: - Profile page components (ProfileHero, ProfileTabs) - Profile API controller Uploads: - Upload wizard enhancements - Scheduled publish picker - Studio status bar and readiness checklist
49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Artwork;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class DashboardFavoritesTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
public function test_guest_is_redirected_from_favorites(): void
|
|
{
|
|
$this->get('/dashboard/favorites')->assertRedirect('/login');
|
|
}
|
|
|
|
public function test_authenticated_user_sees_favourites_and_can_remove(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
$art = Artwork::factory()->create(['user_id' => $user->id, 'title' => 'Fav Artwork']);
|
|
|
|
DB::table('artwork_favourites')->insert([
|
|
'user_id' => $user->id,
|
|
'artwork_id' => $art->id,
|
|
'created_at' => now(),
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
$response = $this->actingAs($user)
|
|
->get(route('dashboard.favorites'))
|
|
->assertOk()
|
|
->assertSee('Fav Artwork');
|
|
|
|
$html = $response->getContent();
|
|
$this->assertNotFalse($html);
|
|
$this->assertStringContainsString('data-react-masonry-gallery', $html);
|
|
$this->assertStringContainsString('data-artworks=', $html);
|
|
$this->assertStringContainsString('data-gallery-type="dashboard-favorites"', $html);
|
|
|
|
$this->actingAs($user)
|
|
->delete(route('dashboard.favorites.destroy', ['artwork' => $art->id]))
|
|
->assertRedirect(route('dashboard.favorites'));
|
|
|
|
$this->assertDatabaseMissing('artwork_favourites', ['user_id' => $user->id, 'artwork_id' => $art->id]);
|
|
}
|
|
}
|