Skip to content

Instantly share code, notes, and snippets.

@devmsh
Last active December 19, 2018 22:16
Show Gist options
  • Select an option

  • Save devmsh/88b307c66a5ba01d4d1d858a5024635b to your computer and use it in GitHub Desktop.

Select an option

Save devmsh/88b307c66a5ba01d4d1d858a5024635b to your computer and use it in GitHub Desktop.
MultipleMobileTest.php
<?php
class MultipleMobileTest extends TestCase
{
public function test_user_can_add_new_mobile()
{
Event::fake([MobileVerifying::class,MobileVerified::class]);
$user = $this->newVerifiedUser();
$response = $this->postJson('api/user/mobiles', [
'mobile' => '970567940999',
]);
$response->assertSuccessful();
$this->assertCount(2, $user->fresh()->mobiles);
\Event::assertDispatched(MobileVerifying::class,function($event){
$this->assertInstanceOf(UserMobile::class, $event->mobile);
return true;
});
\Event::assertDispatched(MobileVerified::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment