mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Восстановлен запуск тестов
Загрузчик конфигов выделен в отдельный класс authserverHost выделена в params Исправлены некоторые common.unit тесты, т.к. наследовались не от того базового класса
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\models\authentication;
|
||||
|
||||
use api\components\ReCaptcha\Validator;
|
||||
use api\models\authentication\RegistrationForm;
|
||||
use Codeception\Specify;
|
||||
use common\models\Account;
|
||||
@@ -25,6 +26,11 @@ class RegistrationFormTest extends DbTestCase {
|
||||
return 'testing_message.eml';
|
||||
};
|
||||
$this->mockRequest();
|
||||
Yii::$container->set(Validator::class, new class extends Validator {
|
||||
public function validateValue($value) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace tests\codeception\api\models\authentication;
|
||||
|
||||
use api\components\ReCaptcha\Validator;
|
||||
use api\models\authentication\RepeatAccountActivationForm;
|
||||
use Codeception\Specify;
|
||||
use common\models\EmailActivation;
|
||||
@@ -23,6 +24,11 @@ class RepeatAccountActivationFormTest extends DbTestCase {
|
||||
$mailer->fileTransportCallback = function () {
|
||||
return 'testing_message.eml';
|
||||
};
|
||||
Yii::$container->set(Validator::class, new class extends Validator {
|
||||
public function validateValue($value) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
||||
@@ -24,6 +24,9 @@ class RateLimiterTest extends TestCase {
|
||||
|
||||
/** @var RateLimiter|\PHPUnit_Framework_MockObject_MockObject $filter */
|
||||
$filter = $this->getMockBuilder(RateLimiter::class)
|
||||
->setConstructorArgs([[
|
||||
'authserverDomain' => Yii::$app->params['authserverHost']
|
||||
]])
|
||||
->setMethods(['getServer'])
|
||||
->getMock();
|
||||
|
||||
@@ -54,7 +57,9 @@ class RateLimiterTest extends TestCase {
|
||||
->method('getHostInfo')
|
||||
->will($this->returnValue('http://authserver.ely.by'));
|
||||
|
||||
$filter = new RateLimiter();
|
||||
$filter = new RateLimiter([
|
||||
'authserverDomain' => Yii::$app->params['authserverHost']
|
||||
]);
|
||||
$filter->checkRateLimit(null, $request, null, null);
|
||||
}
|
||||
|
||||
@@ -86,6 +91,7 @@ class RateLimiterTest extends TestCase {
|
||||
$filter = $this->getMockBuilder(RateLimiter::class)
|
||||
->setConstructorArgs([[
|
||||
'limit' => 3,
|
||||
'authserverDomain' => Yii::$app->params['authserverHost'],
|
||||
]])
|
||||
->setMethods(['getServer'])
|
||||
->getMock();
|
||||
|
||||
Reference in New Issue
Block a user