TYPO3 CMS  TYPO3_8-7
ContentDataProcessorTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
19 
23 class ContentDataProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
24 {
28  protected $contentDataProcessor = null;
29 
33  protected function setUp()
34  {
35  $this->contentDataProcessor = new ContentDataProcessor();
36  }
37 
42  {
43  $this->expectException(\UnexpectedValueException::class);
44  $this->expectExceptionCode(1427455378);
45  $contentObjectRendererStub = new ContentObjectRenderer();
46  $config = [
47  'dataProcessing.' => [
48  '10' => 'fooClass'
49  ]
50  ];
51  $variables = [];
52  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
53  }
54 
59  {
60  $this->expectException(\UnexpectedValueException::class);
61  $this->expectExceptionCode(1427455377);
62  $contentObjectRendererStub = new ContentObjectRenderer();
63  $config = [
64  'dataProcessing.' => [
65  '10' => get_class($this)
66  ]
67  ];
68  $variables = [];
69  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
70  }
71 
75  public function processorIsCalled()
76  {
77  $contentObjectRendererStub = new ContentObjectRenderer();
78  $config = [
79  'dataProcessing.' => [
80  '10' => DataProcessorFixture::class,
81  '10.' => ['foo' => 'bar'],
82  ]
83  ];
84  $variables = [];
85  $this->assertSame(['foo' => 'bar'], $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables));
86  }
87 }