-
-
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.
[feature] add Symfony 6 support (#64)
- Loading branch information
Showing
5 changed files
with
80 additions
and
57 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 |
---|---|---|
|
@@ -2,10 +2,9 @@ | |
|
||
namespace Zenstruck\Browser\Tests; | ||
|
||
use Symfony\Bundle\FrameworkBundle\KernelBrowser as SymfonyKernelBrowser; | ||
use Symfony\Component\Security\Core\User\InMemoryUser; | ||
use Symfony\Component\Security\Core\User\User; | ||
use Zenstruck\Browser\KernelBrowser; | ||
use Zenstruck\Browser\Tests\Fixture\Kernel; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
|
@@ -32,15 +31,13 @@ public function can_use_kernel_browser_as_typehint(): void | |
*/ | ||
public function can_act_as_user(): void | ||
{ | ||
if (!\method_exists(SymfonyKernelBrowser::class, 'loginUser')) { | ||
$this->markTestSkipped(SymfonyKernelBrowser::class.'::loginUser() is only available in Symfony 5.1+.'); | ||
if (!Kernel::securityEnabled()) { | ||
$this->markTestSkipped('Only enable security-related tests in 5.3+'); | ||
} | ||
|
||
$userClass = \class_exists(InMemoryUser::class) ? InMemoryUser::class : User::class; | ||
|
||
$this->browser() | ||
->throwExceptions() | ||
->actingAs(new $userClass('kevin', 'pass')) | ||
->actingAs(new InMemoryUser('kevin', 'pass')) | ||
->visit('/user') | ||
->assertSee('user: kevin/pass') | ||
; | ||
|