rename module methods in extended OXID classes to prevent conflicts with other modules

This commit is contained in:
Daniel Seifert 2022-11-09 11:27:11 +01:00
parent e8a069a63b
commit f110142474
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
7 changed files with 151 additions and 151 deletions

View File

@ -11,7 +11,7 @@
<form action="[{$oViewConf->getSelfActionLink()}]" method="post" name="login" id="login">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="fnc" value="checkTotplogin">
<input type="hidden" name="fnc" value="d3TotpCheckTotpLogin">
<input type="hidden" name="cl" value="[{$oView->getPreviousClass()}]">
[{$navFormParams}]
@ -34,7 +34,7 @@
<form action="[{$oViewConf->getSelfActionLink()}]" method="post" name="login" id="login">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="fnc" value="cancelTotplogin">
<input type="hidden" name="fnc" value="d3TotpCancelTotpLogin">
<input type="hidden" name="cl" value="[{$oView->getPreviousClass()}]">
[{$navFormParams}]

View File

@ -42,15 +42,15 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
$totp->loadByUserId($oUser->getId());
if ($totp->isActive()
&& !$this->d3GetSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
&& !$this->d3TotpGetSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
) {
$this->d3GetSession()->setVariable(
$this->d3TotpGetSession()->setVariable(
d3totp::TOTP_SESSION_CURRENTCLASS,
$this->getParent()->getClassKey() != 'd3totplogin' ? $this->getParent()->getClassKey() : 'start'
);
$this->d3GetSession()->setVariable(d3totp::TOTP_SESSION_CURRENTUSER, $oUser->getId());
$this->d3GetSession()->setVariable(
$this->d3TotpGetSession()->setVariable(d3totp::TOTP_SESSION_CURRENTUSER, $oUser->getId());
$this->d3TotpGetSession()->setVariable(
d3totp::TOTP_SESSION_NAVFORMPARAMS,
$this->getParent()->getViewConfig()->getNavFormParams()
);
@ -58,7 +58,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
$oUser->logout();
$sUrl = Registry::getConfig()->getShopHomeUrl() . 'cl=d3totplogin';
$this->d3GetUtils()->redirect($sUrl, false);
$this->d3TotpGetUtils()->redirect($sUrl, false);
}
}
}
@ -75,7 +75,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
* @throws DBALException
* @throws DatabaseConnectionException
*/
public function checkTotplogin()
public function d3TotpCheckTotpLogin()
{
$sTotp = Registry::getRequest()->getRequestEscapedParameter('d3totp', true);
@ -87,10 +87,10 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
$totp->loadByUserId($sUserId);
try {
if (!$this->isNoTotpOrNoLogin($totp) && $this->hasValidTotp($sTotp, $totp)) {
if (!$this->d3TotpIsNoTotpOrNoLogin($totp) && $this->d3TotpHasValidTotp($sTotp, $totp)) {
// relogin, don't extract from this try block
$this->d3GetSession()->setVariable(d3totp::TOTP_SESSION_VARNAME, $sTotp);
$this->d3GetSession()->setVariable('usr', $oUser->getId());
$this->d3TotpGetSession()->setVariable(d3totp::TOTP_SESSION_VARNAME, $sTotp);
$this->d3TotpGetSession()->setVariable('usr', $oUser->getId());
$this->setUser(null);
$this->setLoginStatus(USER_LOGIN_SUCCESS);
$this->_afterLogin($oUser);
@ -100,7 +100,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
return false;
}
} catch (d3totp_wrongOtpException $oEx) {
$this->d3GetUtilsView()->addErrorToDisplay($oEx, false, false, "", 'd3totplogin');
$this->d3TotpGetUtilsView()->addErrorToDisplay($oEx, false, false, "", 'd3totplogin');
}
return 'd3totplogin';
@ -109,7 +109,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
/**
* @return UtilsView
*/
public function d3GetUtilsView()
public function d3TotpGetUtilsView(): UtilsView
{
return Registry::getUtilsView();
}
@ -117,12 +117,12 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
/**
* @return Utils
*/
public function d3GetUtils()
public function d3TotpGetUtils()
{
return Registry::getUtils();
}
public function cancelTotpLogin()
public function d3TotpCancelTotpLogin()
{
$this->d3TotpClearSessionVariables();
@ -133,7 +133,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
* @param d3totp $totp
* @return bool
*/
public function isNoTotpOrNoLogin($totp)
public function d3TotpIsNoTotpOrNoLogin($totp)
{
return false == Registry::getSession()->getVariable(d3totp::TOTP_SESSION_CURRENTUSER)
|| false == $totp->isActive();
@ -146,7 +146,7 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
* @throws DatabaseConnectionException
* @throws d3totp_wrongOtpException
*/
public function hasValidTotp($sTotp, $totp)
public function d3TotpHasValidTotp($sTotp, $totp)
{
return Registry::getSession()->getVariable(d3totp::TOTP_SESSION_VARNAME) ||
(
@ -156,15 +156,15 @@ class d3_totp_UserComponent extends d3_totp_UserComponent_parent
public function d3TotpClearSessionVariables()
{
$this->d3GetSession()->deleteVariable(d3totp::TOTP_SESSION_CURRENTCLASS);
$this->d3GetSession()->deleteVariable(d3totp::TOTP_SESSION_CURRENTUSER);
$this->d3GetSession()->deleteVariable(d3totp::TOTP_SESSION_NAVFORMPARAMS);
$this->d3TotpGetSession()->deleteVariable(d3totp::TOTP_SESSION_CURRENTCLASS);
$this->d3TotpGetSession()->deleteVariable(d3totp::TOTP_SESSION_CURRENTUSER);
$this->d3TotpGetSession()->deleteVariable(d3totp::TOTP_SESSION_NAVFORMPARAMS);
}
/**
* @return Session
*/
public function d3GetSession()
public function d3TotpGetSession(): Session
{
return Registry::getSession();
}

View File

@ -34,7 +34,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
*/
public function render()
{
$auth = $this->d3GetSession()->getVariable("auth");
$auth = $this->d3TotpGetSession()->getVariable("auth");
$return = parent::render();
@ -43,10 +43,10 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
if ($auth
&& $totp->isActive()
&& !$this->d3GetSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
&& !$this->d3TotpGetSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
) {
// set auth as secured parameter;
$this->d3GetSession()->setVariable("auth", $auth);
$this->d3TotpGetSession()->setVariable("auth", $auth);
$this->addTplParam('request_totp', true);
}
@ -72,7 +72,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
/**
* @return UtilsView
*/
public function d3GetUtilsView()
public function d3TotpGetUtilsView()
{
return Registry::getUtilsView();
}
@ -80,7 +80,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
/**
* @return Session
*/
public function d3GetSession()
public function d3TotpGetSession()
{
return Registry::getSession();
}
@ -100,14 +100,14 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
$return = 'login';
try {
if ($this->isNoTotpOrNoLogin($totp) && $this->hasLoginCredentials()) {
if ($this->d3TotpIsNoTotpOrNoLogin($totp) && $this->hasLoginCredentials()) {
$return = parent::checklogin();
} elseif ($this->hasValidTotp($sTotp, $totp)) {
$this->d3GetSession()->setVariable(d3totp::TOTP_SESSION_VARNAME, $sTotp);
} elseif ($this->d3TotpHasValidTotp($sTotp, $totp)) {
$this->d3TotpGetSession()->setVariable(d3totp::TOTP_SESSION_VARNAME, $sTotp);
$return = "admin_start";
}
} catch (d3totp_wrongOtpException $oEx) {
$this->d3GetUtilsView()->addErrorToDisplay($oEx);
$this->d3TotpGetUtilsView()->addErrorToDisplay($oEx);
}
return $return;
@ -134,9 +134,9 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
* @param d3totp $totp
* @return bool
*/
public function isNoTotpOrNoLogin($totp)
public function d3TotpIsNoTotpOrNoLogin($totp)
{
return false == $this->d3GetSession()->getVariable("auth")
return false == $this->d3TotpGetSession()->getVariable("auth")
|| false == $totp->isActive();
}
@ -153,7 +153,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
* @throws DatabaseConnectionException
* @throws d3totp_wrongOtpException
*/
public function hasValidTotp($sTotp, $totp)
public function d3TotpHasValidTotp($sTotp, $totp)
{
return Registry::getSession()->getVariable(d3totp::TOTP_SESSION_VARNAME) ||
(

View File

@ -25,7 +25,7 @@ class d3_totp_user extends d3_totp_user_parent
{
$return = parent::logout();
$this->d3GetSession()->deleteVariable(d3totp::TOTP_SESSION_VARNAME);
$this->d3TotpGetSession()->deleteVariable(d3totp::TOTP_SESSION_VARNAME);
return $return;
}
@ -41,7 +41,7 @@ class d3_totp_user extends d3_totp_user_parent
/**
* @return Session
*/
public function d3GetSession()
public function d3TotpGetSession()
{
return Registry::getSession();
}

View File

@ -84,14 +84,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
->onlyMethods([
'getUser',
'd3GetTotpObject',
'd3GetSession',
'd3GetUtils',
'd3TotpGetSession',
'd3TotpGetUtils',
])
->getMock();
$oControllerMock->method('getUser')->willReturn($oUser);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetUtils')->willReturn($oUtilsMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetUtils')->willReturn($oUtilsMock);
$_GET['lgn_usr'] = 'username';
@ -147,14 +147,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
->onlyMethods([
'getUser',
'd3GetTotpObject',
'd3GetSession',
'd3GetUtils',
'd3TotpGetSession',
'd3TotpGetUtils',
])
->getMock();
$oControllerMock->method('getUser')->willReturn($oUserMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetUtils')->willReturn($oUtilsMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetUtils')->willReturn($oUtilsMock);
$_GET['lgn_usr'] = 'username';
@ -227,16 +227,16 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
->onlyMethods([
'getUser',
'd3GetTotpObject',
'd3GetSession',
'd3GetUtils',
'd3TotpGetSession',
'd3TotpGetUtils',
'getParent'
])
->getMock();
$oControllerMock->method('getUser')->willReturn($oUserMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('getParent')->willReturn($oParentMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetUtils')->willReturn($oUtilsMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetUtils')->willReturn($oUtilsMock);
$_GET['lgn_usr'] = 'username';
@ -261,7 +261,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpCheckTotpLogin
*/
public function checkTotploginNoTotpLogin()
{
@ -281,29 +281,29 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/** @var UserComponent|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(UserComponent::class)
->onlyMethods([
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'd3GetTotpObject',
'd3GetSession',
'd3TotpGetSession',
])
->getMock();
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(true);
$oControllerMock->expects($this->never())->method('hasValidTotp')->willReturn(false);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(true);
$oControllerMock->expects($this->never())->method('d3TotpHasValidTotp')->willReturn(false);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
$this->assertSame(
'd3totplogin',
$this->callMethod($this->_oController, 'checkTotplogin')
$this->callMethod($this->_oController, 'd3TotpCheckTotpLogin')
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpCheckTotpLogin
*/
public function checkTotploginUnvalidTotp()
{
@ -334,31 +334,31 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/** @var UserComponent|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(UserComponent::class)
->onlyMethods([
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3GetUtilsView',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'd3TotpGetUtilsView',
'd3GetTotpObject',
'd3GetSession',
'd3TotpGetSession',
])
->getMock();
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->expects($this->once())->method('hasValidTotp')->willThrowException($oTotpExceptionMock);
$oControllerMock->method('d3GetUtilsView')->willReturn($oUtilsViewMock);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->expects($this->once())->method('d3TotpHasValidTotp')->willThrowException($oTotpExceptionMock);
$oControllerMock->method('d3TotpGetUtilsView')->willReturn($oUtilsViewMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
$this->assertSame(
'd3totplogin',
$this->callMethod($this->_oController, 'checkTotplogin')
$this->callMethod($this->_oController, 'd3TotpCheckTotpLogin')
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::checkTotplogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpCheckTotpLogin
*/
public function checkTotploginValidTotp()
{
@ -384,19 +384,19 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/** @var UserComponent|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(UserComponent::class)
->onlyMethods([
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3GetUtilsView',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'd3TotpGetUtilsView',
'd3GetTotpObject',
'd3GetSession',
'd3TotpGetSession',
'setLoginStatus'
])
->getMock();
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->expects($this->once())->method('hasValidTotp')->willReturn(true);
$oControllerMock->method('d3GetUtilsView')->willReturn($oUtilsViewMock);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->expects($this->once())->method('d3TotpHasValidTotp')->willReturn(true);
$oControllerMock->method('d3TotpGetUtilsView')->willReturn($oUtilsViewMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->expects($this->once())->method('setLoginStatus')->with(
$this->identicalTo(USER_LOGIN_SUCCESS)
);
@ -404,27 +404,27 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$this->_oController = $oControllerMock;
$this->assertFalse(
$this->callMethod($this->_oController, 'checkTotplogin')
$this->callMethod($this->_oController, 'd3TotpCheckTotpLogin')
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3GetUtilsView
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpGetUtilsView
*/
public function d3GetUtilsViewReturnsRightInstance()
{
$this->assertInstanceOf(
UtilsView::class,
$this->callMethod($this->_oController, 'd3GetUtilsView')
$this->callMethod($this->_oController, 'd3TotpGetUtilsView')
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::cancelTotpLogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpCancelTotpLogin
*/
public function canCancelTotpLogin()
{
@ -436,13 +436,13 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$this->_oController = $oControllerMock;
$this->callMethod($this->_oController, 'cancelTotpLogin');
$this->callMethod($this->_oController, 'd3TotpCancelTotpLogin');
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginTrueNoSessionVariable()
{
@ -456,14 +456,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('isActive')->willReturn(true);
$this->assertTrue(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginTrueTotpNotActive()
{
@ -477,14 +477,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('isActive')->willReturn(false);
$this->assertTrue(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginFalse()
{
@ -498,14 +498,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('isActive')->willReturn(true);
$this->assertFalse(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::hasValidTotp
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpHasValidTotp
*/
public function hasValidTotpTrueSessionVarname()
{
@ -519,14 +519,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(false);
$this->assertTrue(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::hasValidTotp
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpHasValidTotp
*/
public function hasValidTotpTrueValidTotp()
{
@ -540,14 +540,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(true);
$this->assertTrue(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::hasValidTotp
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpHasValidTotp
*/
public function hasValidTotpFalseMissingTotp()
{
@ -561,14 +561,14 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(true);
$this->assertFalse(
$this->callMethod($this->_oController, 'hasValidTotp', [null, $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', [null, $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::hasValidTotp
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpHasValidTotp
*/
public function hasValidTotpFalseUnverifiedTotp()
{
@ -582,7 +582,7 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(false);
$this->assertFalse(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}
@ -601,9 +601,9 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/** @var UserComponent|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(UserComponent::class)
->onlyMethods(['d3GetSession'])
->onlyMethods(['d3TotpGetSession'])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
@ -613,13 +613,13 @@ class d3_totp_UserComponentTest extends d3TotpUnitTestCase
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3GetSession
* @covers \D3\Totp\Modules\Application\Component\d3_totp_UserComponent::d3TotpGetSession
*/
public function d3GetSessionReturnsRightInstance()
{
$this->assertInstanceOf(
Session::class,
$this->callMethod($this->_oController, 'd3GetSession')
$this->callMethod($this->_oController, 'd3TotpGetSession')
);
}
}

View File

@ -80,11 +80,11 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetSession',
'd3TotpGetSession',
'd3GetTotpObject',
])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$this->_oController = $oControllerMock;
@ -125,11 +125,11 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetSession',
'd3TotpGetSession',
'd3GetTotpObject',
])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$this->_oController = $oControllerMock;
@ -170,11 +170,11 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetSession',
'd3TotpGetSession',
'd3GetTotpObject',
])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$this->_oController = $oControllerMock;
@ -215,11 +215,11 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetSession',
'd3TotpGetSession',
'd3GetTotpObject',
])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$this->_oController = $oControllerMock;
@ -257,26 +257,26 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3GetUtilsView
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpGetUtilsView
*/
public function d3GetUtilsViewReturnsRightObject()
{
$this->assertInstanceOf(
UtilsView::class,
$this->callMethod($this->_oController, 'd3GetUtilsView')
$this->callMethod($this->_oController, 'd3TotpGetUtilsView')
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3GetSession
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpGetSession
*/
public function d3GetSessionReturnsRightObject()
{
$this->assertInstanceOf(
Session::class,
$this->callMethod($this->_oController, 'd3GetSession')
$this->callMethod($this->_oController, 'd3TotpGetSession')
);
}
@ -299,14 +299,14 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetTotpObject',
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'hasLoginCredentials',
])
->getMock();
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(true);
$oControllerMock->method('hasValidTotp')->willReturn(false);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(true);
$oControllerMock->method('d3TotpHasValidTotp')->willReturn(false);
$oControllerMock->method('hasLoginCredentials')->willReturn($hasLoginCredentials);
$this->_oController = $oControllerMock;
@ -372,15 +372,15 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetTotpObject',
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3GetUtilsView',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'd3TotpGetUtilsView',
])
->getMock();
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->method('hasValidTotp')->willThrowException($oTotpExceptionMock);
$oControllerMock->method('d3GetUtilsView')->willReturn($utilsViewMock);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->method('d3TotpHasValidTotp')->willThrowException($oTotpExceptionMock);
$oControllerMock->method('d3TotpGetUtilsView')->willReturn($utilsViewMock);
$this->_oController = $oControllerMock;
@ -420,17 +420,17 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods([
'd3GetTotpObject',
'isNoTotpOrNoLogin',
'hasValidTotp',
'd3GetUtilsView',
'd3GetSession',
'd3TotpIsNoTotpOrNoLogin',
'd3TotpHasValidTotp',
'd3TotpGetUtilsView',
'd3TotpGetSession',
])
->getMock();
$oControllerMock->method('d3GetTotpObject')->willReturn($oTotpMock);
$oControllerMock->method('isNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->method('hasValidTotp')->willReturn(true);
$oControllerMock->method('d3GetUtilsView')->willReturn($utilsViewMock);
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpIsNoTotpOrNoLogin')->willReturn(false);
$oControllerMock->method('d3TotpHasValidTotp')->willReturn(true);
$oControllerMock->method('d3TotpGetUtilsView')->willReturn($utilsViewMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
@ -496,7 +496,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginIsAuth()
{
@ -515,21 +515,21 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods(['d3GetSession'])
->onlyMethods(['d3TotpGetSession'])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
$this->assertFalse(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginTotpNotActive()
{
@ -548,21 +548,21 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods(['d3GetSession'])
->onlyMethods(['d3TotpGetSession'])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
$this->assertFalse(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::isNoTotpOrNoLogin
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpIsNoTotpOrNoLogin
*/
public function isNoTotpOrNoLoginPass()
{
@ -581,21 +581,21 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
/** @var d3_totp_LoginController|MockObject $oControllerMock */
$oControllerMock = $this->getMockBuilder(d3_totp_LoginController::class)
->onlyMethods(['d3GetSession'])
->onlyMethods(['d3TotpGetSession'])
->getMock();
$oControllerMock->method('d3GetSession')->willReturn($oSessionMock);
$oControllerMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oController = $oControllerMock;
$this->assertTrue(
$this->callMethod($this->_oController, 'isNoTotpOrNoLogin', [$oTotpMock])
$this->callMethod($this->_oController, 'd3TotpIsNoTotpOrNoLogin', [$oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::hasValidTotp
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpHasValidTotp
*/
public function hasValidTotpTrueSessionVarname()
{
@ -609,14 +609,14 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(false);
$this->assertTrue(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::hasValidTotp
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpHasValidTotp
*/
public function hasValidTotpTrueValidTotp()
{
@ -630,14 +630,14 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(true);
$this->assertTrue(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::hasValidTotp
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpHasValidTotp
*/
public function hasValidTotpFalseMissingTotp()
{
@ -651,14 +651,14 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(true);
$this->assertFalse(
$this->callMethod($this->_oController, 'hasValidTotp', [null, $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', [null, $oTotpMock])
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::hasValidTotp
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpHasValidTotp
*/
public function hasValidTotpFalseUnverifiedTotp()
{
@ -672,7 +672,7 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
$oTotpMock->method('verify')->willReturn(false);
$this->assertFalse(
$this->callMethod($this->_oController, 'hasValidTotp', ['123456', $oTotpMock])
$this->callMethod($this->_oController, 'd3TotpHasValidTotp', ['123456', $oTotpMock])
);
}

View File

@ -58,9 +58,9 @@ class d3_totp_userTest extends d3TotpUnitTestCase
/** @var d3_totp_user|MockObject $oModelMock */
$oModelMock = $this->getMockBuilder(User::class)
->onlyMethods(['d3GetSession'])
->onlyMethods(['d3TotpGetSession'])
->getMock();
$oModelMock->method('d3GetSession')->willReturn($oSessionMock);
$oModelMock->method('d3TotpGetSession')->willReturn($oSessionMock);
$this->_oModel = $oModelMock;
@ -88,13 +88,13 @@ class d3_totp_userTest extends d3TotpUnitTestCase
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Model\d3_totp_user::d3GetSession
* @covers \D3\Totp\Modules\Application\Model\d3_totp_user::d3TotpGetSession
*/
public function d3GetSessionReturnsRightInstance()
{
$this->assertInstanceOf(
Session::class,
$this->callMethod($this->_oModel, 'd3GetSession')
$this->callMethod($this->_oModel, 'd3TotpGetSession')
);
}
}