mirror of
https://github.com/elyby/accounts.git
synced 2024-10-30 07:23:12 +05:30
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
|
<?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');
|
||
|
}
|
||
|
|
||
|
}
|