Skip to content

Commit 4c0ef17

Browse files
kapcusNaktibalda
authored andcommitted
[InnerBrowser] fix compatibility with symfony/browserkit 4.3
* maxRedirects parameter can be read from public getter * followRedirects read from public method, Symfony 2.7 support kept * client class name removed as not necessary
1 parent 3e9e7cb commit 4c0ef17

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,21 @@ protected function clientRequest($method, $uri, array $parameters = [], array $f
190190
}
191191
}
192192

193-
if (!ReflectionHelper::readPrivateProperty($this->client, 'followRedirects')) {
193+
if (method_exists($this->client, 'isFollowingRedirects')) {
194+
$isFollowingRedirects = $this->client->isFollowingRedirects();
195+
$maxRedirects = $this->client->getMaxRedirects();
196+
} else {
197+
//Symfony 2.7 support
198+
$isFollowingRedirects = ReflectionHelper::readPrivateProperty($this->client, 'followRedirects');
199+
$maxRedirects = ReflectionHelper::readPrivateProperty($this->client, 'maxRedirects');
200+
}
201+
202+
if (!$isFollowingRedirects) {
194203
$result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory);
195204
$this->debugResponse($uri);
196205
return $result;
197206
}
198207

199-
$maxRedirects = ReflectionHelper::readPrivateProperty($this->client, 'maxRedirects', 'Symfony\Component\BrowserKit\Client');
200208
$this->client->followRedirects(false);
201209
$result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory);
202210
$this->debugResponse($uri);

0 commit comments

Comments
 (0)