2016-01-21 02:44:29 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api;
|
|
|
|
|
2016-03-13 04:49:00 +05:30
|
|
|
use tests\codeception\api\_pages\SignupRoute;
|
2016-01-21 02:44:29 +05:30
|
|
|
|
|
|
|
class EmailConfirmationCest {
|
|
|
|
|
|
|
|
public function testLoginEmailOrUsername(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' => [
|
|
|
|
'key' => 'error.key_is_required',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$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 04:49:00 +05:30
|
|
|
$route = new SignupRoute($I);
|
2016-01-21 02:44:29 +05:30
|
|
|
|
|
|
|
$I->wantTo('confirm my email using correct activation key');
|
|
|
|
$route->confirm('HABGCABHJ1234HBHVD');
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
$I->cantSeeResponseJsonMatchesJsonPath('$.errors');
|
2016-02-27 04:07:55 +05:30
|
|
|
$I->canSeeResponseJsonMatchesJsonPath('$.jwt');
|
2016-01-21 02:44:29 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|