adjust tests

This commit is contained in:
Daniel Seifert 2022-11-25 20:11:04 +01:00
parent 7a2648fe7b
commit a9a279a753
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
2 changed files with 15 additions and 16 deletions

View File

@ -645,7 +645,7 @@ class d3totpadminloginTest extends d3TotpUnitTestCase
/** /**
* @test * @test
* @throws ReflectionException * @throws ReflectionException
* @covers \D3\Totp\Application\Controller\Admin\d3totpadminlogin::d3GetLoginControllert * @covers \D3\Totp\Application\Controller\Admin\d3totpadminlogin::d3GetLoginController
*/ */
public function d3GetLoginControllerReturnsRightObject() public function d3GetLoginControllerReturnsRightObject()
{ {

View File

@ -173,14 +173,15 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
* @test * @test
* @throws ReflectionException * @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3totpAfterLoginSetLanguage * @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3totpAfterLoginSetLanguage
* @dataProvider canRunTotpAfterLoginSetLanguageDataProvider
*/ */
public function canRunTotpAfterLoginSetLanguage() public function canRunTotpAfterLoginSetLanguage($languageId)
{ {
/** @var Session|MockObject $sessionMock */ /** @var Session|MockObject $sessionMock */
$sessionMock = $this->getMockBuilder(Session::class) $sessionMock = $this->getMockBuilder(Session::class)
->onlyMethods(['getVariable']) ->onlyMethods(['getVariable'])
->getMock(); ->getMock();
$sessionMock->method('getVariable')->willReturn(0); $sessionMock->method('getVariable')->willReturn($languageId);
/** @var UtilsServer|MockObject $utilsServerMock */ /** @var UtilsServer|MockObject $utilsServerMock */
$utilsServerMock = $this->getMockBuilder(UtilsServer::class) $utilsServerMock = $this->getMockBuilder(UtilsServer::class)
@ -208,6 +209,17 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
); );
} }
/**
* @return array
*/
public function canRunTotpAfterLoginSetLanguageDataProvider(): array
{
return [
'existing language' => [0],
'not existing language' => [50],
];
}
/** /**
* @test * @test
* @param $totpActive * @param $totpActive
@ -266,19 +278,6 @@ class d3_totp_LoginControllerTest extends d3TotpUnitTestCase
]; ];
} }
/**
* @test
* @throws ReflectionException
* @covers \D3\Totp\Modules\Application\Controller\Admin\d3_totp_LoginController::d3TotpGetUserObject
*/
public function d3GetUserObjectReturnsRightObject()
{
$this->assertInstanceOf(
User::class,
$this->callMethod($this->_oController, 'd3TotpGetUserObject')
);
}
/** /**
* @test * @test
* @throws ReflectionException * @throws ReflectionException