title: Authentication set is not working in cakephp 3.x unit test case
body: <p>Here I am writing the test cases for changes password in cakephp 3.x, for that I have set the session for authentication check in test cases, but it is not working.</p>
  
  <p>My code is </p>
  
  <pre><code>public function setUserSession() {
      $auth = [
          'Auth' =&gt; [
              'user' =&gt; [
                  'id' =&gt; 2,
                  'email' =&gt; 'testemail1@test.ie',
                  'firstname' =&gt; 'testfastname',
                  'lastname' =&gt; 'testlastname',
                  'gender' =&gt; 'male',
                  'active' =&gt; 1,
                  'created' =&gt; '2016-02-19 11:54:47',
                  'modified' =&gt; '2016-02-19 11:54:47'
              ]
          ]
      ];
      return $auth;
  }
   /**
   * Test register method
   *
   * @return void
   */
  public function testpassword()
  {
  
  
     $data = [ 
          'current_password' =&gt; '123456',
          'new_password'=&gt;'12345678',
          'repeat_password'=&gt;'12345678',
      ];
     $this-&gt;session($this-&gt;setUserSession());
  
     $this-&gt;post('/Customers/password', $data);
  
     $this-&gt;assertResponseSuccess();
      //echo "Ser"; exit;
     // $users = TableRegistry::get('customers');
      //$query = $users-&gt;find()-&gt;where(['email' =&gt; $data['email']]);
      //$this-&gt;assertEquals(1, $query-&gt;count());
  
  }
  </code></pre>
  
  <p>And checking in customer controller like this but is not working.</p>
  
  <pre><code>   $id = $this-&gt;Auth-&gt;user('id');
  
      if (!$this-&gt;Customers-&gt;exists(['id' =&gt; $id])) {
          $this-&gt;Flash-&gt;error('You have been logged out');
          return $this-&gt;redirect(array('action' =&gt; 'login'));
      }
  </code></pre>