Skip to content

Commit

Permalink
[TASK] Add or improve type hints and remove obsolete code line
Browse files Browse the repository at this point in the history
  • Loading branch information
tschikarski committed Dec 4, 2017
1 parent a4f8fee commit e00ef59
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion Classes/Controller/LoginLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class LoginLinkController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContro
*
* @return void
*/
//public function showAction(\TrustCnct\Shibboleth\Domain\Model\LoginLink $loginLink)
public function showAction()
{
$this->view->assign('loginLinkUrl', $this->loginUrlService->createUrl());
Expand Down
1 change: 1 addition & 0 deletions Classes/ShibbolethAuthentificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function getUser() {
}
}

/** @var UserHandler $userhandler */
$userhandler = GeneralUtility::makeInstance(UserHandler::class,$this->authInfo['loginType'],
$this->db_user, $this->db_groups, $this->shibSessionIdKey, $this->writeDevLog, $this->envShibPrefix);

Expand Down
1 change: 0 additions & 1 deletion Classes/User/UserHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class UserHandler
function __construct($loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = '') {
global $TYPO3_CONF_VARS;
$this->writeDevLog = ($TYPO3_CONF_VARS['SC_OPTIONS']['shibboleth/lib/class.tx_shibboleth_userhandler.php']['writeMoreDevLog'] AND $writeDevLog);
//if ($this->writeDevLog) GeneralUtility::devlog('constructor','shibboleth_userhandler',0,$TYPO3_CONF_VARS);

$this->shibboleth_extConf = unserialize($TYPO3_CONF_VARS['EXT']['extConf']['shibboleth']);

Expand Down
10 changes: 9 additions & 1 deletion Tests/Functional/User/UserHandlerFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function setUp() {
*/
public function constructorForFrontendCaseTest()
{
/** @var \TrustCnct\Shibboleth\User\UserHandler $userHandler */
/** @var UserHandler $userHandler */
$userHandler = GeneralUtility::makeInstance(UserHandler::class,'FE','fe_users','fe_groups','Shib_Session_ID',false,'');
$this->assertFalse($userHandler->tsfeDetected);
}
Expand All @@ -52,6 +52,7 @@ public function constructorForFrontendCaseTest()
* @test
*/
public function getMappingConfigPathTest() {
/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock('TrustCnct\Shibboleth\User\UserHandler',['getEnvironmentVariable'], ['FE','fe_users','fe_groups','Shib_Session_ID'],'',false);
$userHandler->expects($this->once())->method('getEnvironmentVariable')->will($this->returnValue($_SERVER['TYPO3_PATH_ROOT']));
$loginType = 'FE';
Expand All @@ -67,6 +68,7 @@ public function getMappingConfigPathTest() {
* @test
*/
public function mockGetTyposcriptConfigurationTest() {
/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand All @@ -89,6 +91,7 @@ public function mockGetTyposcriptConfigurationTest() {
* @test
*/
public function typo3IdFieldFromConfigFileTest() {
/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand All @@ -112,6 +115,7 @@ public function typo3IdFieldFromConfigFileTest() {
* @test
*/
public function getUserFromDbReportsErrorOnEmptyIdValue() {
/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand All @@ -137,6 +141,7 @@ public function getUserFromDbReportsErrorOnEmptyIdValue() {
*/
public function getUserFromDbReturnsExistingUser() {

/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand Down Expand Up @@ -166,6 +171,7 @@ public function getUserFromDbReturnsExistingUser() {
*/
public function getUserFromDbCheckingPidReturnsExistingUser() {

/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand Down Expand Up @@ -196,6 +202,7 @@ public function getUserFromDbCheckingPidReturnsExistingUser() {
*/
public function getUserFromDbReturnsNullIfNotExists() {

/** @var UserHandler $userHandler */
$userHandler = $this->getAccessibleMock(\TrustCnct\Shibboleth\User\UserHandler::class,['getEnvironmentVariable'],array(
// $loginType, $db_user, $db_group, $shibSessionIdKey, $writeDevLog = FALSE, $envShibPrefix = ''
'FE',
Expand All @@ -211,6 +218,7 @@ public function getUserFromDbReturnsNullIfNotExists() {
$db_user = 'fe_users';
$db_group = 'fe_groups';
$shibbSessionIdKey = 'Shib_Session_ID';
/** @var UserHandler $userHandler */
$userHandler->_callRef('__construct', $loginType, $this->db_user, $this->db_group, $shibbSessionIdKey);
$userFromDB = $userHandler->getUserFromDB();
$this->assertFalse(is_array($userFromDB),'Did not expect array');
Expand Down

0 comments on commit e00ef59

Please sign in to comment.