minkphp / minkphp/Mink

Add support for retrieving all cookies, not just one cookie by name

Open
#770 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.6k
Forks
286
PR merge metrics
No merged PRs in 30d

Description

The DriverInterface currently has method getCookie($name) {}, but it lacks getCookies(). This would be helpful in cases where the name of the cookie needed is not known.

I understand this would be a BC break, so I think it would have to be in version 2.0.0. I believe most drivers support such a method of cookie retrieval. Goutte/Chrome certainly do.

My use case:

I'm trying to write a behat test for a Drupal 8 site and in one of my step definitions, I need to make a separate request via Guzzle to the Drupal site using the same session that exists within the driver. Specifically, I'm writing a test that downloads a file from the site to verify that it could do that successfully. It doesn't seem possible to do that properly by using the driver directly, so I'm trying to use Guzzle to download the file. I need to copy the session cookies from the driver to the Guzzle request. The problem is that Drupal uses a special hash as the name of the cookie. I can reproduce the calculation to create the hash, but it makes my tests a bit brittle.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DriverInterface and compare the cookie APIs in the Goutte and Chrome drivers, which the issue identifies as supporting retrieval of all cookies. Trace the other driver implementations and their tests to determine the full interface impact; done means the supported drivers expose consistent all-cookie retrieval and the version or BC implications are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.