mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Fixed almost everything, but all functional tests are broken at the last minute :(
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace api\tests\unit\modules\accounts\models;
|
||||
|
||||
use api\components\User\Component;
|
||||
use api\components\User\IdentityFactory;
|
||||
use api\modules\accounts\models\ChangePasswordForm;
|
||||
use api\tests\unit\TestCase;
|
||||
use common\components\UserPass;
|
||||
@@ -56,14 +57,7 @@ class ChangePasswordFormTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testPerformAction() {
|
||||
$component = mock(Component::class . '[terminateSessions]', [[
|
||||
'identityClass' => IdentityFactory::class,
|
||||
'enableSession' => false,
|
||||
'loginUrl' => null,
|
||||
'secret' => 'secret',
|
||||
'publicKeyPath' => 'data/certs/public.crt',
|
||||
'privateKeyPath' => 'data/certs/private.key',
|
||||
]]);
|
||||
$component = mock(Component::class . '[terminateSessions]');
|
||||
$component->shouldNotReceive('terminateSessions');
|
||||
|
||||
Yii::$app->set('user', $component);
|
||||
@@ -118,14 +112,7 @@ class ChangePasswordFormTest extends TestCase {
|
||||
$account->setPassword('password_0');
|
||||
|
||||
/** @var Component|\Mockery\MockInterface $component */
|
||||
$component = mock(Component::class . '[terminateSessions]', [[
|
||||
'identityClass' => IdentityFactory::class,
|
||||
'enableSession' => false,
|
||||
'loginUrl' => null,
|
||||
'secret' => 'secret',
|
||||
'publicKeyPath' => 'data/certs/public.crt',
|
||||
'privateKeyPath' => 'data/certs/private.key',
|
||||
]]);
|
||||
$component = mock(Component::class . '[terminateSessions]');
|
||||
$component->shouldReceive('terminateSessions')->once()->withArgs([$account, Component::KEEP_CURRENT_SESSION]);
|
||||
|
||||
Yii::$app->set('user', $component);
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace api\tests\unit\modules\accounts\models;
|
||||
|
||||
use api\components\User\Component;
|
||||
use api\components\User\IdentityFactory;
|
||||
use api\modules\accounts\models\EnableTwoFactorAuthForm;
|
||||
use api\tests\unit\TestCase;
|
||||
use common\helpers\Error as E;
|
||||
@@ -19,14 +20,7 @@ class EnableTwoFactorAuthFormTest extends TestCase {
|
||||
$account->otp_secret = 'mock secret';
|
||||
|
||||
/** @var Component|\Mockery\MockInterface $component */
|
||||
$component = mock(Component::class . '[terminateSessions]', [[
|
||||
'identityClass' => IdentityFactory::class,
|
||||
'enableSession' => false,
|
||||
'loginUrl' => null,
|
||||
'secret' => 'secret',
|
||||
'publicKeyPath' => 'data/certs/public.crt',
|
||||
'privateKeyPath' => 'data/certs/private.key',
|
||||
]]);
|
||||
$component = mock(Component::class . '[terminateSessions]');
|
||||
$component->shouldReceive('terminateSessions')->withArgs([$account, Component::KEEP_CURRENT_SESSION]);
|
||||
|
||||
Yii::$app->set('user', $component);
|
||||
|
Reference in New Issue
Block a user