Browse Source

Remove setSession()

Michael Hoffmann 9 years ago
parent
commit
d52b77b782
2 changed files with 1 additions and 32 deletions
  1. 1 18
      src/Http/ServerRequest.php
  2. 0 14
      tests/TestCase/Http/ServerRequestTest.php

+ 1 - 18
src/Http/ServerRequest.php

@@ -515,23 +515,6 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
     }
 
     /**
-     * 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
      *
      * @return \Cake\Network\Session
@@ -547,7 +530,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
      * 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
      */

+ 0 - 14
tests/TestCase/Http/ServerRequestTest.php

@@ -3194,20 +3194,6 @@ XML;
     }
 
     /**
-     * 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.
      *
      * @return void