@@ -718,4 +718,57 @@ public function testGetCurrentUserByIdAndSession()
718718
719719 ParseUser::logOut ();
720720 }
721+
722+ /**
723+ * @group verification-email
724+ */
725+ public function testRequestVerificationEmail ()
726+ {
727+ $ email = 'example@example.com ' ;
728+ $ user = new ParseUser ();
729+ $ user ->setUsername ('verification_email_user ' );
730+ $ user ->setPassword ('password ' );
731+ $ user ->setEmail ($ email );
732+ $ user ->signUp ();
733+ ParseUser::requestVerificationEmail ($ email );
734+ }
735+
736+ /**
737+ * @group verification-email
738+ */
739+ public function testEmailAlreadyVerified ()
740+ {
741+ $ email = 'example2@example.com ' ;
742+ $ this ->setExpectedException ('Parse\ParseException ' , "Email {$ email } is already verified. " );
743+
744+ $ user = new ParseUser ();
745+ $ user ->setUsername ('another_verification_email_user ' );
746+ $ user ->setPassword ('password ' );
747+ $ user ->setEmail ($ email );
748+ $ user ->signUp ();
749+
750+ // forcibly update emailVerification status
751+ $ user ->set ('emailVerified ' , true );
752+ $ user ->save (true );
753+
754+ ParseUser::requestVerificationEmail ($ email );
755+ }
756+
757+ /**
758+ * @group verification-email
759+ */
760+ public function testRequestVerificationEmailEmpty ()
761+ {
762+ $ this ->setExpectedException ('Parse\ParseException ' , 'you must provide an email ' );
763+ ParseUser::requestVerificationEmail ('' );
764+ }
765+
766+ /**
767+ * @group verification-email
768+ */
769+ public function testRequestVerificationEmailBad ()
770+ {
771+ $ this ->setExpectedException ('Parse\ParseException ' , 'No user found with email not_a_known_email ' );
772+ ParseUser::requestVerificationEmail ('not_a_known_email ' );
773+ }
721774}
0 commit comments