<?php

namespace Tests\Feature;

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

class ContentPagesTest extends TestCase
{
    /** @return array<int, array{0: string}> */
    public static function contentRoutes(): array
    {
        return [
            ['/software-para-prestamos'],
            ['/software-de-cobranza'],
            ['/gestion-de-cartera'],
            ['/como-administrar-negocio-de-prestamos'],
            ['/control-de-prestamos-excel'],
        ];
    }

    #[DataProvider('contentRoutes')]
    public function test_content_page_renders_with_seo(string $path): void
    {
        $res = $this->get($path);
        $res->assertOk();
        $res->assertSee('rel="canonical"', false);
        $res->assertSee('application/ld+json', false);
        $res->assertSee('href="https://credifygo.com'.$path.'"', false);
    }

    #[DataProvider('contentRoutes')]
    public function test_content_page_has_no_forbidden_brand_terms(string $path): void
    {
        $html = strtolower((string) $this->get($path)->getContent());
        $this->assertStringNotContainsString('pagadiario', $html);
        $this->assertStringNotContainsString('gota a gota', $html);
    }

    public function test_landing_has_no_forbidden_brand_terms(): void
    {
        $html = strtolower((string) $this->get('/')->getContent());
        $this->assertStringNotContainsString('pagadiario', $html);
        $this->assertStringNotContainsString('gota a gota', $html);
    }
}
