CakeDC\Users\Test\TestCase\View\Helper\UserHelperTest::testWelcome PHP Method

testWelcome() public method

Test link
public testWelcome ( ) : void
return void
    public function testWelcome()
    {
        $session = $this->getMockBuilder('Cake\\Network\\Session')->setMethods(['read'])->getMock();
        $session->expects($this->at(0))->method('read')->with('Auth.User.id')->will($this->returnValue(2));
        $session->expects($this->at(1))->method('read')->with('Auth.User.first_name')->will($this->returnValue('david'));
        $this->User->request = $this->getMockBuilder('Cake\\Network\\Request')->setMethods(['session'])->getMock();
        $this->User->request->expects($this->any())->method('session')->will($this->returnValue($session));
        $expected = '<span class="welcome">Welcome, <a href="/profile">david</a></span>';
        $result = $this->User->welcome();
        $this->assertEquals($expected, $result);
    }