for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Derhansen\FeChangePwd\Tests\Unit\Service;
/*
* This file is part of the Extension "fe_change_pwd" for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
use Derhansen\FeChangePwd\Service\FrontendUserService;
use Nimut\TestingFramework\TestCase\UnitTestCase;
/**
* Class FrontendUserServiceTest
class FrontendUserServiceTest extends UnitTestCase
{
* @return array
public function mustChangePasswordReturnsExpectedResultDataProvider()
return [
'no frontend user' => [
[],
false
],
'must change password' => [
[
'must_change_password' => 1,
'password_expiry_date' => 0
true
'password expired' => [
'must_change_password' => 0,
'password_expiry_date' => 1538194307
'password not expired and no password change required' => [
];
}
* @test
* @dataProvider mustChangePasswordReturnsExpectedResultDataProvider
public function mustChangePasswordReturnsExpectedResult($feUserRecord, $expected)
$service = new FrontendUserService();
$GLOBALS['TSFE'] = new \stdClass();
$GLOBALS['TSFE']->fe_user = new \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication();
$this->assertEquals($expected, $service->mustChangePassword($feUserRecord));