Skip to content

Commit

Permalink
Merge pull request #24 from nbgrp/1.1
Browse files Browse the repository at this point in the history
1.1 to 1.2
  • Loading branch information
a-menshchikov authored Feb 26, 2023
2 parents 620ab83 + 8c71f2e commit abab83a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Audit
strategy:
matrix:
php-version: [ '8.0', '8.1' ]
php-version: [ '8.0', '8.1', '8.2' ]
fail-fast: false
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
"symfony/event-dispatcher": "^6",
"symfony/phpunit-bridge": "^6"
},
"conflict": {
"symfony/http-kernel": ">=6.2",
"symfony/security-core": ">=6.2"
},
"autoload": {
"psr-4": {
"Nbgrp\\OneloginSamlBundle\\": "src/"
Expand Down
20 changes: 13 additions & 7 deletions tests/DependencyInjection/Security/Factory/SamlFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
use Nbgrp\OneloginSamlBundle\Security\Http\Authenticator\SamlAuthenticator;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

/**
* @covers \Nbgrp\OneloginSamlBundle\DependencyInjection\Security\Factory\SamlFactory
Expand Down Expand Up @@ -78,16 +80,20 @@ public function testCreateAuthenticator(): void

$authenticatorDefinition = $container->getDefinition('security.authenticator.saml.foo');

/** @var \Symfony\Component\DependencyInjection\Reference $userProviderReference */
/** @var Reference $userProviderReference */
$userProviderReference = $authenticatorDefinition->getArgument(1);
self::assertSame('user_provider', (string) $userProviderReference);

/** @var \Symfony\Component\DependencyInjection\Reference $successHandlerReference */
/** @var Reference $successHandlerReference */
$successHandlerReference = $authenticatorDefinition->getArgument(4);
$successHandlerDefinition = $container->getDefinition((string) $successHandlerReference);
/** @var \Symfony\Component\DependencyInjection\Reference $samlSuccessHandlerReference */
/** @var Reference|ChildDefinition|mixed $samlSuccessHandlerReference */
$samlSuccessHandlerReference = $successHandlerDefinition->getArgument(0);
self::assertSame(SamlAuthenticationSuccessHandler::class, (string) $samlSuccessHandlerReference);
if ($samlSuccessHandlerReference instanceof Reference) {
self::assertSame(SamlAuthenticationSuccessHandler::class, (string) $samlSuccessHandlerReference);
} elseif ($samlSuccessHandlerReference instanceof ChildDefinition) {
self::assertSame(SamlAuthenticationSuccessHandler::class, $samlSuccessHandlerReference->getParent());
}

/** @var array $options */
$options = $authenticatorDefinition->getArgument(6);
Expand All @@ -97,17 +103,17 @@ public function testCreateAuthenticator(): void
'success_handler' => SamlAuthenticationSuccessHandler::class,
], $options);

/** @var \Symfony\Component\DependencyInjection\Reference $userFactoryReference */
/** @var Reference $userFactoryReference */
$userFactoryReference = $authenticatorDefinition->getArgument(7);
self::assertSame('saml_user_factory', (string) $userFactoryReference);

/** @var \Symfony\Component\DependencyInjection\ChildDefinition $userCreatedListenerDefinition */
/** @var ChildDefinition $userCreatedListenerDefinition */
$userCreatedListenerDefinition = $container->getDefinition('nbgrp_onelogin_saml.user_created_listener.foo');
self::assertSame(UserCreatedListener::class, $userCreatedListenerDefinition->getParent());
self::assertTrue($userCreatedListenerDefinition->getArgument(1));
self::assertTrue($userCreatedListenerDefinition->hasTag('nbgrp.saml_user_listener'));

/** @var \Symfony\Component\DependencyInjection\ChildDefinition $userModifiedListenerDefinition */
/** @var ChildDefinition $userModifiedListenerDefinition */
$userModifiedListenerDefinition = $container->getDefinition('nbgrp_onelogin_saml.user_modified_listener.foo');
self::assertSame(UserModifiedListener::class, $userModifiedListenerDefinition->getParent());
self::assertTrue($userModifiedListenerDefinition->getArgument(1));
Expand Down

0 comments on commit abab83a

Please sign in to comment.