2016-03-13 23:54:49 +05:30
|
|
|
<?php
|
2019-02-21 01:28:52 +05:30
|
|
|
namespace api\tests\functional;
|
2016-03-13 23:54:49 +05:30
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
use api\tests\_pages\SignupRoute;
|
|
|
|
use api\tests\FunctionalTester;
|
2016-03-13 23:54:49 +05:30
|
|
|
|
|
|
|
class RepeatAccountActivationCest {
|
|
|
|
|
|
|
|
public function testInvalidEmailOrAccountState(FunctionalTester $I) {
|
|
|
|
$route = new SignupRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('error.email_required on empty for submitting');
|
|
|
|
$route->sendRepeatMessage();
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'email' => 'error.email_required',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$I->wantTo('error.email_not_found if email is not presented in db');
|
|
|
|
$route->sendRepeatMessage('im-not@exists.net');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'email' => 'error.email_not_found',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$I->wantTo('error.account_already_activated if passed email matches with already activated account');
|
|
|
|
$route->sendRepeatMessage('admin@ely.by');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'email' => 'error.account_already_activated',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$I->wantTo('error.recently_sent_message if last message was send too recently');
|
|
|
|
$route->sendRepeatMessage('achristiansen@gmail.com');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
|
|
|
'email' => 'error.recently_sent_message',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSuccess(FunctionalTester $I) {
|
|
|
|
$route = new SignupRoute($I);
|
|
|
|
|
|
|
|
$I->wantTo('successfully resend account activation message');
|
|
|
|
$route->sendRepeatMessage('jon@ely.by');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson(['success' => true]);
|
|
|
|
$I->cantSeeResponseJsonMatchesJsonPath('$.errors');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|