Skip to content

Commit 9fd66aa

Browse files
Merge branch '5.2' into 5.x
* 5.2: [Notifier] Use abstract test cases in 5.2 Rename parameter of @method configureContainer [DependencyInjection] Support PHP 8 builtin types in CheckTypeDeclarationsPass [DependencyInjection] Fix InvalidParameterTypeException for function parameters [Notifier] Cleanup changelog (5.2) [Notifier] Cleanup changelog (5.1) [VarDumper] fix mutating $GLOBALS while cloning it
2 parents 01eeab9 + 1958ac7 commit 9fd66aa

File tree

1 file changed

+20
-34
lines changed

1 file changed

+20
-34
lines changed

Tests/LinkedInTransportFactoryTest.php

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,41 @@
22

33
namespace Symfony\Component\Notifier\Bridge\LinkedIn\Tests;
44

5-
use PHPUnit\Framework\TestCase;
65
use Symfony\Component\Notifier\Bridge\LinkedIn\LinkedInTransportFactory;
7-
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
8-
use Symfony\Component\Notifier\Exception\UnsupportedSchemeException;
9-
use Symfony\Component\Notifier\Transport\Dsn;
6+
use Symfony\Component\Notifier\Tests\TransportFactoryTestCase;
7+
use Symfony\Component\Notifier\Transport\TransportFactoryInterface;
108

11-
final class LinkedInTransportFactoryTest extends TestCase
9+
final class LinkedInTransportFactoryTest extends TransportFactoryTestCase
1210
{
13-
public function testCreateWithDsn()
11+
/**
12+
* @return LinkedInTransportFactory
13+
*/
14+
public function createFactory(): TransportFactoryInterface
1415
{
15-
$factory = $this->createFactory();
16-
17-
$transport = $factory->create(Dsn::fromString('linkedin://accessToken:UserId@host.test'));
18-
19-
$this->assertSame('linkedin://host.test', (string) $transport);
20-
}
21-
22-
public function testCreateWithOnlyAccessTokenOrUserIdThrowsIncompleteDsnException()
23-
{
24-
$factory = $this->createFactory();
25-
26-
$this->expectException(IncompleteDsnException::class);
27-
$factory->create(Dsn::fromString('linkedin://AccessTokenOrUserId@default'));
16+
return new LinkedInTransportFactory();
2817
}
2918

30-
public function testSupportsReturnsTrueWithSupportedScheme()
19+
public function createProvider(): iterable
3120
{
32-
$factory = $this->createFactory();
33-
34-
$this->assertTrue($factory->supports(Dsn::fromString('linkedin://host/path')));
21+
yield [
22+
'linkedin://host.test',
23+
'linkedin://accessToken:UserId@host.test',
24+
];
3525
}
3626

37-
public function testSupportsReturnsFalseWithUnsupportedScheme()
27+
public function supportsProvider(): iterable
3828
{
39-
$factory = $this->createFactory();
40-
41-
$this->assertFalse($factory->supports(Dsn::fromString('somethingElse://host/path')));
29+
yield [true, 'linkedin://host'];
30+
yield [false, 'somethingElse://host'];
4231
}
4332

44-
public function testUnsupportedSchemeThrowsUnsupportedSchemeException()
33+
public function incompleteDsnProvider(): iterable
4534
{
46-
$factory = $this->createFactory();
47-
48-
$this->expectException(UnsupportedSchemeException::class);
49-
$factory->create(Dsn::fromString('somethingElse://accessToken:UserId@default'));
35+
yield 'missing account or user_id' => ['linkedin://AccessTokenOrUserId@default'];
5036
}
5137

52-
private function createFactory(): LinkedInTransportFactory
38+
public function unsupportedSchemeProvider(): iterable
5339
{
54-
return new LinkedInTransportFactory();
40+
yield ['somethingElse://accessToken:UserId@default'];
5541
}
5642
}

0 commit comments

Comments
 (0)