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

use PHPUnit\Framework\TestCase;
use front\Controllers\ShopCouponController;
use Domain\Coupon\CouponRepository;

class ShopCouponControllerTest extends TestCase
{
    private $repository;
    private $controller;

    protected function setUp(): void
    {
        $this->repository = $this->createMock(CouponRepository::class);
        $this->controller = new ShopCouponController($this->repository);
    }

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

    public function testHasMainActionMethods(): void
    {
        $this->assertTrue(method_exists($this->controller, 'useCoupon'));
        $this->assertTrue(method_exists($this->controller, 'deleteCoupon'));
    }

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

        $this->assertCount(1, $params);
        $this->assertEquals('Domain\Coupon\CouponRepository', $params[0]->getType()->getName());
    }
}
