当前位置: 首页>>代码示例>>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;未经允许,请勿转载。