‪TYPO3CMS  11.5
CropViewHelperTest.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
21 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
22 
23 class ‪CropViewHelperTest extends FunctionalTestCase
24 {
28  protected ‪$initializeDatabase = false;
29 
30  public function ‪renderConvertsAValueDataProvider(): array
31  {
32  return [
33  'simple html crop' => [
34  '<f:format.crop maxCharacters="10">Crop this content</f:format.crop>',
35  'Crop this&hellip;',
36  ],
37  'simple html crop with html' => [
38  '<f:format.crop maxCharacters="10"><p>Crop</p> this content</f:format.crop>',
39  '<p>Crop</p> this&hellip;',
40  ],
41  'custom suffix' => [
42  '<f:format.crop maxCharacters="10" append="custom suffix">Crop this content</f:format.crop>',
43  'Crop thiscustom suffix',
44  ],
45  'disabled respectWordBoundaries' => [
46  '<f:format.crop maxCharacters="7" respectWordBoundaries="false">Crop this content</f:format.crop>',
47  'Crop th&hellip;',
48  ],
49  'do not respect html' => [
50  '<f:format.crop maxCharacters="7" respectHtml="false" append="..."><p>Crop</p> this content</f:format.crop>',
51  '<p>Crop...',
52  ],
53  ];
54  }
55 
60  public function ‪renderConvertsAValue(string $src, string $expected): void
61  {
62  $view = new ‪StandaloneView();
63  $view->setTemplateSource($src);
64  self::assertSame($expected, $view->render());
65  }
66 }
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\CropViewHelperTest\renderConvertsAValueDataProvider
‪renderConvertsAValueDataProvider()
Definition: CropViewHelperTest.php:29
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format
Definition: BytesViewHelperTest.php:18
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\CropViewHelperTest\renderConvertsAValue
‪renderConvertsAValue(string $src, string $expected)
Definition: CropViewHelperTest.php:59
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\CropViewHelperTest\$initializeDatabase
‪bool $initializeDatabase
Definition: CropViewHelperTest.php:27
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Format\CropViewHelperTest
Definition: CropViewHelperTest.php:24
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:31