-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItkDevOpenIdConnectBundleTest.php
More file actions
76 lines (63 loc) · 2.92 KB
/
Copy pathItkDevOpenIdConnectBundleTest.php
File metadata and controls
76 lines (63 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace ItkDev\OpenIdConnectBundle\Tests;
use ItkDev\OpenIdConnectBundle\Command\UserLoginCommand;
use ItkDev\OpenIdConnectBundle\Controller\LoginController;
use ItkDev\OpenIdConnectBundle\DependencyInjection\ItkDevOpenIdConnectExtension;
use ItkDev\OpenIdConnectBundle\ItkDevOpenIdConnectBundle;
use ItkDev\OpenIdConnectBundle\Security\CliLoginTokenAuthenticator;
use ItkDev\OpenIdConnectBundle\Security\OpenIdConfigurationProviderManager;
use ItkDev\OpenIdConnectBundle\Security\OpenIdLoginAuthenticator;
use ItkDev\OpenIdConnectBundle\Util\CliLoginHelper;
use PHPUnit\Framework\TestCase;
/**
* Class ItkDevOpenIdConnectBundleTest.
*/
class ItkDevOpenIdConnectBundleTest extends TestCase
{
/**
* Test service wiring.
*/
public function testServiceWiring(): void
{
$kernel = new ItkDevOpenIdConnectBundleTestingKernel([
__DIR__.'/config/framework.yml',
__DIR__.'/config/security.yml',
__DIR__.'/config/itkdev_openid_connect.yml',
]);
$kernel->boot();
$container = $kernel->getContainer();
// OpenIdConfigurationProviderManager
$this->assertTrue($container->has(OpenIdConfigurationProviderManager::class));
$manager = $container->get(OpenIdConfigurationProviderManager::class);
$this->assertInstanceOf(OpenIdConfigurationProviderManager::class, $manager);
// LoginController service
$this->assertTrue($container->has(LoginController::class));
$controller = $container->get(LoginController::class);
$this->assertInstanceOf(LoginController::class, $controller);
// Abstract OpenIdLoginAuthenticator service
$this->assertTrue($container->has(OpenIdLoginAuthenticator::class));
// CliLoginHelper
$this->assertTrue($container->has(CliLoginHelper::class));
$helper = $container->get(CliLoginHelper::class);
$this->assertInstanceOf(CliLoginHelper::class, $helper);
// UserLoginCommand
$this->assertTrue($container->has(UserLoginCommand::class));
$command = $container->get(UserLoginCommand::class);
$this->assertInstanceOf(UserLoginCommand::class, $command);
// CliLoginTokenAuthenticator
$this->assertTrue($container->has(CliLoginTokenAuthenticator::class));
$authenticator = $container->get(CliLoginTokenAuthenticator::class);
$this->assertInstanceOf(CliLoginTokenAuthenticator::class, $authenticator);
}
/**
* Test that the custom container extension is created and memoized.
*/
public function testGetContainerExtension(): void
{
$bundle = new ItkDevOpenIdConnectBundle();
$extension = $bundle->getContainerExtension();
$this->assertInstanceOf(ItkDevOpenIdConnectExtension::class, $extension);
// Repeated calls must return the same instance, not recreate it.
$this->assertSame($extension, $bundle->getContainerExtension());
}
}