mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Add tests that expose the empty cookie jar after close bug
This commit is contained in:
@@ -3020,6 +3020,18 @@ class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertFalse(is_resource($curl->curl));
|
||||
}
|
||||
|
||||
public function testCookieJarAfterClose()
|
||||
{
|
||||
$cookie_jar = tempnam('/tmp', 'php-curl-class.');
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->setCookieJar($cookie_jar);
|
||||
$curl->get(Test::TEST_URL);
|
||||
$curl->close();
|
||||
$cookies = file_get_contents($cookie_jar);
|
||||
$this->assertNotEmpty($cookies);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \PHPUnit\Framework\Error\Warning
|
||||
*/
|
||||
|
||||
@@ -2982,6 +2982,19 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertFalse(is_resource($multi_curl->multiCurl));
|
||||
}
|
||||
|
||||
public function testCookieJarAfterClose()
|
||||
{
|
||||
$cookie_jar = tempnam('/tmp', 'php-curl-class.');
|
||||
|
||||
$multi_curl = new MultiCurl();
|
||||
$multi_curl->setCookieJar($cookie_jar);
|
||||
$multi_curl->addGet(Test::TEST_URL);
|
||||
$multi_curl->start();
|
||||
$multi_curl->close();
|
||||
$cookies = file_get_contents($cookie_jar);
|
||||
$this->assertNotEmpty($cookies);
|
||||
}
|
||||
|
||||
public function testMultiPostRedirectGet()
|
||||
{
|
||||
// Deny post-redirect-get
|
||||
|
||||
Reference in New Issue
Block a user