mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Код модели подтверждения через email теперь является первичным ключом тамблицы
Реализована форма подтверждения email, обмазана тестами Слегка отрефакторена форма регистрации и авторизации в пользу выноса части логики в общего родителя Проект зачищен от стандартных тестовых параметров Пофикшены методы доступа к API
This commit is contained in:
41
tests/codeception/api/functional/EmailConfirmationCest.php
Normal file
41
tests/codeception/api/functional/EmailConfirmationCest.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace tests\codeception\api;
|
||||
|
||||
use tests\codeception\api\_pages\EmailConfirmRoute;
|
||||
|
||||
class EmailConfirmationCest {
|
||||
|
||||
public function testLoginEmailOrUsername(FunctionalTester $I) {
|
||||
$route = new EmailConfirmRoute($I);
|
||||
|
||||
$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) {
|
||||
$route = new EmailConfirmRoute($I);
|
||||
|
||||
$I->wantTo('confirm my email using correct activation key');
|
||||
$route->confirm('HABGCABHJ1234HBHVD');
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => true,
|
||||
]);
|
||||
$I->cantSeeResponseJsonMatchesJsonPath('$.errors');
|
||||
}
|
||||
|
||||
}
|
@ -5,14 +5,6 @@ use tests\codeception\api\_pages\LoginRoute;
|
||||
|
||||
class LoginCest {
|
||||
|
||||
public function _before(FunctionalTester $I) {
|
||||
|
||||
}
|
||||
|
||||
public function _after(FunctionalTester $I) {
|
||||
|
||||
}
|
||||
|
||||
public function testLoginEmailOrUsername(FunctionalTester $I) {
|
||||
$route = new LoginRoute($I);
|
||||
|
||||
|
Reference in New Issue
Block a user