‪TYPO3CMS  9.5
ContentDataProcessorTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪ContentDataProcessorTest extends UnitTestCase
27 {
31  protected ‪$contentDataProcessor;
32 
36  protected function ‪setUp(): void
37  {
38  $this->contentDataProcessor = new ‪ContentDataProcessor();
39  }
40 
45  {
46  $this->expectException(\UnexpectedValueException::class);
47  $this->expectExceptionCode(1427455378);
48  $contentObjectRendererStub = new ‪ContentObjectRenderer();
49  $config = [
50  'dataProcessing.' => [
51  '10' => 'fooClass'
52  ]
53  ];
54  $variables = [];
55  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
56  }
57 
62  {
63  $this->expectException(\UnexpectedValueException::class);
64  $this->expectExceptionCode(1427455377);
65  $contentObjectRendererStub = new ‪ContentObjectRenderer();
66  $config = [
67  'dataProcessing.' => [
68  '10' => static::class
69  ]
70  ];
71  $variables = [];
72  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
73  }
74 
78  public function ‪processorIsCalled(): void
79  {
80  $contentObjectRendererStub = new ‪ContentObjectRenderer();
81  $config = [
82  'dataProcessing.' => [
83  '10' => DataProcessorFixture::class,
84  '10.' => ['foo' => 'bar'],
85  ]
86  ];
87  $variables = [];
88  $this->assertSame(
89  ['foo' => 'bar'],
90  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables)
91  );
92  }
93 }
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Fixtures\DataProcessorFixture
Definition: DataProcessorFixture.php:23
‪TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor
Definition: ContentDataProcessor.php:24
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\throwsExceptionIfProcessorClassDoesNotExist
‪throwsExceptionIfProcessorClassDoesNotExist()
Definition: ContentDataProcessorTest.php:43
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\throwsExceptionIfProcessorClassDoesNotImplementInterface
‪throwsExceptionIfProcessorClassDoesNotImplementInterface()
Definition: ContentDataProcessorTest.php:60
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\$contentDataProcessor
‪ContentDataProcessor $contentDataProcessor
Definition: ContentDataProcessorTest.php:30
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\setUp
‪setUp()
Definition: ContentDataProcessorTest.php:35
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject
Definition: CaseContentObjectTest.php:4
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest\processorIsCalled
‪processorIsCalled()
Definition: ContentDataProcessorTest.php:77
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:91
‪TYPO3\CMS\Frontend\Tests\Unit\ContentObject\ContentDataProcessorTest
Definition: ContentDataProcessorTest.php:27