‪TYPO3CMS  10.4
ContentDataProcessorTest.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪ContentDataProcessorTest extends UnitTestCase
29 {
33  protected ‪$contentDataProcessor;
34 
38  protected function ‪setUp(): void
39  {
40  parent::setUp();
41  $this->contentDataProcessor = new ‪ContentDataProcessor();
42  }
43 
48  {
49  $this->expectException(\UnexpectedValueException::class);
50  $this->expectExceptionCode(1427455378);
51  $contentObjectRendererStub = new ‪ContentObjectRenderer();
52  $config = [
53  'dataProcessing.' => [
54  '10' => 'fooClass'
55  ]
56  ];
57  $variables = [];
58  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
59  }
60 
65  {
66  $this->expectException(\UnexpectedValueException::class);
67  $this->expectExceptionCode(1427455377);
68  $contentObjectRendererStub = new ‪ContentObjectRenderer();
69  $config = [
70  'dataProcessing.' => [
71  '10' => static::class
72  ]
73  ];
74  $variables = [];
75  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
76  }
77 
81  public function ‪processorIsCalled(): void
82  {
83  $contentObjectRendererStub = new ‪ContentObjectRenderer();
84  $config = [
85  'dataProcessing.' => [
86  '10' => DataProcessorFixture::class,
87  '10.' => ['foo' => 'bar'],
88  ]
89  ];
90  $variables = [];
91  self::assertSame(
92  ['foo' => 'bar'],
93  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables)
94  );
95  }
96 }
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Fixtures\DataProcessorFixture
Definition: DataProcessorFixture.php:25
‪TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor
Definition: ContentDataProcessor.php:25
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\throwsExceptionIfProcessorClassDoesNotExist
‪throwsExceptionIfProcessorClassDoesNotExist()
Definition: ContentDataProcessorTest.php:46
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\throwsExceptionIfProcessorClassDoesNotImplementInterface
‪throwsExceptionIfProcessorClassDoesNotImplementInterface()
Definition: ContentDataProcessorTest.php:63
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\$contentDataProcessor
‪ContentDataProcessor $contentDataProcessor
Definition: ContentDataProcessorTest.php:32
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\setUp
‪setUp()
Definition: ContentDataProcessorTest.php:37
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject
Definition: CaseContentObjectTest.php:18
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\processorIsCalled
‪processorIsCalled()
Definition: ContentDataProcessorTest.php:80
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest
Definition: ContentDataProcessorTest.php:29