<?php

declare(strict_types=1);

namespace App\Tests\Unit\Shared\Database;

use App\Shared\Infrastructure\Database\ColumnCommentsCatalog;
use PHPUnit\Framework\TestCase;

/**
 * @internal
 */
final class ColumnCommentsCatalogTest extends TestCase
{
    public function testTimestampableBlamableCommentsCoverFourColumns(): void
    {
        $sql = ColumnCommentsCatalog::timestampableBlamableComments('task');

        self::assertCount(4, $sql);
        self::assertSame(
            "COMMENT ON COLUMN task.created_at IS 'Date de creation (UTC). Rempli automatiquement (Timestampable).'",
            $sql[0],
        );
        self::assertStringContainsString('COMMENT ON COLUMN task.created_by IS', $sql[2]);
    }

    public function testTableNameIsInterpolatedForEveryColumn(): void
    {
        foreach (ColumnCommentsCatalog::timestampableBlamableComments('time_entry') as $statement) {
            self::assertStringContainsString('COMMENT ON COLUMN time_entry.', $statement);
        }
    }
}
