2016-01-21 00:14:29 +03:00
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api;
|
|
|
|
|
2016-03-13 02:19:00 +03:00
|
|
|
use tests\codeception\api\_pages\SignupRoute;
|
2016-01-21 00:14:29 +03:00
|
|
|
|
|
|
|
class EmailConfirmationCest {
|
|
|
|
|
|
|
|
public function testLoginEmailOrUsername(FunctionalTester $I) {
|
2016-03-13 02:19:00 +03:00
|
|
|
$route = new SignupRoute($I);
|
2016-01-21 00:14:29 +03:00
|
|
|
|
|
|
|
$I->wantTo('see error.key_is_required expected if key is not set');
|
|
|
|
$route->confirm();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => false,
|
|
|
|
'errors' => [
|
2016-06-16 22:36:52 +03:00
|
|
|
'key' => 'error.key_required',
|
2016-01-21 00:14:29 +03:00
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$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',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testLoginByEmailCorrect(FunctionalTester $I) {
|
2016-03-13 02:19:00 +03:00
|
|
|
$route = new SignupRoute($I);
|
2016-01-21 00:14:29 +03:00
|
|
|
|
|
|
|
$I->wantTo('confirm my email using correct activation key');
|
|
|
|
$route->confirm('HABGCABHJ1234HBHVD');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
$I->cantSeeResponseJsonMatchesJsonPath('$.errors');
|
2016-05-30 02:44:17 +03:00
|
|
|
$I->canSeeAuthCredentials(true);
|
2016-01-21 00:14:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|