Ejemplo n.º 1
0
 public function testGetUser()
 {
     // Current user
     $user = m::mock('User');
     $entrust = new Entrust($this->mockAppWithCurrentUser($user));
     // Check the returned user
     $this->assertEquals($entrust->user(), $user);
 }
Ejemplo n.º 2
0
 /**
  * Get the currently authenticated user or null.
  *
  * @return \Zizaco\Entrust\User|null 
  * @static 
  */
 public static function user()
 {
     return \Zizaco\Entrust\Entrust::user();
 }
Ejemplo n.º 3
0
 public function testUser()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $app = new stdClass();
     $app->auth = m::mock('Auth');
     $entrust = new Entrust($app);
     $user = m::mock('_mockedUser');
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $app->auth->shouldReceive('user')->andReturn($user)->once();
     /*
     |------------------------------------------------------------
     | Assertion
     |------------------------------------------------------------
     */
     $this->assertSame($user, $entrust->user());
 }