This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class User{ | |
| public function addNewMobile($mobile): UserMobile | |
| { | |
| $userMobile = new UserMobile(['mobile' => $mobile, 'status' => self::STATUS_VERIFIED]); | |
| if(app()->events->until( | |
| event(new MobileVerifying($userMobile)) !== false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class EventServiceProvider extends ServiceProvider | |
| { | |
| protected $listen = [ | |
| 'App\Events\MobileVerifying' => [ | |
| 'App\Listeners\MobileVerifyingListener', | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class User{ | |
| public function addNewMobile($mobile): UserMobile | |
| { | |
| event(new MobileVerifying($mobile)); | |
| $userMobile = $this->mobiles()->create(['mobile' => $mobile, 'status' => self::STATUS_VERIFIED]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class EventServiceProvider extends ServiceProvider | |
| { | |
| protected $listen = [ | |
| 'App\Events\MobileVerifying' => [ | |
| 'App\Listeners\DeleteNotVerifiedUsers', | |
| 'App\Listeners\DeleteOutdatedActivationCodes', | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MultipleMobileTest extends TestCase | |
| { | |
| public function test_user_can_add_new_mobile() | |
| { | |
| Event::fake([MobileVerifying::class,MobileVerified::class]); | |
| $user = $this->newVerifiedUser(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class DeleteNotVerifiedUsersTest extends TestCase | |
| { | |
| public function test_can_delete_unverified_user_with_specific_mobile_number() | |
| { | |
| $unverifiedUser = $this->newUnVerifiedUser(["mobile" => "970567940999"]); | |
| $userMobile = factory(UserMobile::class)->create(["mobile" => "970567940999"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class response { | |
| public $response = []; | |
| function __construct(){ | |
| $this->addNormalResponse(); | |
| return $this->response; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function test_users_can_get_their_categories_list() | |
| { | |
| factory(Category::class, 5)->create(); | |
| $user = factory(User::class)->create(); | |
| Passport::actingAs($user); | |
| $response = $this->get('api/categories'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function test_users_can_get_their_categories_list() | |
| { | |
| factory(Category::class, 5)->create(); | |
| $user = factory(User::class)->create(); | |
| Passport::actingAs($user); | |
| $response = $this->get('api/categories'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function test_users_can_get_their_categories_list() | |
| { | |
| // ... | |
| $response = $this->get('api/categories') | |
| ->assertSuccessful() | |
| ->dump() | |
| ->assertJsonCount(5) |