<?php

namespace MintyPHP\Tests\Service\Settings;

use MintyPHP\Service\Settings\SettingGateway;
use PHPUnit\Framework\TestCase;

class SettingGatewayTest extends TestCase
{
    public function testGetDefaultTenantIdDelegatesToService(): void
    {
        $settingService = $this->createMock('MintyPHP\\Service\\Settings\\SettingService');
        $settingService->expects($this->once())
            ->method('getDefaultTenantId')
            ->willReturn(42);

        $gateway = new SettingGateway($settingService);
        $this->assertSame(42, $gateway->getDefaultTenantId());
    }

    public function testSetDefaultRoleIdDelegatesToService(): void
    {
        $settingService = $this->createMock('MintyPHP\\Service\\Settings\\SettingService');
        $settingService->expects($this->once())
            ->method('setDefaultRoleId')
            ->with(7, null)
            ->willReturn(true);

        $gateway = new SettingGateway($settingService);
        $this->assertTrue($gateway->setDefaultRoleId(7));
    }
}
