Skip to content

Commit

Permalink
Revert cookie collection setter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pustułka committed May 30, 2017
1 parent c0f5030 commit 19935c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
31 changes: 3 additions & 28 deletions src/Http/Client.php
Expand Up @@ -16,9 +16,8 @@
use Cake\Core\App;
use Cake\Core\Exception\Exception;
use Cake\Core\InstanceConfigTrait;
use Cake\Http\Client\CookieCollection as ClientCookieCollection;
use Cake\Http\Client\CookieCollection;
use Cake\Http\Client\Request;
use Cake\Http\Cookie\CookieCollection;
use Cake\Utility\Hash;

/**
Expand Down Expand Up @@ -169,44 +168,20 @@ public function __construct($config = [])
$this->_cookies = $this->_config['cookieJar'];
$this->setConfig('cookieJar', null);
} else {
$this->_cookies = new ClientCookieCollection();
$this->_cookies = new CookieCollection();
}
}

/**
* Get the cookies stored in the Client.
*
* @return \Cake\Http\Cookie\CookieCollection
* @deprecated 3.5.0 Use getCookies() instead.
* @return \Cake\Http\Client\CookieCollection
*/
public function cookies()
{
return $this->_cookies;
}

/**
* Get the cookies stored in the Client.
*
* @return \Cake\Http\Cookie\CookieCollection
*/
public function getCookies()
{
return $this->_cookies;
}

/**
* Sets the cookie collection.
*
* @param \Cake\Http\Cookie\CookieCollection $cookies Cookie collection to be set.
* @return $this
*/
public function setCookies(CookieCollection $cookies)
{
$this->_cookies = $cookies;

return $this;
}

/**
* Do a GET request.
*
Expand Down
10 changes: 3 additions & 7 deletions tests/TestCase/Http/ClientTest.php
Expand Up @@ -622,22 +622,18 @@ public function testCookieStorage()
}

/**
* Test cookie collection getter and setter,
* Test cookieJar config option.
*
* @return void
*/
public function testCookies()
public function testCookieJar()
{
$jar = new CookieCollection();
$http = new Client([
'cookieJar' => $jar
]);

$this->assertSame($jar, $http->getCookies());

$cookies = new CookieCollection();
$http->setCookies($cookies);
$this->assertSame($cookies, $http->getCookies());
$this->assertSame($jar, $http->cookies());
}

/**
Expand Down

0 comments on commit 19935c0

Please sign in to comment.