Skip to content

Commit

Permalink
Remove setSession()
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hoffmann committed Apr 14, 2017
1 parent 7946bb7 commit d52b77b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
19 changes: 1 addition & 18 deletions src/Http/ServerRequest.php
Expand Up @@ -514,23 +514,6 @@ public function contentType()
return $this->env('HTTP_CONTENT_TYPE');
}

/**
* Update the request with a new session instance.
*
* Returns an updated request object. This method returns
* a *new* request object and does not mutate the request in-place.
*
* @param \Cake\Network\Session $session the session object to use
* @return static
*/
public function withSession(Session $session)
{
$new = clone $this;
$new->session = $session;

return $new;
}

/**
* Returns the instance of the Session object for this request
*
Expand All @@ -547,7 +530,7 @@ public function getSession()
* If a session object is passed as first argument it will be set as
* the session to use for this request
*
* @deprecated 3.5.0 Use getSession()/withSession() instead.
* @deprecated 3.5.0 Use getSession() instead. The setter part will be removed.
* @param \Cake\Network\Session|null $session the session object to use
* @return \Cake\Network\Session
*/
Expand Down
14 changes: 0 additions & 14 deletions tests/TestCase/Http/ServerRequestTest.php
Expand Up @@ -3193,20 +3193,6 @@ public function testGetSession()
$this->assertEquals($session, $request->getSession());
}

/**
* Tests setting the session to the request
*
* @return void
*/
public function testWithtSession()
{
$session = new Session;
$request = new ServerRequest();
$newRequest = $request->withSession($session);
$this->assertNotSame($newRequest, $request);
$this->assertSame($session, $newRequest->getSession());
}

/**
* Test the content type method.
*
Expand Down

0 comments on commit d52b77b

Please sign in to comment.