2016-01-21 02:44:29 +05:30
|
|
|
<?php
|
2019-02-21 01:28:52 +05:30
|
|
|
namespace api\tests\functional;
|
2016-01-21 02:44:29 +05:30
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
use api\tests\_pages\SignupRoute;
|
|
|
|
use api\tests\FunctionalTester;
|
2016-01-21 02:44:29 +05:30
|
|
|
|
|
|
|
class EmailConfirmationCest {
|
|
|
|
|
2018-01-12 16:20:19 +05:30
|
|
|
public function testConfirmEmailByCorrectKey(FunctionalTester $I) {
|
|
|
|
$route = new SignupRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('confirm my email using correct activation key');
|
|
|
|
$route->confirm('HABGCABHJ1234HBHVD');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
$I->cantSeeResponseJsonMatchesJsonPath('$.errors');
|
|
|
|
$I->canSeeAuthCredentials(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConfirmEmailByInvalidKey(FunctionalTester $I) {
|
2016-03-13 04:49:00 +05:30
|
|
|
$route = new SignupRoute($I);
|
2016-01-21 02:44:29 +05:30
|
|
|
|
|
|
|
$I->wantTo('see error.key_is_required expected if key is not set');
|
|
|
|
$route->confirm();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
2016-06-17 01:06:52 +05:30
|
|
|
'key' => 'error.key_required',
|
2016-01-21 02:44:29 +05:30
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$I->wantTo('see error.key_not_exists expected if key not exists in database');
|
|
|
|
$route->confirm('not-exists-key');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'key' => 'error.key_not_exists',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2018-01-12 16:20:19 +05:30
|
|
|
public function testConfirmByInvalidEmojiString(FunctionalTester $I) {
|
2016-03-13 04:49:00 +05:30
|
|
|
$route = new SignupRoute($I);
|
2016-01-21 02:44:29 +05:30
|
|
|
|
2018-01-12 16:20:19 +05:30
|
|
|
$I->wantTo('try to submit some long emoji string (Sentry ACCOUNTS-43Y)');
|
|
|
|
$route->confirm(
|
|
|
|
'ALWAYS 🕔 make sure 👍 to shave 🔪🍑 because ✌️ the last time 🕒 we let 👐😪 a bush 🌳 ' .
|
|
|
|
'in our lives 👈😜👉 it did 9/11 💥🏢🏢✈️🔥🔥🔥 ALWAYS 🕔 make sure 👍 to shave 🔪🍑 ' .
|
|
|
|
'because ✌️ the last time 🕒 we let 👐😪 a bush 🌳 in our lives 👈😜👉 it did 9/11 ' .
|
|
|
|
'💥🏢🏢✈️🔥🔥🔥/'
|
|
|
|
);
|
2016-01-21 02:44:29 +05:30
|
|
|
$I->canSeeResponseContainsJson([
|
2018-01-12 16:20:19 +05:30
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'key' => 'error.key_not_exists',
|
|
|
|
],
|
2016-01-21 02:44:29 +05:30
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|