-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7787bc8
commit 5e6767b
Showing
9 changed files
with
66 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
use Dayspring\LoginBundle\Model\UserQuery; | ||
use Dayspring\LoginBundle\Tests\WebTestCase; | ||
use Symfony\Bundle\FrameworkBundle\Client; | ||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||
use function var_dump; | ||
|
||
class ForgotResetControllerTest extends WebTestCase | ||
{ | ||
|
@@ -59,15 +61,15 @@ public function testForgotPassword() | |
|
||
public function testForgotPasswordDeactiveUser() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$user = new User(); | ||
$user | ||
->setEmail("[email protected]") | ||
->setPassword("password") | ||
->setIsActive(false); | ||
|
||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
$user | ||
->setPassword($encoded) | ||
->save(); | ||
|
@@ -192,13 +194,13 @@ public function testChangePasswordNotLoggedIn() | |
|
||
public function testChangePassword() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$securityRole = new SecurityRole(); | ||
$securityRole->setRoleName('ROLE'); | ||
|
||
$user = new User(); | ||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
|
||
$user | ||
->addSecurityRole($securityRole) | ||
|
@@ -240,13 +242,13 @@ public function testChangePassword() | |
|
||
public function testChangePasswordNoMatch() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$securityRole = new SecurityRole(); | ||
$securityRole->setRoleName('ROLE'); | ||
|
||
$user = new User(); | ||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
|
||
$user | ||
->addSecurityRole($securityRole) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
use Symfony\Bundle\FrameworkBundle\Client; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||
|
||
class UserAccountControllerTest extends WebTestCase | ||
{ | ||
|
@@ -23,7 +24,7 @@ protected function setUp(): void | |
parent::setUp(); | ||
|
||
$application = new Application(static::$kernel); | ||
$application->add(new FixturesLoadCommand(static::$kernel->getContainer())); | ||
$application->add(new FixturesLoadCommand(static::getContainer())); | ||
|
||
$command = $application->find('propel:fixtures:load'); | ||
$commandTester = new CommandTester($command); | ||
|
@@ -39,11 +40,11 @@ protected function setUp(): void | |
|
||
protected function createUserAndLogin() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$user = new User(); | ||
$user->setEmail(sprintf("test+%[email protected]", microtime())); | ||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
$user->setPassword($encoded); | ||
$user->addSecurityRole(SecurityRoleQuery::create()->filterByRoleName("ROLE_User")->findOneOrCreate()); | ||
$user->save(); | ||
|
@@ -70,15 +71,15 @@ protected function loginAdminUser() | |
|
||
public function testInactiveUser() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$user = new User(); | ||
$user | ||
->setEmail("[email protected]") | ||
->setPassword("password") | ||
->setIsActive(false); | ||
|
||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
$user | ||
->setPassword($encoded) | ||
->save(); | ||
|
@@ -99,11 +100,11 @@ public function testInactiveUser() | |
|
||
public function testLastLoginDate() | ||
{ | ||
$encoder = static::$kernel->getContainer()->get('security.password_encoder'); | ||
$encoder = static::getContainer()->get(UserPasswordHasherInterface::class); | ||
|
||
$user = new User(); | ||
$user->setEmail(sprintf("test+%[email protected]", microtime())); | ||
$encoded = $encoder->encodePassword($user, 'password'); | ||
$encoded = $encoder->hashPassword($user, 'password'); | ||
$user->setPassword($encoded); | ||
$user->addSecurityRole(SecurityRoleQuery::create()->filterByRoleName("ROLE_User")->findOneOrCreate()); | ||
$user->save(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException; | ||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; | ||
use Symfony\Component\Security\Core\Exception\UserNotFoundException; | ||
use Symfony\Component\Security\Core\User\UserInterface; | ||
|
||
class DayspringUserProviderTest extends WebTestCase | ||
|
@@ -70,7 +70,7 @@ public function testSupportsClass() | |
|
||
public function testLoadUserByUsernameFailure() | ||
{ | ||
$this->expectException(UsernameNotFoundException::class); | ||
$this->expectException(UserNotFoundException::class); | ||
$this->userProvider->loadUserByIdentifier('[email protected]'); | ||
} | ||
|
||
|
@@ -104,7 +104,7 @@ public function getSalt() | |
{ | ||
} | ||
|
||
public function getUserIdentifier() | ||
public function getUserIdentifier(): string | ||
{ | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters