<?php

namespace Tests\Feature;

use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
 * Page publique de téléchargement des applications mobiles.
 */
class DownloadTest extends TestCase
{
    #[Test]
    public function la_page_de_telechargement_est_publique()
    {
        $this->get('/telecharger')
            ->assertOk()
            ->assertSee('Android')
            ->assertSee('Apple');
    }

    #[Test]
    public function un_lien_de_store_configure_est_propose()
    {
        config(['mobile.android.url' => 'https://play.google.com/store/apps/details?id=fr.cesizen']);

        $this->get('/telecharger')
            ->assertOk()
            ->assertSee('play.google.com');
    }

    #[Test]
    public function sans_lien_ni_fichier_le_bouton_est_desactive()
    {
        config(['mobile.ios.url' => null, 'mobile.ios.file' => 'downloads/inexistant.ipa']);

        $this->get('/telecharger')
            ->assertOk()
            ->assertSee('Bientôt disponible');
    }
}
