Skip to content

Commit aa7c2d6

Browse files
authored
Fix cookie domain match (#5)
* stub webdriver cookies as objects over arrays * check for cookie domain with isset, not array_key_exists calling array_key_exists on classes implementing \ArrayAccess always returns false and emits a deprecation notice on 7.4
1 parent a41fae6 commit aa7c2d6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3156,7 +3156,7 @@ public function deleteSessionSnapshot($name)
31563156
*/
31573157
private function cookieDomainMatchesConfigUrl($cookie)
31583158
{
3159-
if (!array_key_exists('domain', $cookie)) {
3159+
if (!isset($cookie['domain'])) {
31603160
return true;
31613161
}
31623162

tests/web/WebDriverTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,17 +677,17 @@ public function testSaveSessionSnapshotsExcludeInvalidCookieDomains()
677677
$fakeWdOptions = Stub::make('\Facebook\WebDriver\WebDriverOptions', [
678678
'getCookies' => Stub::atLeastOnce(function () {
679679
return [
680-
[
680+
Cookie::createFromArray([
681681
'name' => 'PHPSESSID',
682682
'value' => '123456',
683683
'path' => '/',
684-
],
685-
[
684+
]),
685+
Cookie::createFromArray([
686686
'name' => '3rdParty',
687687
'value' => '_value_',
688688
'path' => '/',
689689
'domain' => '.3rd-party.net',
690-
],
690+
])
691691
];
692692
}),
693693
]);

0 commit comments

Comments
 (0)