user() public method

Get the currently authenticated user or null.
public user ( )
Example #1
0
 public function testUser()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $app = new stdClass();
     $app->auth = m::mock('Auth');
     $teamwork = new Teamwork($app);
     $user = m::mock('_mockedUser');
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $app->auth->shouldReceive('user')->andReturn($user)->once();
     /*
     |------------------------------------------------------------
     | Assertion
     |------------------------------------------------------------
     */
     $this->assertSame($user, $teamwork->user());
 }
Example #2
0
 /**
  * Get the currently authenticated user or null.
  *
  * @static 
  */
 public static function user()
 {
     return \Mpociot\Teamwork\Teamwork::user();
 }