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