Skip to content

Commit

Permalink
[TASK] Make IfAuthenticatedViewHelperTest notice free
Browse files Browse the repository at this point in the history
Releases: master
Resolves: #84340
Change-Id: I97b586423513ab7d2dde4660ccfecf542468ab50
Reviewed-on: https://review.typo3.org/56215
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
janhelke authored and lolli42 committed Mar 16, 2018
1 parent fa53b9d commit 91a19b0
Showing 1 changed file with 5 additions and 7 deletions.
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Be\Security;

/*
Expand All @@ -14,6 +15,7 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Fluid\ViewHelpers\Be\Security\IfAuthenticatedViewHelper;
use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;

/**
Expand All @@ -22,20 +24,15 @@
class IfAuthenticatedViewHelperTest extends ViewHelperBaseTestcase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;

/**
* @var \TYPO3\CMS\Fluid\ViewHelpers\Be\Security\IfAuthenticatedViewHelper
* @var IfAuthenticatedViewHelper
*/
protected $viewHelper;

protected function setUp()
{
parent::setUp();
$GLOBALS['BE_USER'] = new \stdClass();
$this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Be\Security\IfAuthenticatedViewHelper::class, ['renderThenChild', 'renderElseChild']);
$this->viewHelper = $this->getAccessibleMock(IfAuthenticatedViewHelper::class, ['renderThenChild', 'renderElseChild']);
$this->viewHelper->expects($this->any())->method('renderThenChild')->will($this->returnValue('then child'));
$this->viewHelper->expects($this->any())->method('renderElseChild')->will($this->returnValue('else child'));
$this->injectDependenciesIntoViewHelper($this->viewHelper);
Expand All @@ -57,6 +54,7 @@ public function viewHelperRendersThenChildIfBeUserIsLoggedIn()
*/
public function viewHelperRendersElseChildIfBeUserIsNotLoggedIn()
{
$GLOBALS['BE_USER']->user = ['uid' => 0];
$actualResult = $this->viewHelper->render();
$this->assertEquals('else child', $actualResult);
}
Expand Down

0 comments on commit 91a19b0

Please sign in to comment.