Passed
Pull Request — master (#123)
by
unknown
04:41
created

pageRendererCallsAddJsFooterInlineCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 18
rs 9.9332
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Tests\Unit\ViewHelpers;
14
15
use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
16
use TYPO3\CMS\Core\Page\PageRenderer;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
use TYPO3\CMS\Fluid\View\StandaloneView;
19
20
/**
21
 * @covers JsFooterViewHelper
22
 */
23
class JsFooterViewHelperTest extends FunctionalTestCase
24
{
25
    /**
26
     * @var bool Speed up this test case, it needs no database
27
     */
28
    protected $initializeDatabase = false;
29
30
    /**
31
     * @test
32
     */
33
    public function pageRendererCallsAddJsFooterInlineCode(): void
34
    {
35
        $pageRendererProphecy = $this->getMockBuilder(PageRenderer::class)->getMock();
36
37
        $pageRendererProphecy->expects(self::once())->method('addJsFooterInlineCode')->with(
38
            'js-dlf-inline-footer', '$(document).ready(function() {});'
39
        );
40
41
        GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRendererProphecy);
42
43
        $view = new StandaloneView();
44
        $view->setTemplateSource(
45
            '<html xmlns:kitodo="http://typo3.org/ns/Kitodo/Dlf/ViewHelpers">
46
                <kitodo:jsFooter inlineCode="$(document).ready(function() {});" />
47
            </html>'
48
        );
49
50
        $view->render();
51
    }
52
}
53