8000 * tests · symfony/symfony@a0fae7d · GitHub
[go: up one dir, main page]

Skip to content

Commit a0fae7d

Browse files
Vasilij DuskoVasilij Dusko | CREATION
Vasilij Dusko
authored and
Vasilij Dusko | CREATION
committed
* tests
1 parent 15686c0 commit a0fae7d

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\LightSms\Tests;
13+
14+
use Symfony\Component\Notifier\Bridge\LightSms\LightSmsTransportFactory;
15+
use Symfony\Component\Notifier\Test\TransportFactoryTestCase;
16+
use Symfony\Component\Notifier\Transport\TransportFactoryInterface;
17+
18+
final class LightSmsTransportFactoryTest extends TransportFactoryTestCase
19+
{
20+
/**
21+
* @return LightSmsTransportFactory
22+
*/
23+
public function createFactory(): TransportFactoryInterface
24+
{
25+
return new LightSmsTransportFactory();
26+
}
27+
28+
public function createProvider(): iterable
29+
{
30+
yield [
31+
'lightsms://host.test?phone=0611223344',
32+
'lightsms://accountSid:authToken@host.test?phone=0611223344',
33+
];
34+
}
35+
36+
public function supportsProvider(): iterable
37+
{
38+
yield [true, 'lightsms://login:token@default?phone=37061234567'];
39+
yield [false, 'somethingElse://login:token@default?phone=37061234567'];
40+
}
41+
42+
public function unsupportedSchemeProvider(): iterable
43+
{
44+
yield ['somethingElse://accountSid:authToken@default?from=37061234567'];
45+
yield ['somethingElse://accountSid:authToken@default']; // missing "phone" option
46+
}
47+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\LightSms\Tests;
13+
14+
use Symfony\Component\Notifier\Bridge\LightSms\LightSmsTransport;
15+
use Symfony\Component\Notifier\Message\ChatMessage;
16+
use Symfony\Component\Notifier\Message\MessageInterface;
17+
use Symfony\Component\Notifier\Message\SmsMessage;
18+
use Symfony\Component\Notifier\Test\TransportTestCase;
19+
use Symfony\Component\Notifier\Transport\TransportInterface;
20+
use Symfony\Contracts\HttpClient\HttpClientInterface;
21+
22+
final class LightSmsTransportTest extends TransportTestCase
23+
{
24+
/**
25+
* @return LightSmsTransport
26+
*/
27+
public function createTransport(?HttpClientInterface $client = null): TransportInterface
28+
{
29+
return new LightSmsTransport('accountSid', 'authToken', 'from', $client ?: $this->createMock(HttpClientInterface::class));
30+
}
31+
32+
public function toStringProvider(): iterable
33+
{
34+
yield ['lightsms://www.lightsms.com/external/get/send.php?phone=from', $this->createTransport()];
35+
}
36+
37+
public function supportedMessagesProvider(): iterable
38+
{
39+
yield [new SmsMessage('0611223344', 'Hello!')];
40+
}
41+
42+
public function unsupportedMessagesProvider(): iterable
43+
{
44+
yield [new ChatMessage('Hello!')];
45+
yield [$this->createMock(MessageInterface::class)];
46+
}
47+
}

0 commit comments

Comments
 (0)
0