Skip to content

Commit 64f2bd0

Browse files
Merge pull request #7 from JakobTolkemit/update_sylius_version
Fix user provider
2 parents 4a197bc + 835bea0 commit 64f2bd0

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

spec/User/SymfonyToSyliusUserProviderProxySpec.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
use Brille24\SyliusLdapPlugin\User\SymfonyToSyliusUserProviderProxy;
77
use Brille24\SyliusLdapPlugin\User\UserSynchronizerInterface;
88
use DateTime;
9-
use PhpParser\Node\Arg;
109
use Prophecy\Argument;
1110
use Sylius\Bundle\UserBundle\Provider\AbstractUserProvider;
1211
use Sylius\Component\Core\Model\AdminUserInterface;
1312
use Sylius\Component\Resource\Factory\FactoryInterface;
1413
use Sylius\Component\User\Model\UserInterface as SyliusUserInterface;
1514
use Sylius\Bundle\UserBundle\Provider\UserProviderInterface as SyliusUserProviderInterface;
16-
use Sylius\Component\Core\Model\AdminUser;
1715
use Sylius\Component\User\Model\UserInterface;
18-
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
1916
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
2017
use Symfony\Component\Security\Core\User\UserProviderInterface;
2118
use PhpSpec\ObjectBehavior;
@@ -46,7 +43,7 @@ function it_loads_the_ldap_user_and_creates_a_sylius_user(
4643
AdminUserInterface $adminUser,
4744
UserInterface $ldapUser
4845
) {
49-
$adminUserProvider->loadUserByIdentifier('test')->willThrow(UserNotFoundException::class);
46+
$adminUserProvider->loadUserByUsername('test')->willThrow(UserNotFoundException::class);
5047

5148
$innerUserProvider->loadUserByIdentifier('test')->willReturn($ldapUser);
5249
$adminUserFactory->createNew()->shouldBeCalled()->willReturn($adminUser);
@@ -89,7 +86,7 @@ function it_updates_the_sylius_user_with_data_from_ldap(
8986
UserInterface $ldapUser,
9087
UserSynchronizerInterface $userSynchronizer
9188
) {
92-
$adminUserProvider->loadUserByIdentifier('test')->willReturn($syliusUser);
89+
$adminUserProvider->loadUserByUsername('test')->willReturn($syliusUser);
9390
$innerUserProvider->loadUserByIdentifier('test')->willReturn($ldapUser);
9491
$adminUserFactory->createNew()->shouldBeCalled()->willReturn($adminUser);
9592

src/User/SymfonyToSyliusUserProviderProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function loadUserByIdentifier(string $identifier): SymfonyUserInterface
4646

4747
try {
4848
/** @var SyliusUserInterface&SymfonyUserInterface $syliusUser */
49-
$syliusUser = $this->adminUserProvider->loadUserByIdentifier($identifier);
49+
$syliusUser = $this->adminUserProvider->loadUserByUsername($identifier);
5050
} catch (UserNotFoundException) {
5151
return $syliusLdapUser;
5252
}

0 commit comments

Comments
 (0)