17 use Prophecy\Prophecy\ObjectProphecy;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 'tableName' =>
'aTable',
51 unset($expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder']);
62 'tableName' =>
'aTable',
69 'placeholder' =>
'aPlaceholder',
87 'tableName' =>
'aTable',
89 'anotherField' =>
'anotherPlaceholder'
96 'placeholder' =>
'__row|anotherField',
104 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] =
'anotherPlaceholder';
115 'tableName' =>
'aTable',
118 'aRelationField' => [
'42'],
125 'placeholder' =>
'__row|aRelationField|aForeignField',
128 'aRelationField' => [
131 'foreign_table' =>
'aForeignTable'
138 $aForeignTableInput = [
139 'tableName' =>
'aForeignTable',
141 'aForeignField' =>
'aForeignValue',
155 $formDataCompilerProphecy = $this->prophesize(FormDataCompiler::class);
156 GeneralUtility::addInstance(FormDataCompiler::class, $formDataCompilerProphecy->reveal());
157 $formDataCompilerProphecy->compile([
160 'tableName' =>
'aForeignTable',
161 'inlineCompileExistingChildren' =>
false,
162 'columnsToProcess' => [
'aForeignField']
165 ->willReturn($aForeignTableInput);
168 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] = $aForeignTableInput[
'databaseRow'][
'aForeignField'];
179 'tableName' =>
'aTable',
182 'aRelationField' => [],
189 'placeholder' =>
'__row|aRelationField|aForeignField',
192 'aRelationField' => [
195 'foreign_table' =>
'aForeignTable'
203 unset($expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder']);
214 'tableName' =>
'aTable',
220 'table' =>
'sys_file',
224 'table' =>
'sys_file',
233 'placeholder' =>
'__row|uid_local|sha1',
239 'internal_type' =>
'db',
240 'allowed' =>
'sys_file'
247 $sysFileProphecyResult = [
248 'tableName' =>
'sys_file',
250 'sha1' =>
'aSha1Value',
264 $formDataCompilerProphecy = $this->prophesize(FormDataCompiler::class);
265 GeneralUtility::addInstance(FormDataCompiler::class, $formDataCompilerProphecy->reveal());
266 $formDataCompilerProphecy->compile([
269 'tableName' =>
'sys_file',
270 'inlineCompileExistingChildren' =>
false,
271 'columnsToProcess' => [
'sha1']
274 ->willReturn($sysFileProphecyResult);
277 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] = $sysFileProphecyResult[
'databaseRow'][
'sha1'];
288 'tableName' =>
'aTable',
298 'placeholder' =>
'__row|metadata|title',
305 'foreign_table' =>
'sys_file_metadata',
306 'foreign_field' =>
'file',
313 $sysFileMetadataProphecyResult = [
314 'tableName' =>
'sys_file_metadata',
330 $formDataCompilerProphecy = $this->prophesize(FormDataCompiler::class);
331 GeneralUtility::addInstance(FormDataCompiler::class, $formDataCompilerProphecy->reveal());
332 $formDataCompilerProphecy->compile([
335 'tableName' =>
'sys_file_metadata',
336 'inlineCompileExistingChildren' =>
false,
337 'columnsToProcess' => [
'title']
340 ->willReturn($sysFileMetadataProphecyResult);
343 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] = $sysFileMetadataProphecyResult[
'databaseRow'][
'title'];
354 'tableName' =>
'aTable',
360 'table' =>
'sys_file',
364 'table' =>
'sys_file',
373 'placeholder' =>
'__row|uid_local|metadata|title',
379 'internal_type' =>
'db',
380 'allowed' =>
'sys_file'
387 $sysFileProphecyResult = [
388 'tableName' =>
'sys_file',
398 'foreign_table' =>
'sys_file_metadata',
399 'foreign_field' =>
'file',
406 $sysFileMetadataProphecyResult = [
407 'tableName' =>
'sys_file_metadata',
422 $sysFileFormDataCompilerProphecy = $this->prophesize(FormDataCompiler::class);
423 GeneralUtility::addInstance(FormDataCompiler::class, $sysFileFormDataCompilerProphecy->reveal());
424 $sysFileFormDataCompilerProphecy->compile([
427 'tableName' =>
'sys_file',
428 'inlineCompileExistingChildren' =>
false,
429 'columnsToProcess' => [
'metadata']
432 ->willReturn($sysFileProphecyResult);
434 $sysFileMetaDataFormDataCompilerProphecy = $this->prophesize(FormDataCompiler::class);
435 GeneralUtility::addInstance(FormDataCompiler::class, $sysFileMetaDataFormDataCompilerProphecy->reveal());
436 $sysFileMetaDataFormDataCompilerProphecy->compile([
439 'tableName' =>
'sys_file_metadata',
440 'inlineCompileExistingChildren' =>
false,
441 'columnsToProcess' => [
'title']
444 ->willReturn($sysFileMetadataProphecyResult);
447 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] = $sysFileMetadataProphecyResult[
'databaseRow'][
'title'];
457 $labelString =
'LLL:EXT:some_ext/Resources/Private/Language/locallang.xlf:my_placeholder';
458 $localizedString =
'My Placeholder';
460 'tableName' =>
'aTable',
467 'placeholder' => $labelString,
474 $expected[
'processedTca'][
'columns'][
'aField'][
'config'][
'placeholder'] = $localizedString;
477 $languageService = $this->prophesize(LanguageService::class);
478 $GLOBALS[
'LANG'] = $languageService->reveal();
479 $languageService->sL($labelString)->shouldBeCalled()->willReturn($localizedString);