TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ContentDataProcessorTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject;
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  */
20 
25 {
29  protected $contentDataProcessor = null;
30 
34  protected function setUp()
35  {
36  $this->contentDataProcessor = new ContentDataProcessor();
37  }
38 
43  {
44  $this->expectException(\UnexpectedValueException::class);
45  $this->expectExceptionCode(1427455378);
46  $contentObjectRendererStub = new ContentObjectRenderer();
47  $config = [
48  'dataProcessing.' => [
49  '10' => 'fooClass'
50  ]
51  ];
52  $variables = [];
53  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
54  }
55 
60  {
61  $this->expectException(\UnexpectedValueException::class);
62  $this->expectExceptionCode(1427455377);
63  $contentObjectRendererStub = new ContentObjectRenderer();
64  $config = [
65  'dataProcessing.' => [
66  '10' => get_class($this)
67  ]
68  ];
69  $variables = [];
70  $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables);
71  }
72 
76  public function processorIsCalled()
77  {
78  $contentObjectRendererStub = new ContentObjectRenderer();
79  $config = [
80  'dataProcessing.' => [
81  '10' => DataProcessorFixture::class,
82  '10.' => ['foo' => 'bar'],
83  ]
84  ];
85  $variables = [];
86  $this->assertSame(['foo' => 'bar'], $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables));
87  }
88 }