mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 11:32:40 +00:00
parent
55f63bbd5b
commit
6fda055a1e
2 changed files with 6 additions and 14 deletions
|
@ -172,16 +172,9 @@ class CookieComponent extends Component {
|
|||
if (isset($this->time)) {
|
||||
$this->_expire($this->time);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize CookieComponent
|
||||
*
|
||||
* @param Controller $controller
|
||||
* @return void
|
||||
*/
|
||||
public function initialize($controller) {
|
||||
if (is_object($controller) && isset($controller->response)) {
|
||||
$controller = $collection->getController();
|
||||
if ($controller && isset($controller->response)) {
|
||||
$this->_response = $controller->response;
|
||||
} else {
|
||||
$this->_response = new CakeResponse(array('charset' => Configure::read('App.encoding')));
|
||||
|
|
|
@ -72,10 +72,9 @@ class CookieComponentTest extends CakeTestCase {
|
|||
*/
|
||||
public function setUp() {
|
||||
$_COOKIE = array();
|
||||
$Collection = new ComponentCollection();
|
||||
$this->Cookie = new CookieComponent($Collection);
|
||||
$this->Controller = new CookieComponentTestController(new CakeRequest(), new CakeResponse());
|
||||
$this->Cookie->initialize($this->Controller);
|
||||
$this->Controller->constructClasses();
|
||||
$this->Cookie = $this->Controller->Cookie;
|
||||
|
||||
$this->Cookie->name = 'CakeTestCookie';
|
||||
$this->Cookie->time = 10;
|
||||
|
@ -199,7 +198,7 @@ class CookieComponentTest extends CakeTestCase {
|
|||
'domain' => '',
|
||||
'secure' => false,
|
||||
'httpOnly' => true);
|
||||
$result = $this->Controller->response->cookie($this->Cookie->name.'[Testing]');
|
||||
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
|
@ -220,7 +219,7 @@ class CookieComponentTest extends CakeTestCase {
|
|||
'domain' => '',
|
||||
'secure' => false,
|
||||
'httpOnly' => true);
|
||||
$result = $this->Controller->response->cookie($this->Cookie->name.'[Testing]');
|
||||
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue