當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。