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()); }
/** * Get the currently authenticated user or null. * * @static */ public static function user() { return \Mpociot\Teamwork\Teamwork::user(); }