/** * @dataProvider getMatchingCookiesDataProvider */ public function testReturnsCookiesMatchingRequests($url, $cookies) { $bag = [new SetCookie(['Name' => 'foo', 'Value' => 'bar', 'Domain' => 'example.com', 'Path' => '/', 'Max-Age' => '86400', 'Secure' => true]), new SetCookie(['Name' => 'baz', 'Value' => 'foobar', 'Domain' => 'example.com', 'Path' => '/', 'Max-Age' => '86400', 'Secure' => true]), new SetCookie(['Name' => 'test', 'Value' => '123', 'Domain' => 'www.foobar.com', 'Path' => '/path/', 'Discard' => true]), new SetCookie(['Name' => 'muppet', 'Value' => 'cookie_monster', 'Domain' => '.y.example.com', 'Path' => '/acme/', 'Expires' => time() + 86400]), new SetCookie(['Name' => 'googoo', 'Value' => 'gaga', 'Domain' => '.example.com', 'Path' => '/test/acme/', 'Max-Age' => 1500])]; foreach ($bag as $cookie) { $this->jar->setCookie($cookie); } $request = new Request('GET', $url); $this->jar->addCookieHeader($request); $this->assertEquals($cookies, $request->getHeader('Cookie')); }