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 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 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 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\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 | |
| { | |
| $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 MultipleMobileTest extends TestCase | |
| { | |
| public function test_user_can_add_new_mobile() | |
| { | |
| $unverifiedUser = $this->newUnverifiedUser([ | |
| '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 User { | |
| public function addNewMobile($mobile): UserMobile | |
| { | |
| User::where('mobile', $mobile)->where('status',self::STATUS_NOT_VERIFIED)->delete(); | |
| $this->activationCodes()->where('mobile', $mobile)->delete(); |
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 CreateEventsTable extends Migration | |
| { | |
| public function up() | |
| { | |
| Schema::create('events', function (Blueprint $table) { | |
| // table columns | |
| $table->unsignedInteger('user_id'); |
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 | |
| abstract class TestCase extends BaseTestCase | |
| { | |
| const DATABASE_MIGRATIONS_USER = "database/migrations/user"; | |
| /** | |
| * @param $path | |
| */ | |
| public function migrate($path) |