CakeDC\Users\Test\TestCase\Controller\Traits\BaseTraitTest::_mockAuthLoggedIn PHP Method

_mockAuthLoggedIn() protected method

Mock Auth and retur user id 1
protected _mockAuthLoggedIn ( $user = [] ) : void
return void
    protected function _mockAuthLoggedIn($user = [])
    {
        $this->Trait->Auth = $this->getMockBuilder('Cake\\Controller\\Component\\AuthComponent')->setMethods(['user', 'identify', 'setUser', 'redirectUrl'])->disableOriginalConstructor()->getMock();
        $user += ['id' => '00000000-0000-0000-0000-000000000001', 'password' => '12345'];
        $this->Trait->Auth->expects($this->any())->method('identify')->will($this->returnValue($user));
        $this->Trait->Auth->expects($this->any())->method('user')->with('id')->will($this->returnValue($user['id']));
    }