title: Unit testing cookies in PHP
body: <p>The default practice for unit testing functionality that relies on session/cookie information is to use an abstraction library. But what if I want to write and unit test this abstraction library? The documentation for the PHP <a href="http://php.net/setcookie" rel="noreferrer"><code>setcookie</code>function</a> says that the cookie will be available on the next request. Using a command line tool for testing, there is no such thing as a "request". So how can I unit test the correct cookie settings? </p>
  
  <p>I want to test if all the parameters of the <code>setcookie</code> function are set correctly by my abstraction library. Those parameters will be set according to certain conditions and method calls.</p>
  
  <p>The only solution I can think of is to mock the <code>setcookie</code> function with the <code>runkit</code> extension, which I don't want to install. Other ideas?</p>