File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function getKernel(): KernelInterface
56
56
*/
57
57
public function getProfile (): HttpProfile |false |null
58
58
{
59
- if (null === $ this ->response || !$ this ->getContainer ()->has ('profiler ' )) {
59
+ if (! isset ( $ this ->response ) || !$ this ->getContainer ()->has ('profiler ' )) {
60
60
return false ;
61
61
}
62
62
Original file line number Diff line number Diff line change 14
14
use Symfony \Bundle \FrameworkBundle \KernelBrowser ;
15
15
use Symfony \Bundle \FrameworkBundle \Tests \Functional \AbstractWebTestCase ;
16
16
use Symfony \Component \HttpFoundation \Response ;
17
+ use Symfony \Component \HttpKernel \KernelInterface ;
17
18
18
19
class KernelBrowserTest extends AbstractWebTestCase
19
20
{
@@ -61,6 +62,13 @@ public function testRequestAfterKernelShutdownAndPerformedRequest()
61
62
$ client ->request ('GET ' , '/ ' );
62
63
}
63
64
65
+ public function testGetProfileWithoutRequest ()
66
+ {
67
+ $ browser = new KernelBrowser ($ this ->createMock (KernelInterface::class));
68
+
69
+ $ this ->assertFalse ($ browser ->getProfile ());
70
+ }
71
+
64
72
private function getKernelMock ()
65
73
{
66
74
$ mock = $ this ->getMockBuilder ($ this ->getKernelClass ())
Original file line number Diff line number Diff line change @@ -531,7 +531,7 @@ public function reload(): Crawler
531
531
*/
532
532
public function followRedirect (): Crawler
533
533
{
534
- if (!$ this ->redirect ) {
534
+ if (!isset ( $ this ->redirect ) ) {
535
535
throw new LogicException ('The request was not redirected. ' );
536
536
}
537
537
Original file line number Diff line number Diff line change 15
15
use Symfony \Component \BrowserKit \CookieJar ;
16
16
use Symfony \Component \BrowserKit \Exception \BadMethodCallException ;
17
17
use Symfony \Component \BrowserKit \Exception \InvalidArgumentException ;
18
+ use Symfony \Component \BrowserKit \Exception \LogicException ;
18
19
use Symfony \Component \BrowserKit \History ;
19
20
use Symfony \Component \BrowserKit \Request ;
20
21
use Symfony \Component \BrowserKit \Response ;
@@ -889,4 +890,14 @@ public function testInternalRequestNull()
889
890
890
891
$ client ->getInternalRequest ();
891
892
}
893
+
894
+ public function testFollowRedirectWithoutRequest ()
895
+ {
896
+ $ browser = $ this ->getBrowser ();
897
+
898
+ $ this ->expectException (LogicException::class);
899
+ $ this ->expectExceptionMessage ('The request was not redirected. ' );
900
+
901
+ $ browser ->followRedirect ();
902
+ }
892
903
}
You can’t perform that action at this time.
0 commit comments