<?php

declare(strict_types=1);

namespace Apexl\Tests\NotifierTwilio\UnitTests;

use apexl\Config\ConfigurationMock;
use Apexl\Io\NotifierTwilio\Dtos\TwilioConfigDto;
use apexl\Io\TestInfrastructure\UnitTest;
use PHPUnit\Framework\Attributes\Test;

final class TwilioConfigDtoTest extends UnitTest
{
    #[Test]
    public function fromConfigReadsTheTwilioBucket(): void
    {
        $sid = 'AC' . $this->faker->lexify(str_repeat('?', 32));
        $token = $this->faker->lexify(str_repeat('?', 32));
        $from = '+' . $this->faker->numerify('############');

        $config = new ConfigurationMock([
            'notifier.drivers.sms.twilio.sid' => $sid,
            'notifier.drivers.sms.twilio.token' => $token,
            'notifier.drivers.sms.twilio.from' => $from,
        ]);

        $dto = TwilioConfigDto::fromConfig($config);

        $this->assertSame($sid, $dto->sid);
        $this->assertSame($token, $dto->token);
        $this->assertSame($from, $dto->from);
    }
}
