zenstruck /
browser
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Zenstruck\Browser; |
||||
| 4 | |||||
| 5 | use Symfony\Bundle\FrameworkBundle\KernelBrowser as SymfonyKernelBrowser; |
||||
| 6 | use Symfony\Component\HttpKernel\Profiler\Profile; |
||||
| 7 | use Symfony\Component\Security\Core\User\UserInterface; |
||||
| 8 | |||||
| 9 | /** |
||||
| 10 | * @author Kevin Bond <[email protected]> |
||||
| 11 | * |
||||
| 12 | * @extends BrowserKitBrowser<SymfonyKernelBrowser> |
||||
| 13 | */ |
||||
| 14 | class KernelBrowser extends BrowserKitBrowser |
||||
| 15 | { |
||||
| 16 | final public function __construct(SymfonyKernelBrowser $inner) |
||||
| 17 | { |
||||
| 18 | parent::__construct($inner); |
||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * @see SymfonyKernelBrowser::disableReboot() |
||||
| 23 | * |
||||
| 24 | * @return static |
||||
| 25 | */ |
||||
| 26 | final public function disableReboot(): self |
||||
| 27 | { |
||||
| 28 | $this->inner()->disableReboot(); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 29 | |||||
| 30 | return $this; |
||||
| 31 | } |
||||
| 32 | |||||
| 33 | /** |
||||
| 34 | * @see SymfonyKernelBrowser::enableReboot() |
||||
| 35 | * |
||||
| 36 | * @return static |
||||
| 37 | */ |
||||
| 38 | final public function enableReboot(): self |
||||
| 39 | { |
||||
| 40 | $this->inner()->enableReboot(); |
||||
|
0 ignored issues
–
show
The method
enableReboot() does not exist on Symfony\Component\BrowserKit\AbstractBrowser. It seems like you code against a sub-type of Symfony\Component\BrowserKit\AbstractBrowser such as Symfony\Bundle\FrameworkBundle\KernelBrowser.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 41 | |||||
| 42 | return $this; |
||||
| 43 | } |
||||
| 44 | |||||
| 45 | /** |
||||
| 46 | * By default, exceptions made during a request are caught and converted |
||||
| 47 | * to responses by Symfony. This disables this behaviour and actually |
||||
| 48 | * throws the exception. |
||||
| 49 | * |
||||
| 50 | * @return static |
||||
| 51 | */ |
||||
| 52 | final public function throwExceptions(): self |
||||
| 53 | { |
||||
| 54 | $this->inner()->catchExceptions(false); |
||||
|
0 ignored issues
–
show
The method
catchExceptions() does not exist on Symfony\Component\BrowserKit\AbstractBrowser. It seems like you code against a sub-type of Symfony\Component\BrowserKit\AbstractBrowser such as Symfony\Component\HttpKernel\HttpKernelBrowser.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 55 | |||||
| 56 | return $this; |
||||
| 57 | } |
||||
| 58 | |||||
| 59 | /** |
||||
| 60 | * Re-enables catching exceptions. |
||||
| 61 | * |
||||
| 62 | * @return static |
||||
| 63 | */ |
||||
| 64 | final public function catchExceptions(): self |
||||
| 65 | { |
||||
| 66 | $this->inner()->catchExceptions(true); |
||||
| 67 | |||||
| 68 | return $this; |
||||
| 69 | } |
||||
| 70 | |||||
| 71 | /** |
||||
| 72 | * Enable profiling for the next request. Not required if profiling is |
||||
| 73 | * globally enabled. |
||||
| 74 | * |
||||
| 75 | * @return static |
||||
| 76 | */ |
||||
| 77 | final public function withProfiling(): self |
||||
| 78 | { |
||||
| 79 | $this->inner()->enableProfiler(); |
||||
|
0 ignored issues
–
show
The method
enableProfiler() does not exist on Symfony\Component\BrowserKit\AbstractBrowser. It seems like you code against a sub-type of Symfony\Component\BrowserKit\AbstractBrowser such as Symfony\Bundle\FrameworkBundle\KernelBrowser.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 80 | |||||
| 81 | return $this; |
||||
| 82 | } |
||||
| 83 | |||||
| 84 | public function actingAs(UserInterface $user, ?string $firewall = null): self |
||||
| 85 | { |
||||
| 86 | $this->inner()->loginUser(...\array_filter([$user, $firewall])); |
||||
|
0 ignored issues
–
show
The method
loginUser() does not exist on Symfony\Component\BrowserKit\AbstractBrowser. It seems like you code against a sub-type of Symfony\Component\BrowserKit\AbstractBrowser such as Symfony\Bundle\FrameworkBundle\KernelBrowser.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 87 | |||||
| 88 | return $this; |
||||
| 89 | } |
||||
| 90 | |||||
| 91 | final public function profile(): Profile |
||||
| 92 | { |
||||
| 93 | if (!$profile = $this->inner()->getProfile()) { |
||||
|
0 ignored issues
–
show
The method
getProfile() does not exist on Symfony\Component\BrowserKit\AbstractBrowser. It seems like you code against a sub-type of Symfony\Component\BrowserKit\AbstractBrowser such as Symfony\Bundle\FrameworkBundle\KernelBrowser.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 94 | throw new \RuntimeException('Profiler not enabled for this request. Try calling ->withProfiling() before the request.'); |
||||
| 95 | } |
||||
| 96 | |||||
| 97 | return $profile; |
||||
| 98 | } |
||||
| 99 | } |
||||
| 100 |