本文整理匯總了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);
}
示例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(), ''));
}
示例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);
}
示例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));
}
示例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"]);
}