<?php
namespace Tests\Unit\admin\Controllers;

use PHPUnit\Framework\TestCase;
use admin\Controllers\DashboardController;
use Domain\Dashboard\DashboardRepository;
use Domain\ShopStatus\ShopStatusRepository;

class DashboardControllerTest extends TestCase
{
    private $repository;
    private $statusesRepository;
    private $controller;

    protected function setUp(): void
    {
        $this->repository = $this->createMock(DashboardRepository::class);
        $this->statusesRepository = $this->createMock(ShopStatusRepository::class);
        $this->controller = new DashboardController($this->repository, $this->statusesRepository);
    }

    public function testConstructorAcceptsRepositories(): void
    {
        $controller = new DashboardController($this->repository, $this->statusesRepository);
        $this->assertInstanceOf(DashboardController::class, $controller);
    }

    public function testHasMainViewMethod(): void
    {
        $this->assertTrue(method_exists($this->controller, 'main_view'));
    }

    public function testMainViewReturnsString(): void
    {
        $reflection = new \ReflectionClass($this->controller);
        $this->assertEquals('string', (string)$reflection->getMethod('main_view')->getReturnType());
    }

    public function testConstructorRequiresRepositories(): void
    {
        $reflection = new \ReflectionClass(DashboardController::class);
        $constructor = $reflection->getConstructor();
        $params = $constructor->getParameters();

        $this->assertCount(2, $params);
        $this->assertEquals('Domain\Dashboard\DashboardRepository', $params[0]->getType()->getName());
        $this->assertEquals('Domain\ShopStatus\ShopStatusRepository', $params[1]->getType()->getName());
    }
}
