Add tests that expose the empty cookie jar after close bug

This commit is contained in:
Zach Borboa
2021-03-13 18:18:15 -05:00
parent b27d86cd13
commit 75adc83a5c
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -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