Posted by greggles on May 13, 2009 at 2:08am
I need to test cookie integration with a 3rd party site.
The 3rd party site sets a cookie, Drupal sees this cookie, validates it, and logs in the user. I planned to test this by setting a cookie in my simpletest
I tried a couple of variations on:
<?php
$this->drupalGet('node', NULL, array('Cookie: cookiename=cookievalue;'));
?>but the "cookiename=cookievalue" bits always got jammed onto the end of the SESS... cookie.
I grepped through core and didn't find any situations where we are sending a cookie along with the drupalGet. Any advice?

Comments
Couldn't browse to a menu
Couldn't you browse to a menu callback thats sets the cookie and then to /node (in your example).
could do
I certainly could do that, I thought of a few other potential solutions to the problem based around adding test specific code to my regular application but rejected them on principle. Do we have other situations where code for testing exists outside of the .test files? Is there a style guideline for that?
--
Growing Venture Solutions | Drupal Dashboard | Learn more about Drupal - buy a Drupal Book
knaddison blog | Morris Animal Foundation
We have lots of testing
We have lots of testing modules under simpletest/tests. These are hidden from the admin/build/modules page with a .info param. Does that qualify as "ode for testing exists outside of the .test files".
This may not be possible
This may not be possible with the current simpletest infrastructure. Even cURL itself seems to lack the ability to set or otherwise interact with cookies. I've started http://drupal.org/node/457804, please let us know if you discover anything.
Use mock_web?
I think I could easily add cookie settings to mock_web. See recent posting here. Would this work for you?
seems decent
The mock_web idea seems solid. I definitely think it would be worth adding to the core simpletest features.
--
Growing Venture Solutions | Drupal Dashboard | Learn more about Drupal - buy a Drupal Book
knaddison blog | Morris Animal Foundation
cookie
It's still not possible?
Related:
http://drupal.org/node/457804
http://drupal.org/node/1319736