GoIpTransport example

if (self::SCHEME_NAME !== $dsn->getScheme()) {
            throw new UnsupportedSchemeException($dsn, self::SCHEME_NAME, $this->getSupportedSchemes());
        }

        $username = $this->getUser($dsn);
        $password = $this->getPassword($dsn);

        if (=== ($simSlot = (int) $dsn->getRequiredOption('sim_slot'))) {
            throw new InvalidArgumentException(sprintf('The provided SIM-Slot: "%s" is not valid.', $simSlot));
        }

        return (new GoIpTransport($username$password$simSlot$this->client, $this->dispatcher))
            ->setHost($dsn->getHost())
            ->setPort($dsn->getPort());
    }

    protected function getSupportedSchemes(): array
    {
        return [
            self::SCHEME_NAME,
        ];
    }
}

final class GoIpTransportTest extends TransportTestCase
{
    public static function toStringProvider(): iterable
    {
        yield ['goip://host.test:4000?sim_slot=4', self::createTransport()];
    }

    public static function createTransport(HttpClientInterface $client = null): GoIpTransport
    {
        return (new GoIpTransport('user', 'pass', 4, $client ?? new MockHttpClient()))
            ->setHost('host.test')
            ->setPort(4000);
    }

    public static function supportedMessagesProvider(): iterable
    {
        $message = new SmsMessage('0611223344', 'Hello!');
        $message->options((new GoIpOptions())->setSimSlot(3));

        yield [$message];
    }

    
Home | Imprint | This part of the site doesn't use cookies.