apply PHP-CS-Fixer rule sets
This commit is contained in:
parent
8e0480898a
commit
ecb8b61923
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
src/tests/.phpunit.result.cache
|
||||
src/tests/reports/
|
||||
.php_cs.cache
|
||||
|
13
.php-cs-fixer.php
Normal file
13
.php-cs-fixer.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in(__DIR__)
|
||||
;
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
return $config->setRules([
|
||||
'@PHP73Migration' => true,
|
||||
'@PSR12' => true
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
@ -45,6 +45,9 @@
|
||||
"bacon/bacon-qr-code": "^2.0",
|
||||
"laminas/laminas-math": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.19"
|
||||
},
|
||||
"suggest": {
|
||||
"d3/modcfg": "Provides automatic installation routines"
|
||||
},
|
||||
|
@ -162,4 +162,4 @@ class d3user_totp extends AdminDetailsController
|
||||
$oBackupCodeList = $this->getBackupcodeListObject();
|
||||
return $oBackupCodeList->getAvailableCodeCount($this->getEditObjectId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class d3_account_totp extends AccountController
|
||||
|
||||
$aParams = [
|
||||
'd3totp__usetotp' => 1,
|
||||
'd3totp__oxuserid' => $oUser->getId()
|
||||
'd3totp__oxuserid' => $oUser->getId(),
|
||||
];
|
||||
$seed = Registry::getRequest()->getRequestEscapedParameter("secret");
|
||||
$otp = Registry::getRequest()->getRequestEscapedParameter("otp");
|
||||
@ -133,4 +133,4 @@ class d3_account_totp extends AccountController
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,4 +118,4 @@ class d3totplogin extends FrontendController
|
||||
|
||||
return $aPaths;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ use Laminas\Math\Rand;
|
||||
|
||||
class d3RandomGenerator extends Rand
|
||||
{
|
||||
const CHAR_DIGITS = '0123456789';
|
||||
public const CHAR_DIGITS = '0123456789';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@ -28,4 +28,4 @@ class d3RandomGenerator extends Rand
|
||||
{
|
||||
return self::getString(6, self::CHAR_DIGITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,4 +84,4 @@ class d3backupcode extends BaseModel
|
||||
{
|
||||
return oxNew(User::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,4 +163,4 @@ class d3backupcodelist extends ListModel
|
||||
{
|
||||
return $this->getBaseObject()->d3GetUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3totp extends BaseModel
|
||||
{
|
||||
const TOTP_SESSION_VARNAME = 'totp_auth';
|
||||
const TOTP_SESSION_CURRENTUSER = 'd3totpCurrentUser';
|
||||
const TOTP_SESSION_CURRENTCLASS = 'd3totpCurrentClass';
|
||||
const TOTP_SESSION_NAVFORMPARAMS = 'd3totpNavFormParams';
|
||||
public const TOTP_SESSION_VARNAME = 'totp_auth';
|
||||
public const TOTP_SESSION_CURRENTUSER = 'd3totpCurrentUser';
|
||||
public const TOTP_SESSION_CURRENTCLASS = 'd3totpCurrentClass';
|
||||
public const TOTP_SESSION_NAVFORMPARAMS = 'd3totpNavFormParams';
|
||||
|
||||
public $tableName = 'd3totp';
|
||||
public $userId;
|
||||
@ -189,7 +189,7 @@ class d3totp extends BaseModel
|
||||
{
|
||||
$this->assign(
|
||||
[
|
||||
'seed' => $this->encrypt($seed)
|
||||
'seed' => $this->encrypt($seed),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -51,5 +51,5 @@ $aLang = [
|
||||
'D3_TOTP_ERROR_UNVALID' => 'Das Einmalpasswort ist ungültig.',
|
||||
'D3_TOTP_ALREADY_EXIST' => 'Die Registrierung wurde schon gespeichert.',
|
||||
|
||||
'SHOP_MODULE_D3_TOTP_ADMIN_FORCE_2FA' => 'Administratoren sind verpflichtet 2FA zu aktivieren'
|
||||
'SHOP_MODULE_D3_TOTP_ADMIN_FORCE_2FA' => 'Administratoren sind verpflichtet 2FA zu aktivieren',
|
||||
];
|
||||
|
@ -51,5 +51,5 @@ $aLang = [
|
||||
'D3_TOTP_ERROR_UNVALID' => 'The one-time password is invalid.',
|
||||
'D3_TOTP_ALREADY_EXIST' => 'The registration has already been saved.',
|
||||
|
||||
'SHOP_MODULE_D3_TOTP_ADMIN_FORCE_2FA' => 'Administrators are required to activate 2FA'
|
||||
'SHOP_MODULE_D3_TOTP_ADMIN_FORCE_2FA' => 'Administrators are required to activate 2FA',
|
||||
];
|
||||
|
@ -16,7 +16,9 @@ namespace D3\Totp\Modules\Application\Component
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\UserComponent;
|
||||
|
||||
class d3_totp_UserComponent_parent extends UserComponent { }
|
||||
class d3_totp_UserComponent_parent extends UserComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace D3\Totp\Modules\Application\Controller
|
||||
@ -26,11 +28,17 @@ namespace D3\Totp\Modules\Application\Controller
|
||||
use OxidEsales\Eshop\Application\Controller\PaymentController;
|
||||
use OxidEsales\Eshop\Application\Controller\UserController;
|
||||
|
||||
class d3_totp_UserController_parent extends UserController { }
|
||||
class d3_totp_UserController_parent extends UserController
|
||||
{
|
||||
}
|
||||
|
||||
class d3_totp_PaymentController_parent extends PaymentController { }
|
||||
class d3_totp_PaymentController_parent extends PaymentController
|
||||
{
|
||||
}
|
||||
|
||||
class d3_totp_OrderController_parent extends OrderController { }
|
||||
class d3_totp_OrderController_parent extends OrderController
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace D3\Totp\Modules\Application\Controller\Admin
|
||||
@ -38,7 +46,9 @@ namespace D3\Totp\Modules\Application\Controller\Admin
|
||||
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
|
||||
|
||||
class d3_totp_LoginController_parent extends LoginController { }
|
||||
class d3_totp_LoginController_parent extends LoginController
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace D3\Totp\Modules\Application\Model
|
||||
@ -46,7 +56,9 @@ namespace D3\Totp\Modules\Application\Model
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
|
||||
class d3_totp_user_parent extends User { }
|
||||
class d3_totp_user_parent extends User
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace D3\Totp\Modules\Core
|
||||
@ -54,5 +66,7 @@ namespace D3\Totp\Modules\Core
|
||||
|
||||
use OxidEsales\Eshop\Core\Utils;
|
||||
|
||||
class d3_totp_utils_parent extends Utils { }
|
||||
}
|
||||
class d3_totp_utils_parent extends Utils
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
|
||||
) {
|
||||
Registry::getSession()->setVariable(
|
||||
d3totp::TOTP_SESSION_CURRENTCLASS,
|
||||
$this->getParent()->getClassKey() != 'd3totplogin' ? $this->getParent()->getClassKey() : 'start');
|
||||
$this->getParent()->getClassKey() != 'd3totplogin' ? $this->getParent()->getClassKey() : 'start'
|
||||
);
|
||||
Registry::getSession()->setVariable(d3totp::TOTP_SESSION_CURRENTUSER, $oUser->getId());
|
||||
Registry::getSession()->setVariable(
|
||||
d3totp::TOTP_SESSION_NAVFORMPARAMS,
|
||||
@ -164,4 +165,4 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
|
||||
{
|
||||
return Registry::getSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
|
||||
|
||||
protected function hasLoginCredentials()
|
||||
{
|
||||
return Registry::getRequest()->getRequestEscapedParameter( 'user') &&
|
||||
return Registry::getRequest()->getRequestEscapedParameter('user') &&
|
||||
Registry::getRequest()->getRequestEscapedParameter('pwd');
|
||||
}
|
||||
|
||||
@ -174,4 +174,4 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
|
||||
{
|
||||
return oxNew(User::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ namespace D3\Totp\Modules\Application\Controller;
|
||||
class d3_totp_OrderController extends d3_totp_OrderController_parent
|
||||
{
|
||||
use d3_totp_getUserTrait;
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ namespace D3\Totp\Modules\Application\Controller;
|
||||
class d3_totp_PaymentController extends d3_totp_PaymentController_parent
|
||||
{
|
||||
use d3_totp_getUserTrait;
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ namespace D3\Totp\Modules\Application\Controller;
|
||||
class d3_totp_UserController extends d3_totp_UserController_parent
|
||||
{
|
||||
use d3_totp_getUserTrait;
|
||||
}
|
||||
}
|
||||
|
@ -60,4 +60,4 @@ trait d3_totp_getUserTrait
|
||||
{
|
||||
return Registry::getSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,4 +45,4 @@ class d3_totp_user extends d3_totp_user_parent
|
||||
{
|
||||
return Registry::getSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace D3\Totp\Setup;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
class Events
|
||||
{
|
||||
@ -58,7 +59,7 @@ class Events
|
||||
UNIQUE KEY `OXUSERID` (`OXUSERID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='totp setting';";
|
||||
|
||||
DatabaseProvider::getDb()->execute( $query );
|
||||
DatabaseProvider::getDb()->execute($query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +79,7 @@ class Events
|
||||
KEY `BACKUPCODE` (`BACKUPCODE`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='totp backup codes';";
|
||||
|
||||
DatabaseProvider::getDb()->execute( $query );
|
||||
DatabaseProvider::getDb()->execute($query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,7 +103,7 @@ class Events
|
||||
'', NOW()
|
||||
);";
|
||||
|
||||
DatabaseProvider::getDb()->execute( $query );
|
||||
DatabaseProvider::getDb()->execute($query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,8 +128,8 @@ class Events
|
||||
'', NOW()
|
||||
);";
|
||||
|
||||
DatabaseProvider::getDb()->execute( $query );
|
||||
DatabaseProvider::getDb()->execute($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@ -84,7 +84,7 @@ $aModule = [
|
||||
'name' => 'D3_TOTP_ADMIN_FORCE_2FA',
|
||||
'type' => 'bool',
|
||||
'value' => false,
|
||||
]
|
||||
],
|
||||
],
|
||||
'events' => [
|
||||
'onActivate' => ModuleSetup\Events::class.'::onActivate',
|
||||
@ -101,5 +101,5 @@ $aModule = [
|
||||
'block' => 'account_menu',
|
||||
'file' => 'Application/views/blocks/page/account/inc/account_menu.tpl',
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
// Include totp test config
|
||||
|
||||
namespace D3\Totp\tests;
|
||||
|
||||
use D3\ModCfg\Tests\additional_abstract;
|
||||
@ -33,4 +34,4 @@ class additional extends additional_abstract
|
||||
}
|
||||
}
|
||||
|
||||
oxNew(additional::class);
|
||||
oxNew(additional::class);
|
||||
|
@ -12,4 +12,3 @@
|
||||
*/
|
||||
|
||||
const D3TOTP_REQUIRE_MODCFG = true;
|
||||
|
||||
|
@ -84,7 +84,7 @@ class d3force_2faTest extends d3user_totpTest
|
||||
'noAdmin' => [false, false, true, 'userId'],
|
||||
'dont force' => [false, true, false, 'userId'],
|
||||
'no user id' => [false, true, true, null],
|
||||
'passed' => [true, true, true, 'userId']
|
||||
'passed' => [true, true, true, 'userId'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -104,4 +104,4 @@ class d3force_2faTest extends d3user_totpTest
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3user_totp::class)
|
||||
->onlyMethods([
|
||||
'getEditObjectId',
|
||||
'getUserObject'
|
||||
'getUserObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('-1');
|
||||
@ -65,7 +65,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$sTpl = $this->callMethod($this->_oController, 'render');
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', array('edit'));
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', ['edit']);
|
||||
|
||||
$this->assertSame('d3user_totp.tpl', $sTpl);
|
||||
$this->assertSame($tplUser, null);
|
||||
@ -93,7 +93,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3user_totp::class)
|
||||
->onlyMethods([
|
||||
'getEditObjectId',
|
||||
'getUserObject'
|
||||
'getUserObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -102,8 +102,8 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$sTpl = $this->callMethod($this->_oController, 'render');
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', array('edit'));
|
||||
$oxid = $this->callMethod($this->_oController, 'getViewDataElement', array('oxid'));
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', ['edit']);
|
||||
$oxid = $this->callMethod($this->_oController, 'getViewDataElement', ['oxid']);
|
||||
|
||||
$this->assertSame('d3user_totp.tpl', $sTpl);
|
||||
$this->assertSame($tplUser, $oUserMock);
|
||||
@ -133,7 +133,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getEditObjectId',
|
||||
'getUserObject',
|
||||
'addTplParam'
|
||||
'addTplParam',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -151,8 +151,8 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$this->setValue($this->_oController, '_sSaveError', 'foo');
|
||||
|
||||
$sTpl = $this->callMethod($this->_oController, 'render');
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', array('edit'));
|
||||
$oxid = $this->callMethod($this->_oController, 'getViewDataElement', array('oxid'));
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', ['edit']);
|
||||
$oxid = $this->callMethod($this->_oController, 'getViewDataElement', ['oxid']);
|
||||
|
||||
$this->assertSame('d3user_totp.tpl', $sTpl);
|
||||
$this->assertNull($tplUser);
|
||||
@ -228,7 +228,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'verify',
|
||||
'saveSecret',
|
||||
'assign',
|
||||
'checkIfAlreadyExist'
|
||||
'checkIfAlreadyExist',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -245,7 +245,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'getEditObjectId',
|
||||
'getUserObject',
|
||||
'getTotpObject',
|
||||
'getBackupcodeListObject'
|
||||
'getBackupcodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -279,7 +279,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'verify',
|
||||
'saveSecret',
|
||||
'assign',
|
||||
'checkIfAlreadyExist'
|
||||
'checkIfAlreadyExist',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->method('load')->willReturn(true);
|
||||
@ -295,7 +295,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'getEditObjectId',
|
||||
'getUserObject',
|
||||
'getTotpObject',
|
||||
'getBackupcodeListObject'
|
||||
'getBackupcodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -318,7 +318,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeListMock = $this->getMockBuilder(d3backupcodelist::class)
|
||||
->onlyMethods([
|
||||
'save',
|
||||
'generateBackupCodes'
|
||||
'generateBackupCodes',
|
||||
])
|
||||
->getMock();
|
||||
$oBackupCodeListMock->expects($this->once())->method('save')->willReturn(true);
|
||||
@ -332,7 +332,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'verify',
|
||||
'saveSecret',
|
||||
'assign',
|
||||
'checkIfAlreadyExist'
|
||||
'checkIfAlreadyExist',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -349,7 +349,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'getEditObjectId',
|
||||
'getUserObject',
|
||||
'getTotpObject',
|
||||
'getBackupcodeListObject'
|
||||
'getBackupcodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -369,7 +369,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
public function canSaveWithKnownOXID()
|
||||
{
|
||||
$aEditval = [
|
||||
'd3totp__oxid' => 'foo'
|
||||
'd3totp__oxid' => 'foo',
|
||||
];
|
||||
$_GET['editval'] = $aEditval;
|
||||
|
||||
@ -377,7 +377,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeListMock = $this->getMockBuilder(d3backupcodelist::class)
|
||||
->onlyMethods([
|
||||
'save',
|
||||
'generateBackupCodes'
|
||||
'generateBackupCodes',
|
||||
])
|
||||
->getMock();
|
||||
$oBackupCodeListMock->expects($this->once())->method('save')->willReturn(true);
|
||||
@ -391,7 +391,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'verify',
|
||||
'saveSecret',
|
||||
'assign',
|
||||
'checkIfAlreadyExist'
|
||||
'checkIfAlreadyExist',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -408,7 +408,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
'getEditObjectId',
|
||||
'getUserObject',
|
||||
'getTotpObject',
|
||||
'getBackupcodeListObject'
|
||||
'getBackupcodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getEditObjectId')->willReturn('foobar');
|
||||
@ -430,10 +430,10 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
{
|
||||
$aBackupList = [
|
||||
'foo1',
|
||||
'bar2'
|
||||
'bar2',
|
||||
];
|
||||
|
||||
$this->callMethod($this->_oController, 'setBackupCodes', array($aBackupList));
|
||||
$this->callMethod($this->_oController, 'setBackupCodes', [$aBackupList]);
|
||||
|
||||
$aReturn = $this->callMethod($this->_oController, 'getBackupCodes');
|
||||
|
||||
@ -476,7 +476,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
public function canDelete()
|
||||
{
|
||||
$editval = [
|
||||
'd3totp__oxid' => 'foo'
|
||||
'd3totp__oxid' => 'foo',
|
||||
];
|
||||
$_GET['editval'] = $editval;
|
||||
|
||||
@ -485,7 +485,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'delete',
|
||||
'load'
|
||||
'load',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->expects($this->once())->method('delete')->willReturn(true);
|
||||
@ -522,7 +522,7 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3user_totp::class)
|
||||
->onlyMethods([
|
||||
'getBackupCodeListObject',
|
||||
'getUser'
|
||||
'getUser',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getBackupCodeListObject')->willReturn($oBackupCodeListMock);
|
||||
@ -535,4 +535,4 @@ class d3user_totpTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oController, 'getAvailableBackupCodeCount')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oUser->setId('foo');
|
||||
$oUser->assign(
|
||||
[
|
||||
'oxpassword' => 'foo'
|
||||
'oxpassword' => 'foo',
|
||||
]
|
||||
);
|
||||
|
||||
@ -69,7 +69,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$sTpl = $this->callMethod($this->_oController, 'render');
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', array('user'));
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', ['user']);
|
||||
|
||||
$this->assertSame('d3_account_totp.tpl', $sTpl);
|
||||
$this->assertSame($tplUser, $oUser);
|
||||
@ -94,7 +94,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$sTpl = $this->callMethod($this->_oController, 'render');
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', array('user'));
|
||||
$tplUser = $this->callMethod($this->_oController, 'getViewDataElement', ['user']);
|
||||
|
||||
$this->assertSame('page/account/login.tpl', $sTpl);
|
||||
$this->assertNull($tplUser);
|
||||
@ -110,10 +110,10 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
{
|
||||
$aBackupList = [
|
||||
'foo1',
|
||||
'bar2'
|
||||
'bar2',
|
||||
];
|
||||
|
||||
$this->callMethod($this->_oController, 'setBackupCodes', array($aBackupList));
|
||||
$this->callMethod($this->_oController, 'setBackupCodes', [$aBackupList]);
|
||||
|
||||
$aReturn = $this->callMethod($this->_oController, 'getBackupCodes');
|
||||
|
||||
@ -156,7 +156,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_account_totp::class)
|
||||
->onlyMethods([
|
||||
'getBackupCodeListObject',
|
||||
'getUser'
|
||||
'getUser',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getBackupCodeListObject')->willReturn($oBackupCodeListMock);
|
||||
@ -203,7 +203,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeListMock = $this->getMockBuilder(d3backupcodelist::class)
|
||||
->onlyMethods([
|
||||
'generateBackupCodes',
|
||||
'save'
|
||||
'save',
|
||||
])
|
||||
->getMock();
|
||||
$oBackupCodeListMock->expects($this->never())->method('generateBackupCodes');
|
||||
@ -216,7 +216,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
'saveSecret',
|
||||
'assign',
|
||||
'verify',
|
||||
'save'
|
||||
'save',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->method('saveSecret')->willReturn(true);
|
||||
@ -232,7 +232,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getTotpObject',
|
||||
'getUser',
|
||||
'getBackupCodeListObject'
|
||||
'getBackupCodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getTotpObject')->willReturn($oTotpMock);
|
||||
@ -257,7 +257,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeListMock = $this->getMockBuilder(d3backupcodelist::class)
|
||||
->onlyMethods([
|
||||
'generateBackupCodes',
|
||||
'save'
|
||||
'save',
|
||||
])
|
||||
->getMock();
|
||||
$oBackupCodeListMock->method('generateBackupCodes')->willReturn(['0123', '1234']);
|
||||
@ -289,7 +289,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getTotpObject',
|
||||
'getUser',
|
||||
'getBackupCodeListObject'
|
||||
'getBackupCodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getTotpObject')->willReturn($oTotpMock);
|
||||
@ -341,7 +341,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_account_totp::class)
|
||||
->onlyMethods([
|
||||
'getTotpObject',
|
||||
'getUser'
|
||||
'getUser',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getTotpObject')->willReturn($oTotpMock);
|
||||
@ -366,7 +366,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'delete',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->expects($this->once())->method('delete')->willReturn(true);
|
||||
@ -379,7 +379,7 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_account_totp::class)
|
||||
->onlyMethods([
|
||||
'getTotpObject',
|
||||
'getUser'
|
||||
'getUser',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getTotpObject')->willReturn($oTotpMock);
|
||||
@ -405,4 +405,4 @@ class d3_account_totpTest extends d3TotpUnitTestCase
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class d3totploginTest extends d3TotpUnitTestCase
|
||||
$oControllerMock->method('getUtils')->willReturn($oUtilsMock);
|
||||
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
|
||||
$this->callMethod($this->_oController, 'render');
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class d3totploginTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['getAvailableCodeCount'])
|
||||
->getMock();
|
||||
$oBackupCodesListMock->method('getAvailableCodeCount')->willReturn(1);
|
||||
|
||||
|
||||
/** @var d3totplogin|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->getMockBuilder(d3totplogin::class)
|
||||
->onlyMethods(['getBackupCodeListObject'])
|
||||
@ -264,4 +264,4 @@ class d3totploginTest extends d3TotpUnitTestCase
|
||||
$this->assertIsString($aBreadCrumb[0]['link']);
|
||||
$this->assertTrue(strlen($aBreadCrumb[0]['link']) > 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,4 @@ class BaconQrCodeFactoryTest extends d3TotpUnitTestCase
|
||||
BaconQrCodeFactory::renderer(200)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,4 +52,4 @@ class d3totp_wrongOtpExceptionTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oModel, 'getMessage')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,4 +51,4 @@ class d3RandomGeneratorTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oModel, 'getRandomTotpBackupCode')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class d3backupcodeTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3backupcode::class)
|
||||
->onlyMethods([
|
||||
'getRandomTotpBackupCode',
|
||||
'd3EncodeBC'
|
||||
'd3EncodeBC',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getRandomTotpBackupCode')->willReturn($sBackupCode);
|
||||
@ -69,7 +69,7 @@ class d3backupcodeTest extends d3TotpUnitTestCase
|
||||
|
||||
$this->_oModel = $oModelMock;
|
||||
|
||||
$this->callMethod($this->_oModel, 'generateCode', array($sTestUserId));
|
||||
$this->callMethod($this->_oModel, 'generateCode', [$sTestUserId]);
|
||||
|
||||
$this->assertSame($sTestUserId, $this->_oModel->getFieldData('oxuserid'));
|
||||
$this->assertSame($sBackupCode, $this->_oModel->getFieldData('backupcode'));
|
||||
@ -103,10 +103,10 @@ class d3backupcodeTest extends d3TotpUnitTestCase
|
||||
$oUserMock->method('load')->willReturn(true);
|
||||
$oUserMock->assign(
|
||||
[
|
||||
'oxpasssalt' => '6162636465666768696A6B'
|
||||
'oxpasssalt' => '6162636465666768696A6B',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
/** @var d3backupcode|MockObject $oModelMock */
|
||||
$oModelMock = $this->getMockBuilder(d3backupcode::class)
|
||||
->onlyMethods(['d3GetUserObject'])
|
||||
@ -134,7 +134,7 @@ class d3backupcodeTest extends d3TotpUnitTestCase
|
||||
->getMock();
|
||||
$oUserMock->assign(
|
||||
[
|
||||
'oxid' => 'foobar'
|
||||
'oxid' => 'foobar',
|
||||
]
|
||||
);
|
||||
|
||||
@ -178,4 +178,4 @@ class d3backupcodeTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oModel, 'd3GetUserObject')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'deleteAllFromUser',
|
||||
'getD3BackupCodeObject',
|
||||
'd3GetConfig'
|
||||
'd3GetConfig',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->expects($this->once())->method('deleteAllFromUser')->willReturn(true);
|
||||
@ -84,7 +84,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
|
||||
$this->_oModel = $oModelMock;
|
||||
|
||||
$this->callMethod($this->_oModel, 'generateBackupCodes', array('123456'));
|
||||
$this->callMethod($this->_oModel, 'generateBackupCodes', ['123456']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeMock->expects($this->once())->method('save')->willReturn(true);
|
||||
|
||||
$aBackupCodeArray = [
|
||||
$oBackupCodeMock
|
||||
$oBackupCodeMock,
|
||||
];
|
||||
|
||||
/** @var d3backupcodelist|MockObject $oModelMock */
|
||||
@ -178,7 +178,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getOne',
|
||||
'quoteIdentifier',
|
||||
'quote'
|
||||
'quote',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -191,7 +191,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'd3GetDb',
|
||||
'getBaseObject',
|
||||
'd3GetUser'
|
||||
'd3GetUser',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('d3GetDb')->willReturn($oDbMock);
|
||||
@ -201,7 +201,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
$this->_oModel = $oModelMock;
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oModel, 'verify', array('123456'))
|
||||
$this->callMethod($this->_oModel, 'verify', ['123456'])
|
||||
);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['getId'])
|
||||
->getMock();
|
||||
$oUserMock->method('getId')->willReturn('foobar');
|
||||
|
||||
|
||||
/** @var d3backupcode|MockObject $oBackupCodeMock */
|
||||
$oBackupCodeMock = $this->getMockBuilder(d3backupcode::class)
|
||||
->onlyMethods(['delete'])
|
||||
@ -242,7 +242,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'd3GetDb',
|
||||
'getBaseObject',
|
||||
'd3GetUser'
|
||||
'd3GetUser',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('d3GetDb')->willReturn($oDbMock);
|
||||
@ -252,7 +252,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
$this->_oModel = $oModelMock;
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oModel, 'verify', array('123456'))
|
||||
$this->callMethod($this->_oModel, 'verify', ['123456'])
|
||||
);
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
$oBackupCodeMock->expects($this->once())->method('delete')->willReturn(true);
|
||||
|
||||
$aBackupCodeArray = [
|
||||
$oBackupCodeMock
|
||||
$oBackupCodeMock,
|
||||
];
|
||||
|
||||
/** @var d3backupcodelist|MockObject $oModelMock */
|
||||
@ -302,7 +302,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getArray',
|
||||
'selectString',
|
||||
'd3GetDb'
|
||||
'd3GetDb',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->expects($this->once())->method('getArray')->willReturn($aBackupCodeArray);
|
||||
@ -345,7 +345,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getArray',
|
||||
'selectString',
|
||||
'd3GetDb'
|
||||
'd3GetDb',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->expects($this->once())->method('getArray')->willReturn($aBackupCodeArray);
|
||||
@ -369,7 +369,7 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getOne',
|
||||
'quoteIdentifier',
|
||||
'quote'
|
||||
'quote',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -403,4 +403,4 @@ class d3backupcodelistTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oModel, 'd3GetUser')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'd3GetDb',
|
||||
'load'
|
||||
'load',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('d3GetDb')->willReturn($oDbMock);
|
||||
@ -108,7 +108,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'getOne',
|
||||
'quote'
|
||||
'quote',
|
||||
])->getMock();
|
||||
$oDbMock->expects($this->exactly(2))->method('getOne')->willReturnOnConsecutiveCalls(true, true);
|
||||
$oDbMock->method('quote')->willReturn(true);
|
||||
@ -117,7 +117,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'd3GetDb',
|
||||
'load'
|
||||
'load',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('d3GetDb')->willReturn($oDbMock);
|
||||
@ -205,7 +205,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oDbMock = $this->getMockBuilder(Database::class)
|
||||
->onlyMethods([
|
||||
'getOne',
|
||||
'quote'
|
||||
'quote',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -221,7 +221,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$this->_oModel = $oModelMock;
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oModel, 'checkIfAlreadyExist', array('testUserId'))
|
||||
$this->callMethod($this->_oModel, 'checkIfAlreadyExist', ['testUserId'])
|
||||
);
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getFieldData',
|
||||
'decrypt'
|
||||
'decrypt',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getFieldData')->willReturn('seed');
|
||||
@ -455,7 +455,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getFieldData',
|
||||
'decrypt'
|
||||
'decrypt',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getFieldData')->willReturn(null);
|
||||
@ -479,7 +479,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getFieldData',
|
||||
'decrypt'
|
||||
'decrypt',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getFieldData')->willReturn('seed');
|
||||
@ -529,7 +529,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getUser',
|
||||
'getSavedSecret'
|
||||
'getSavedSecret',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getUser')->willReturn($oUserMock);
|
||||
@ -564,7 +564,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getUser',
|
||||
'getSavedSecret'
|
||||
'getSavedSecret',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getUser')->willReturn($oUserMock);
|
||||
@ -720,7 +720,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getTotp',
|
||||
'd3GetBackupCodeListObject'
|
||||
'd3GetBackupCodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getTotp')->willReturn($oTotpMock);
|
||||
@ -758,7 +758,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getTotp',
|
||||
'd3GetBackupCodeListObject'
|
||||
'd3GetBackupCodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getTotp')->willReturn($oTotpMock);
|
||||
@ -794,7 +794,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
$oModelMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'getTotp',
|
||||
'd3GetBackupCodeListObject'
|
||||
'd3GetBackupCodeListObject',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('getTotp')->willReturn($oTotpMock);
|
||||
@ -907,7 +907,7 @@ class d3totpTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'd3GetBackupCodeListObject',
|
||||
'getFieldData',
|
||||
'canDelete'
|
||||
'canDelete',
|
||||
])
|
||||
->getMock();
|
||||
$oModelMock->method('d3GetBackupCodeListObject')->willReturn($oBackupCodeListMock);
|
||||
|
@ -71,13 +71,13 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$oTotpMock->expects($this->never())->method('isActive')->willReturn(false);
|
||||
|
||||
|
||||
/** @var UserComponent|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->getMockBuilder(UserComponent::class)
|
||||
->onlyMethods([
|
||||
'getUser',
|
||||
'd3GetTotpObject',
|
||||
'getParent'
|
||||
'getParent',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getUser')->willReturn($oUser);
|
||||
@ -102,7 +102,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oUserMock = $this->getMockBuilder(User::class)
|
||||
->onlyMethods([
|
||||
'logout',
|
||||
'getId'
|
||||
'getId',
|
||||
])
|
||||
->getMock();
|
||||
$oUserMock->expects($this->never())->method('logout')->willReturn(false);
|
||||
@ -118,7 +118,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -130,7 +130,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getUser',
|
||||
'd3GetTotpObject',
|
||||
'getParent'
|
||||
'getParent',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getUser')->willReturn($oUserMock);
|
||||
@ -171,7 +171,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -183,7 +183,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
->onlyMethods([
|
||||
'getUser',
|
||||
'd3GetTotpObject',
|
||||
'getParent'
|
||||
'getParent',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('getUser')->willReturn($oUserMock);
|
||||
@ -218,7 +218,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
* @throws ReflectionException
|
||||
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
|
||||
*/
|
||||
public function checkTotploginNoTotpLogin()
|
||||
public function checkTotploginNoTotpLogin()
|
||||
{
|
||||
/** @var d3totp|MockObject $oTotpMock */
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
@ -233,7 +233,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
'isNoTotpOrNoLogin',
|
||||
'hasValidTotp',
|
||||
'd3TotpRelogin',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(true);
|
||||
@ -254,7 +254,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
* @throws ReflectionException
|
||||
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
|
||||
*/
|
||||
public function checkTotploginUnvalidTotp()
|
||||
public function checkTotploginUnvalidTotp()
|
||||
{
|
||||
/** @var d3totp|MockObject $oTotpMock */
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
@ -273,7 +273,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['addErrorToDisplay'])
|
||||
->getMock();
|
||||
$oUtilsViewMock->expects($this->atLeast(1))->method('addErrorToDisplay')->willReturn(true);
|
||||
|
||||
|
||||
/** @var UserComponent|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->getMockBuilder(UserComponent::class)
|
||||
->onlyMethods([
|
||||
@ -281,7 +281,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
'hasValidTotp',
|
||||
'd3TotpRelogin',
|
||||
'd3GetUtilsView',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
|
||||
@ -303,7 +303,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
* @throws ReflectionException
|
||||
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
|
||||
*/
|
||||
public function checkTotploginValidTotp()
|
||||
public function checkTotploginValidTotp()
|
||||
{
|
||||
/** @var d3totp|MockObject $oTotpMock */
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
@ -325,7 +325,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
'hasValidTotp',
|
||||
'd3TotpRelogin',
|
||||
'd3GetUtilsView',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
|
||||
@ -389,7 +389,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('isActive')->willReturn(true);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('isActive')->willReturn(false);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('isActive')->willReturn(true);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(false);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(true);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(true);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array(null, $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', [null, $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(false);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['setVariable'])
|
||||
->getMock();
|
||||
$oSessionMock->expects($this->atLeast(2))->method('setVariable')->willReturn(false);
|
||||
|
||||
|
||||
/** @var User|MockObject $oUserMock */
|
||||
$oUserMock = $this->getMockBuilder(User::class)
|
||||
->onlyMethods(['getId'])
|
||||
@ -544,7 +544,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
'd3GetSession',
|
||||
'setUser',
|
||||
'setLoginStatus',
|
||||
'_afterLogin'
|
||||
'_afterLogin',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
|
||||
@ -554,7 +554,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->callMethod($this->_oController, 'd3TotpRelogin', array($oUserMock, '123456'));
|
||||
$this->callMethod($this->_oController, 'd3TotpRelogin', [$oUserMock, '123456']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -593,4 +593,4 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oController, 'd3GetSession')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -71,7 +71,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oSessionMock = $this->getMockBuilder(Session::class)
|
||||
->onlyMethods([
|
||||
'getVariable',
|
||||
'setVariable'
|
||||
'setVariable',
|
||||
])
|
||||
->getMock();
|
||||
$oSessionMock->method('getVariable')->will($this->onConsecutiveCalls(false, true));
|
||||
@ -81,7 +81,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods([
|
||||
'd3GetSession',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
|
||||
@ -90,7 +90,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertSame('login.tpl', $this->callMethod($this->_oController, 'render'));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', array('request_totp')));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', ['request_totp']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->expects($this->once())->method('isActive')->willReturn(false);
|
||||
@ -126,7 +126,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods([
|
||||
'd3GetSession',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
|
||||
@ -135,7 +135,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertSame('login.tpl', $this->callMethod($this->_oController, 'render'));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', array('request_totp')));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', ['request_totp']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -171,7 +171,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods([
|
||||
'd3GetSession',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
|
||||
@ -180,7 +180,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertSame('login.tpl', $this->callMethod($this->_oController, 'render'));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', array('request_totp')));
|
||||
$this->assertNotTrue($this->callMethod($this->_oController, 'getViewDataElement', ['request_totp']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,7 +195,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -216,7 +216,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods([
|
||||
'd3GetSession',
|
||||
'd3GetTotpObject'
|
||||
'd3GetTotpObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
|
||||
@ -225,7 +225,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertSame('login.tpl', $this->callMethod($this->_oController, 'render'));
|
||||
$this->assertTrue($this->callMethod($this->_oController, 'getViewDataElement', array('request_totp')));
|
||||
$this->assertTrue($this->callMethod($this->_oController, 'getViewDataElement', ['request_totp']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,7 +301,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
'd3GetTotpObject',
|
||||
'isNoTotpOrNoLogin',
|
||||
'hasValidTotp',
|
||||
'hasLoginCredentials'
|
||||
'hasLoginCredentials',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -339,7 +339,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
{
|
||||
return [
|
||||
'no totp, no login credentials' => [false],
|
||||
'no totp, given login credentials' => [true]
|
||||
'no totp, given login credentials' => [true],
|
||||
];
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['addErrorToDisplay'])
|
||||
->getMock();
|
||||
$utilsViewMock->expects($this->once())->method('addErrorToDisplay')->willReturn(true);
|
||||
|
||||
|
||||
/** @var d3totp|MockObject $oTotpMock */
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->disableOriginalConstructor()
|
||||
@ -374,7 +374,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
'd3GetTotpObject',
|
||||
'isNoTotpOrNoLogin',
|
||||
'hasValidTotp',
|
||||
'd3GetUtilsView'
|
||||
'd3GetUtilsView',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -423,7 +423,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
'isNoTotpOrNoLogin',
|
||||
'hasValidTotp',
|
||||
'd3GetUtilsView',
|
||||
'd3GetSession'
|
||||
'd3GetSession',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -449,7 +449,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['getAvailableCodeCount'])
|
||||
->getMock();
|
||||
$oBackupCodeListMock->method('getAvailableCodeCount')->willReturn(2);
|
||||
|
||||
|
||||
/** @var d3_totp_LoginController|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods(['d3GetBackupCodeListObject'])
|
||||
@ -522,7 +522,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', array($oTotpMock))
|
||||
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(false);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(true);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -651,7 +651,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(true);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array(null, $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', [null, $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -672,7 +672,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oTotpMock->method('verify')->willReturn(false);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', array('123456', $oTotpMock))
|
||||
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
|
||||
);
|
||||
}
|
||||
|
||||
@ -688,7 +688,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
->onlyMethods(['logout'])
|
||||
->getMock();
|
||||
$oUserMock->expects($this->once())->method('logout')->willReturn(true);
|
||||
|
||||
|
||||
/** @var d3_totp_LoginController|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods(['d3GetUserObject'])
|
||||
@ -696,7 +696,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
$oControllerMock->method('d3GetUserObject')->willReturn($oUserMock);
|
||||
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
|
||||
$this->callMethod($this->_oController, 'd3CancelLogin');
|
||||
}
|
||||
|
||||
@ -745,4 +745,4 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
'both' => ['user', 'password', true],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,4 +43,4 @@ class d3_totp_OrderControllerTest extends d3TotpUnitTestCase
|
||||
|
||||
unset($this->_oController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,4 +42,4 @@ class d3_totp_PaymentControllerTest extends d3TotpUnitTestCase
|
||||
|
||||
unset($this->_oController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,4 +42,4 @@ class d3_totp_UserControllerTest extends d3TotpUnitTestCase
|
||||
|
||||
unset($this->_oController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ trait d3_totp_getUserTestTrait
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->method('isActive')->willReturn(false);
|
||||
@ -80,7 +80,7 @@ trait d3_totp_getUserTestTrait
|
||||
$oControllerMock = $this->getMockBuilder($this->sControllerClass)
|
||||
->onlyMethods([
|
||||
'd3GetTotpObject',
|
||||
'd3GetSessionObject'
|
||||
'd3GetSessionObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->expects($this->once())->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -121,7 +121,7 @@ trait d3_totp_getUserTestTrait
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->method('isActive')->willReturn(true);
|
||||
@ -131,7 +131,7 @@ trait d3_totp_getUserTestTrait
|
||||
$oControllerMock = $this->getMockBuilder($this->sControllerClass)
|
||||
->onlyMethods([
|
||||
'd3GetTotpObject',
|
||||
'd3GetSessionObject'
|
||||
'd3GetSessionObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->expects($this->once())->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -173,7 +173,7 @@ trait d3_totp_getUserTestTrait
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
'isActive',
|
||||
'loadByUserId'
|
||||
'loadByUserId',
|
||||
])
|
||||
->getMock();
|
||||
$oTotpMock->method('isActive')->willReturn(true);
|
||||
@ -183,7 +183,7 @@ trait d3_totp_getUserTestTrait
|
||||
$oControllerMock = $this->getMockBuilder($this->sControllerClass)
|
||||
->onlyMethods([
|
||||
'd3GetTotpObject',
|
||||
'd3GetSessionObject'
|
||||
'd3GetSessionObject',
|
||||
])
|
||||
->getMock();
|
||||
$oControllerMock->expects($this->once())->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -230,4 +230,4 @@ trait d3_totp_getUserTestTrait
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,4 +97,4 @@ class d3_totp_userTest extends d3TotpUnitTestCase
|
||||
$this->callMethod($this->_oModel, 'd3GetSession')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'loadByUserId',
|
||||
'isActive'
|
||||
'isActive',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -139,7 +139,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
$oCoreMock = $this->getMockBuilder(Utils::class)
|
||||
->onlyMethods([
|
||||
'd3GetTotpObject',
|
||||
'fetchRightsForUser'
|
||||
'fetchRightsForUser',
|
||||
])
|
||||
->getMock();
|
||||
$oCoreMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -171,7 +171,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
$oTotpMock = $this->getMockBuilder(d3totp::class)
|
||||
->onlyMethods([
|
||||
'loadByUserId',
|
||||
'isActive'
|
||||
'isActive',
|
||||
])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -184,7 +184,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
'd3GetTotpObject',
|
||||
'd3GetSessionObject',
|
||||
'fetchRightsForUser',
|
||||
'redirect'
|
||||
'redirect',
|
||||
])
|
||||
->getMock();
|
||||
$oCoreMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -237,7 +237,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
'd3GetTotpObject',
|
||||
'd3GetSessionObject',
|
||||
'fetchRightsForUser',
|
||||
'redirect'
|
||||
'redirect',
|
||||
])
|
||||
->getMock();
|
||||
$oCoreMock->method('d3GetTotpObject')->willReturn($oTotpMock);
|
||||
@ -366,7 +366,7 @@ class d3_totp_utilsTest extends d3TotpUnitTestCase
|
||||
{
|
||||
return [
|
||||
[true],
|
||||
[false]
|
||||
[false],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase;
|
||||
|
||||
abstract class d3TotpUnitTestCase extends d3ModCfgUnitTestCase
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user