Skip to content

Commit 19935c0

Browse files
author
Robert Pustułka
committed
Revert cookie collection setter.
1 parent c0f5030 commit 19935c0

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

src/Http/Client.php

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
use Cake\Core\App;
1717
use Cake\Core\Exception\Exception;
1818
use Cake\Core\InstanceConfigTrait;
19-
use Cake\Http\Client\CookieCollection as ClientCookieCollection;
19+
use Cake\Http\Client\CookieCollection;
2020
use Cake\Http\Client\Request;
21-
use Cake\Http\Cookie\CookieCollection;
2221
use Cake\Utility\Hash;
2322

2423
/**
@@ -169,44 +168,20 @@ public function __construct($config = [])
169168
$this->_cookies = $this->_config['cookieJar'];
170169
$this->setConfig('cookieJar', null);
171170
} else {
172-
$this->_cookies = new ClientCookieCollection();
171+
$this->_cookies = new CookieCollection();
173172
}
174173
}
175174

176175
/**
177176
* Get the cookies stored in the Client.
178177
*
179-
* @return \Cake\Http\Cookie\CookieCollection
180-
* @deprecated 3.5.0 Use getCookies() instead.
178+
* @return \Cake\Http\Client\CookieCollection
181179
*/
182180
public function cookies()
183181
{
184182
return $this->_cookies;
185183
}
186184

187-
/**
188-
* Get the cookies stored in the Client.
189-
*
190-
* @return \Cake\Http\Cookie\CookieCollection
191-
*/
192-
public function getCookies()
193-
{
194-
return $this->_cookies;
195-
}
196-
197-
/**
198-
* Sets the cookie collection.
199-
*
200-
* @param \Cake\Http\Cookie\CookieCollection $cookies Cookie collection to be set.
201-
* @return $this
202-
*/
203-
public function setCookies(CookieCollection $cookies)
204-
{
205-
$this->_cookies = $cookies;
206-
207-
return $this;
208-
}
209-
210185
/**
211186
* Do a GET request.
212187
*

tests/TestCase/Http/ClientTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,22 +622,18 @@ public function testCookieStorage()
622622
}
623623

624624
/**
625-
* Test cookie collection getter and setter,
625+
* Test cookieJar config option.
626626
*
627627
* @return void
628628
*/
629-
public function testCookies()
629+
public function testCookieJar()
630630
{
631631
$jar = new CookieCollection();
632632
$http = new Client([
633633
'cookieJar' => $jar
634634
]);
635635

636-
$this->assertSame($jar, $http->getCookies());
637-
638-
$cookies = new CookieCollection();
639-
$http->setCookies($cookies);
640-
$this->assertSame($cookies, $http->getCookies());
636+
$this->assertSame($jar, $http->cookies());
641637
}
642638

643639
/**

0 commit comments

Comments
 (0)