Skip to content

Commit

Permalink
[TASK] Add a test case for UncacheContentObject
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Jan 26, 2023
1 parent 71db290 commit db54b37
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Tests/Unit/View/UncacheContentObjectTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace FluidTYPO3\Vhs\Tests\Unit\View;

/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/

use FluidTYPO3\Vhs\Tests\Unit\AbstractTestCase;
use FluidTYPO3\Vhs\View\UncacheContentObject;
use FluidTYPO3\Vhs\View\UncacheTemplateView;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

class UncacheContentObjectTest extends AbstractTestCase
{
public function testDelegatesToUncacheTemplateView(): void
{
$uncacheTemplateView = $this->getMockBuilder(UncacheTemplateView::class)
->setMethods(['callUserFunction'])
->disableOriginalConstructor()
->getMock();
$uncacheTemplateView->method('callUserFunction')->willReturn('rendered');
GeneralUtility::addInstance(UncacheTemplateView::class, $uncacheTemplateView);

$subject = new UncacheContentObject(
$this->getMockBuilder(ContentObjectRenderer::class)->disableOriginalConstructor()->getMock()
);
self::assertSame('rendered', $subject->render([]));
}
}

0 comments on commit db54b37

Please sign in to comment.