當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Event::fake方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Event::fake方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::fake方法的具體用法?PHP Event::fake怎麽用?PHP Event::fake使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Event的用法示例。


在下文中一共展示了Event::fake方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPermanentlyDeleteUser

 public function testPermanentlyDeleteUser()
 {
     // Make sure our events are fired
     Event::fake();
     $this->actingAs($this->admin)->delete('/admin/access/user/' . $this->user->id)->notSeeInDatabase('users', ['id' => $this->user->id, 'deleted_at' => null])->visit('/admin/access/user/' . $this->user->id . '/delete')->seePageIs('/admin/access/user/deleted')->see('The user was deleted permanently.')->notSeeInDatabase('users', ['id' => $this->user->id]);
     Event::assertFired(UserPermanentlyDeleted::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:7,代碼來源:UserRouteTest.php

示例2: testLogoutRoute

 /**
  * Test the logout button redirects the user back to home and the login button is again visible
  */
 public function testLogoutRoute()
 {
     // Make sure our events are fired
     Event::fake();
     $this->actingAs($this->user)->visit('/logout')->see('Login')->see('Register');
     Event::assertFired(UserLoggedOut::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:10,代碼來源:LoggedInRouteTest.php

示例3: testDeleteRoleWithPermissions

 public function testDeleteRoleWithPermissions()
 {
     // Make sure our events are fired
     Event::fake();
     // Remove users from role first because it will error on that first
     DB::table('role_user')->where('role_id', 2)->delete();
     $this->actingAs($this->admin)->visit('/admin/access/role')->delete('/admin/access/role/2')->assertRedirectedTo('/admin/access/role')->notSeeInDatabase('roles', ['id' => 2])->notSeeInDatabase('permission_role', ['permission_id' => 1, 'role_id' => 2])->notSeeInDatabase('permission_role', ['permission_id' => 2, 'role_id' => 2])->seeInSession(['flash_success' => 'The role was successfully deleted.']);
     Event::assertFired(RoleDeleted::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:9,代碼來源:RoleFormTest.php

示例4: testConfirmAccountRoute

 /**
  * Create an unconfirmed user and assure the user gets
  * confirmed when hitting the confirmation route
  */
 public function testConfirmAccountRoute()
 {
     Event::fake();
     // Create default user to test with
     $unconfirmed = factory(User::class)->states('unconfirmed')->create();
     $unconfirmed->attachRole(3);
     //User
     $this->visit('/account/confirm/' . $unconfirmed->confirmation_code)->seePageIs('/login')->see('Your account has been successfully confirmed!')->seeInDatabase(config('access.users_table'), ['email' => $unconfirmed->email, 'confirmed' => 1]);
     Event::assertFired(UserConfirmed::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:14,代碼來源:LoggedOutRouteTest.php

示例5: testLoginForm

 /**
  * Test that the user is logged in and redirected to the dashboard
  * Test that the admin is logged in and redirected to the backend
  */
 public function testLoginForm()
 {
     // Make sure our events are fired
     Event::fake();
     Auth::logout();
     //User Test
     $this->visit('/login')->type($this->user->email, 'email')->type('1234', 'password')->press('Login')->seePageIs('/dashboard')->see($this->user->email);
     Auth::logout();
     //Admin Test
     $this->visit('/login')->type($this->admin->email, 'email')->type('1234', 'password')->press('Login')->seePageIs('/admin/dashboard')->see($this->admin->name)->see('Access Management');
     Event::assertFired(UserLoggedIn::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:16,代碼來源:LoggedOutFormTest.php

示例6: testChangeUserPasswordForm

 public function testChangeUserPasswordForm()
 {
     // Make sure our events are fired
     Event::fake();
     $password = '87654321';
     $this->actingAs($this->admin)->visit('/admin/access/user/' . $this->user->id . '/password/change')->see('Change Password for ' . $this->user->name)->type($password, 'password')->type($password, 'password_confirmation')->press('Update')->seePageIs('/admin/access/user')->see('The user\'s password was successfully updated.');
     Event::assertFired(UserPasswordChanged::class);
 }
開發者ID:rappasoft,項目名稱:laravel-5-boilerplate,代碼行數:8,代碼來源:UserFormTest.php


注:本文中的Illuminate\Support\Facades\Event::fake方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。