本文整理汇总了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"]);
}