TYPO3 CMS  TYPO3_8-7
ServicesListReportTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
25 
29 class ServicesListReportTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
30 {
34  protected $subject;
35 
39  public function setUp()
40  {
41  $GLOBALS['LANG'] = $this->languageServiceProphecy()->reveal();
42  $this->subject = new ServicesListReport(
43  $this->reportControllerProphecy()->reveal()
44  );
45  }
46 
51  {
52  $standaloneViewProphecy = $this->standaloneViewProphecy();
53 
54  $this->subject->getReport();
55 
56  $standaloneViewProphecy
57  ->assignMultiple(Argument::withEntry('servicesList', []))
58  ->shouldHaveBeenCalled();
59  $standaloneViewProphecy
60  ->assignMultiple(Argument::withKey('searchPaths'))
61  ->shouldHaveBeenCalled();
62  }
63 
68  private function standaloneViewProphecy(): ObjectProphecy
69  {
70  $templatePath = GeneralUtility::getFileAbsFileName(
71  'EXT:sv/Resources/Private/Templates/ServicesListReport.html'
72  );
73  $standaloneViewProphecy = $this->prophesize(StandaloneView::class);
74  $standaloneViewProphecy->setTemplatePathAndFilename($templatePath)->shouldBeCalled();
75  $standaloneViewProphecy->assignMultiple(Argument::any())->willReturn($standaloneViewProphecy->reveal());
76  $standaloneViewProphecy->render()->willReturn('<p>Template output</p>');
77  GeneralUtility::addInstance(StandaloneView::class, $standaloneViewProphecy->reveal());
78 
79  return $standaloneViewProphecy;
80  }
81 
85  private function languageServiceProphecy(): ObjectProphecy
86  {
87  $languageServiceProphecy = $this->prophesize(LanguageService::class);
88  $languageServiceProphecy
89  ->includeLLFile('EXT:sv/Resources/Private/Language/locallang.xlf')
90  ->willReturn(null)
91  ->shouldBeCalled();
92  $languageServiceProphecy->getLL(Argument::any())->willReturn('translation string');
93  return $languageServiceProphecy;
94  }
95 
99  private function reportControllerProphecy(): ObjectProphecy
100  {
101  $reportControllerProphecy = $this->prophesize(ReportController::class);
102  return $reportControllerProphecy;
103  }
104 }
static addInstance($className, $instance)
static getFileAbsFileName($filename, $_=null, $_2=null)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']