-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from kbond/fixes
Fixes
- Loading branch information
Showing
7 changed files
with
42 additions
and
85 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 |
---|---|---|
|
@@ -28,7 +28,6 @@ | |
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | ||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; | ||
use Symfony\Component\Security\Core\User\InMemoryUser; | ||
use Zenstruck\Foundry\ZenstruckFoundryBundle; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
|
@@ -173,7 +172,6 @@ public function registerBundles(): iterable | |
{ | ||
yield new FrameworkBundle(); | ||
yield new SecurityBundle(); | ||
yield new ZenstruckFoundryBundle(); | ||
} | ||
|
||
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void | ||
|
@@ -209,9 +207,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load | |
} | ||
|
||
$c->loadFromExtension('security', $security); | ||
$c->loadFromExtension('zenstruck_foundry', [ | ||
'auto_refresh_proxies' => false, | ||
]); | ||
$c->register('logger', NullLogger::class); // disable logging | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -17,16 +17,13 @@ | |
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | ||
use Symfony\Component\Security\Core\User\InMemoryUser; | ||
use Zenstruck\Browser\Test\HasBrowser; | ||
use Zenstruck\Foundry\Test\Factories; | ||
|
||
use function Zenstruck\Foundry\anonymous; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class KernelBrowserAuthenticationTest extends KernelTestCase | ||
{ | ||
use Factories, HasBrowser; | ||
use HasBrowser; | ||
|
||
/** | ||
* @test | ||
|
@@ -41,54 +38,20 @@ public function can_act_as_user(): void | |
; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function can_act_as_user_with_foundry_factory(): void | ||
{ | ||
$user = anonymous(InMemoryUser::class, ['username' => 'kevin', 'password' => 'pass']); | ||
|
||
$this->browser() | ||
->throwExceptions() | ||
->actingAs($user) | ||
->visit('/user') | ||
->assertSee('user: kevin/pass') | ||
; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function can_act_as_user_with_foundry_proxy(): void | ||
{ | ||
$user = anonymous(InMemoryUser::class)->create(['username' => 'kevin', 'password' => 'pass']); | ||
|
||
$this->browser() | ||
->throwExceptions() | ||
->actingAs($user) | ||
->visit('/user') | ||
->assertSee('user: kevin/pass') | ||
; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function can_make_authentication_assertions(): void | ||
{ | ||
$username = 'kevin'; | ||
$user = new InMemoryUser('kevin', 'pass'); | ||
$factory = anonymous(InMemoryUser::class, ['username' => 'kevin', 'password' => 'pass']); | ||
$proxy = anonymous(InMemoryUser::class)->create(['username' => 'kevin', 'password' => 'pass']); | ||
|
||
$this->browser() | ||
->assertNotAuthenticated() | ||
->actingAs($user) | ||
->assertAuthenticated() | ||
->assertAuthenticated($username) | ||
->assertAuthenticated($user) | ||
->assertAuthenticated($factory) | ||
->assertAuthenticated($proxy) | ||
->visit('/user') | ||
->assertAuthenticated() | ||
->assertAuthenticated($username) | ||
|
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