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


PHP Auth::shouldReceive方法代码示例

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


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

示例1: testDestroy

 public function testDestroy()
 {
     Auth::shouldReceive('logout')->once()->withNoArgs();
     Redirect::shouldReceive('route')->once()->with('wardrobe.admin.login')->andReturn('cabinet');
     $response = $this->action('GET', self::$wardrobeControllers . 'LoginController@destroy');
     $this->assertSame('cabinet', $response->original);
 }
开发者ID:sekouzed,项目名称:cabinet,代码行数:7,代码来源:LoginControllerTest.php

示例2: testBeforeReturnsTrueIfTheyCanManagePages

 public function testBeforeReturnsTrueIfTheyCanManagePages()
 {
     Auth::shouldReceive('check')->once()->with('managePages', Request::instance())->andReturn(true);
     Auth::shouldReceive('check')->once()->with('managePages', Request::instance())->andReturn(false);
     $policy = new PagePolicy();
     $this->assertTrue($policy->before(new Person(), ''));
     $this->assertNull($policy->before(new Person(), ''));
 }
开发者ID:imanghafoori1,项目名称:boom-core,代码行数:8,代码来源:PagePolicyTest.php

示例3: testSentryGetUser

 public function testSentryGetUser()
 {
     $loader = AliasLoader::getInstance();
     $loader->alias('Sentry', '\\Illuminate\\Support\\Facades\\Auth');
     $user = new stdClass();
     $user->id = 545;
     \Illuminate\Support\Facades\Auth::shouldReceive('getUser')->once()->andReturn($user);
     $currentUserId = $this->app['understand.field-provider']->getUserId();
     $this->assertSame($user->id, $currentUserId);
 }
开发者ID:understand,项目名称:understand-laravel5,代码行数:10,代码来源:FieldProviderTest.php

示例4: testShouldLogoutAndRedirect

 public function testShouldLogoutAndRedirect()
 {
     $user = $this->getUserMock();
     $user->shouldReceive('isUserEmailVerified')->andReturn(false);
     $this->laravelContainer->shouldReceive('make')->with('config', [])->andReturn($config = $this->getConfigMock());
     $config->shouldReceive('get')->with('verification.verify', null)->andReturn(true);
     $this->laravelContainer->shouldReceive('make')->with('redirect', [])->andReturn($redirect = $this->getRedirectMock());
     $redirect->shouldReceive('to')->once()->andReturn('redirect');
     Auth::shouldReceive('guard')->once()->andReturn($guard = m::mock('Illuminate\\Contracts\\Auth\\Guard'));
     $guard->shouldReceive('logout')->once();
     $this->laravelContainer->shouldReceive('make')->with('url', [])->andReturn($url = $this->getUrlMock());
     $url->shouldReceive('route')->andReturn('redirect');
     $trait = $this->getObjectForTrait('Krucas\\LaravelUserEmailVerification\\AuthenticatesUsers');
     $this->assertEquals('redirect', $trait->authenticated($this->getRequestMock(), $user));
 }
开发者ID:edvinaskrucas,项目名称:laravel-user-email-verification,代码行数:15,代码来源:AuthenticatesUsersTest.php

示例5: testDiffSpecificVersions

 public function testDiffSpecificVersions()
 {
     Auth::shouldReceive('check')->andReturn(false);
     // Create 3 versions
     $user = new TestVersionableSoftDeleteUser();
     $user->name = "Marcel";
     $user->email = "m.pociot@test.php";
     $user->password = "12345";
     $user->last_login = $user->freshTimestamp();
     $user->save();
     sleep(1);
     $user->name = "John";
     $user->email = "john@snow.com";
     $user->save();
     sleep(1);
     $user->name = "Julia";
     $user->save();
     $diff = $user->currentVersion()->diff($user->versions()->orderBy("version_id", "ASC")->first());
     $this->assertTrue(is_array($diff));
     $this->assertCount(2, $diff);
     $this->assertEquals("Marcel", $diff["name"]);
     $this->assertEquals("m.pociot@test.php", $diff["email"]);
     $diff = $user->currentVersion()->diff($user->versions()->orderBy("version_id", "ASC")->offset(1)->first());
     $this->assertTrue(is_array($diff));
     $this->assertCount(1, $diff);
     $this->assertEquals("John", $diff["name"]);
 }
开发者ID:wpouseele,项目名称:versionable,代码行数:27,代码来源:VersionableTest.php


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