<?php

namespace Tests\Unit;

use Tests\BaseTestCase;

/**
 * Sample Test
 * Verifies that the testing framework is set up correctly
 */
class SampleTest extends BaseTestCase {
    
    /**
     * Test that PHPUnit is working
     */
    public function testPhpUnitIsWorking() {
        $this->assertTrue(true);
    }
    
    /**
     * Test database connection
     */
    public function testDatabaseConnection() {
        $this->assertNotNull($this->db);
        $this->assertInstanceOf(\Database::class, $this->db);
    }
    
    /**
     * Test helper functions
     */
    public function testHelperFunctions() {
        // Test sanitize
        $dirty = '<script>alert("xss")</script>';
        $clean = sanitize($dirty);
        $this->assertStringNotContainsString('<script>', $clean);
        
        // Test date formatting
        $date = '2024-12-15';
        $formatted = formatDate($date, 'd-m-Y');
        $this->assertEquals('15-12-2024', $formatted);
        
        // Test today's date
        $today = getToday();
        $this->assertValidDate($today);
    }
}
