remove testing tools from productive code
This commit is contained in:
parent
be1f482aba
commit
a0090ab3bb
@ -15,7 +15,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\Totp\Modules\Application\Controller\Admin;
|
||||
|
||||
use D3\TestingTools\Production\IsMockable;
|
||||
use D3\Totp\Application\Model\d3totp;
|
||||
use D3\Totp\Application\Model\d3totp_conf;
|
||||
use OxidEsales\Eshop\Core\Language;
|
||||
@ -25,8 +24,6 @@ use OxidEsales\Eshop\Core\UtilsServer;
|
||||
|
||||
class d3_totp_LoginController extends d3_totp_LoginController_parent
|
||||
{
|
||||
use IsMockable;
|
||||
|
||||
/**
|
||||
* @return d3totp
|
||||
*/
|
||||
@ -57,7 +54,15 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
|
||||
Registry::getRequest()->getRequestEscapedParameter('chlanguage')
|
||||
);
|
||||
|
||||
return $this->d3CallMockableFunction([d3_totp_LoginController_parent::class, 'checklogin']);
|
||||
return $this->parent__checklogin();
|
||||
}
|
||||
|
||||
/**
|
||||
* mockable parent method
|
||||
*/
|
||||
protected function parent__checklogin()
|
||||
{
|
||||
return parent::checklogin();
|
||||
}
|
||||
|
||||
public function d3totpAfterLogin(): void
|
||||
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\Totp\Modules\Application\Controller;
|
||||
|
||||
use D3\TestingTools\Production\IsMockable;
|
||||
use D3\Totp\Application\Model\d3totp;
|
||||
use D3\Totp\Application\Model\d3totp_conf;
|
||||
use Doctrine\DBAL\Driver\Exception;
|
||||
@ -27,8 +26,6 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
trait d3_totp_getUserTrait
|
||||
{
|
||||
use IsMockable;
|
||||
|
||||
/**
|
||||
* @return false|User
|
||||
* @throws ContainerExceptionInterface
|
||||
@ -38,8 +35,7 @@ trait d3_totp_getUserTrait
|
||||
*/
|
||||
public function getUser(): false|User
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = $this->d3CallMockableFunction([$this->parentClass, 'getUser']);
|
||||
$user = parent::getUser();
|
||||
|
||||
if ($user && $user->isLoaded() && $user->getId()) {
|
||||
$totp = $this->d3GetTotpObject();
|
||||
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\Totp\Modules\Core;
|
||||
|
||||
use D3\TestingTools\Production\IsMockable;
|
||||
use D3\Totp\Application\Model\d3totp;
|
||||
use D3\Totp\Application\Model\d3totp_conf;
|
||||
use D3\Totp\Modules\Application\Model\d3_totp_user;
|
||||
@ -30,8 +29,6 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class totpSystemEventHandler extends totpSystemEventHandler_parent
|
||||
{
|
||||
use IsMockable;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
@ -41,9 +38,9 @@ class totpSystemEventHandler extends totpSystemEventHandler_parent
|
||||
*/
|
||||
public function onAdminLogin()
|
||||
{
|
||||
$this->d3RequestTotp();
|
||||
$this->d3requestTotp();
|
||||
|
||||
$this->d3CallMockableFunction([totpSystemEventHandler_parent::class, 'onAdminLogin']);
|
||||
parent::onAdminLogin();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,9 +90,9 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
|
||||
|
||||
/** @var d3_totp_LoginController|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->d3getMockBuilder(d3_totp_LoginController::class)
|
||||
->onlyMethods(['d3CallMockableFunction'])
|
||||
->onlyMethods(['parent__checklogin'])
|
||||
->getMock();
|
||||
$oControllerMock->method('d3CallMockableFunction')->willReturn($fixture);
|
||||
$oControllerMock->method('parent__checklogin')->willReturn($fixture);
|
||||
|
||||
$this->_oController = $oControllerMock;
|
||||
|
||||
|
@ -63,10 +63,11 @@ trait d3_totp_getUserTestTrait
|
||||
{
|
||||
/** @var d3_totp_orderController|d3_totp_UserController|d3_totp_PaymentController|MockObject $oControllerMock */
|
||||
$oControllerMock = $this->d3getMockBuilder($this->sControllerClass)
|
||||
->onlyMethods(['d3GetTotpObject', 'd3CallMockableFunction'])
|
||||
->onlyMethods(['d3GetTotpObject'])
|
||||
->getMock();
|
||||
$oControllerMock->expects($this->never())->method('d3GetTotpObject');
|
||||
$oControllerMock->method('d3CallMockableFunction')->willReturn(false);
|
||||
|
||||
$this->setValue($oControllerMock, '_oActUser', false);
|
||||
|
||||
$this->assertFalse(
|
||||
$this->callMethod($oControllerMock, 'getUser')
|
||||
|
@ -42,10 +42,9 @@ class totpSystemEventHandlerTest extends d3TotpUnitTestCase
|
||||
{
|
||||
/** @var totpSystemEventHandler|MockObject $sut */
|
||||
$sut = $this->d3getMockBuilder(SystemEventHandler::class)
|
||||
->onlyMethods(['d3CallMockableFunction', 'd3requestTotp'])
|
||||
->onlyMethods(['d3requestTotp'])
|
||||
->getMock();
|
||||
|
||||
$sut->method('d3CallMockableFunction')->willReturn(true);
|
||||
$sut->expects($this->once())->method('d3requestTotp');
|
||||
|
||||
$this->callMethod(
|
||||
|
@ -44,12 +44,12 @@
|
||||
"spomky-labs/otphp": "^10.0 || ^11.0",
|
||||
"bacon/bacon-qr-code": "^2.0 || ^3.0",
|
||||
"laminas/laminas-math": "^3.2",
|
||||
"d3/testingtools": "^1.0",
|
||||
"d3/oxidservicebridges": "^2.1.0.0",
|
||||
"beberlei/assert": "^v3.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit" : "^9.6",
|
||||
"d3/testingtools": "^1.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.9",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"boxblinkracer/phpunuhi": "^1.12"
|
||||
|
Loading…
x
Reference in New Issue
Block a user