<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminDashboardRecentPlatformOrdersViewAllLinkShouldCarryBackTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_dashboard_recent_platform_orders_view_all_link_should_carry_back(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin');
        $res->assertOk();

        $res->assertSee('href="/admin/platform-orders?back=%2Fadmin"', false);
        $res->assertDontSee('&amp;back=', false);
    }
}
