当前位置: 首页>>代码示例>>PHP>>正文


PHP Sentry::setUser方法代码示例

本文整理汇总了PHP中Sentry::setUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentry::setUser方法的具体用法?PHP Sentry::setUser怎么用?PHP Sentry::setUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sentry的用法示例。


在下文中一共展示了Sentry::setUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beAdmin

 /**
  * Impersonate an admin
  *
  */
 public function beAdmin()
 {
     $admin = Sentry::findUserByLogin('admin@admin.com');
     Sentry::setUser($admin);
     Session::put('userId', 1);
     Session::put('email', 'admin@admin.com');
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:11,代码来源:TestCase.php

示例2: setUp

 public function setUp()
 {
     Illuminate\Foundation\Testing\TestCase::setUp();
     Artisan::call('migrate', array('--package' => 'cartalyst\\sentry'));
     // 		Artisan::call('migrate');
     Artisan::call('migrate', array('--package' => 'rtconner\\laravel-addresses'));
     Artisan::call('db:seed', array('--class' => 'Conner\\Addresses\\DatabaseSeeder'));
     $user = new \Cartalyst\Sentry\Users\Eloquent\User();
     $user->id = 1;
     \Sentry::setUser($user);
 }
开发者ID:declum,项目名称:laravel-addresses,代码行数:11,代码来源:AddressesTest.php

示例3: testBasicUserTypes

 /**
  * Test the two basic user types
  *
  */
 public function testBasicUserTypes()
 {
     $this->assertTrue(Sentry::getUser() == NULL, 'User should not be logged in initially.');
     $admin = Sentry::findUserByLogin($this->adminEmail);
     $this->assertTrue($admin != NULL, 'Admin account not found.');
     $user = Sentry::findUserByLogin($this->userEmail);
     $this->assertTrue($user != NULL, 'User account not found.');
     Sentry::setUser($user);
     $this->assertTrue(Sentry::check(), 'User not logged in.');
     Sentry::setUser($admin);
     $this->assertTrue(Sentry::check(), 'Admin not logged in.');
     Sentry::logout();
 }
开发者ID:marmaray,项目名称:L4withSentry,代码行数:17,代码来源:UserControllerTest.php

示例4: testUpdatingUserWithAdditionalData

 /**
  * Update a user without referencing the username
  */
 public function testUpdatingUserWithAdditionalData()
 {
     // Explicitly set the 'additional user fields'
     app()['config']->set('sentinel.additional_user_fields', ['first_name' => 'alpha_spaces', 'last_name' => 'alpha_spaces']);
     // Find the user we are going to update
     $user = Sentry::findUserByLogin('user@user.com');
     // Find the admin user we are going to impersonate
     $admin = Sentry::findUserByLogin('admin@admin.com');
     Sentry::setUser($admin);
     // This is the code we are testing
     $result = $this->repo->update(['id' => $user->id, 'first_name' => 'Irina', 'last_name' => 'Prozorova', 'email' => 'irina@prozorov.net']);
     // Assertions
     $this->assertInstanceOf('Sentinel\\Models\\User', $user);
     $this->assertInstanceOf('Sentinel\\Models\\User', $result->getPayload()['user']);
     $this->assertTrue($result->isSuccessful());
     $testUser = DB::table('users')->where('id', $user->id)->where('first_name', 'Irina')->where('last_name', 'Prozorova')->where('email', 'irina@prozorov.net')->first();
     $this->assertEquals('irina@prozorov.net', $testUser->email);
 }
开发者ID:acmadi,项目名称:integrasi,代码行数:21,代码来源:SentryUserRepositoryTests.php

示例5: beAdmin

 /**
  * Impersonate an admin
  *
  */
 public function beAdmin()
 {
     $admin = Sentry::findUserByLogin($this->adminEmail);
     Sentry::setUser($admin);
     Session::put('userId', 1);
     Session::put('email', $this->adminEmail);
 }
开发者ID:marmaray,项目名称:L4withSentry,代码行数:11,代码来源:TestCase.php

示例6: beAdmin

 /**
  * Impersonate an admin
  *
  */
 public function beAdmin()
 {
     $admin = Sentry::findUserByLogin($this->adminEmail);
     Sentry::setUser($admin);
 }
开发者ID:Adamiko,项目名称:lama,代码行数:9,代码来源:TestCase.php


注:本文中的Sentry::setUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。