2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
17 use Prophecy\Prophecy\ObjectProphecy;
20 use TYPO3\CMS\Core\Tests\UnitTestCase;
39 $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
40 $GLOBALS[
'TYPO3_DB'] = $this->dbProphecy->reveal();
56 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438185331);
58 $this->subject->addData($input);
74 $expected[
'recordTypeValue'] =
'1';
75 $this->assertSame($expected, $this->subject->addData($input));
92 $expected[
'recordTypeValue'] =
'0';
94 $this->assertSame($expected, $this->subject->addData($input));
105 'type' =>
'notExists',
116 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438183881);
118 $this->subject->addData($input);
141 $expected[
'recordTypeValue'] =
'3';
143 $this->assertSame($expected, $this->subject->addData($input));
166 $expected[
'recordTypeValue'] =
'0';
168 $this->assertSame($expected, $this->subject->addData($input));
191 $expected[
'recordTypeValue'] =
'0';
193 $this->assertSame($expected, $this->subject->addData($input));
215 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438185437);
217 $this->subject->addData($input);
228 'languageField' =>
'sys_language_uid',
233 'l10n_mode' =>
'exclude',
241 'sys_language_uid' => 2,
244 'defaultLanguageRow' => [
250 $expected[
'recordTypeValue'] =
'3';
252 $this->assertSame($expected, $this->subject->addData($input));
263 'languageField' =>
'sys_language_uid',
268 'l10n_mode' =>
'mergeIfNotBlank',
276 'sys_language_uid' => 2,
279 'defaultLanguageRow' => [
285 $expected[
'recordTypeValue'] =
'3';
287 $this->assertSame($expected, $this->subject->addData($input));
298 'languageField' =>
'sys_language_uid',
303 'l10n_mode' =>
'mergeIfNotBlank',
311 'sys_language_uid' => 2,
314 'defaultLanguageRow' => [
320 $expected[
'recordTypeValue'] =
'3';
322 $this->assertSame($expected, $this->subject->addData($input));
333 'type' =>
'localField:foreignField',
348 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1325862241);
350 $this->subject->addData($input);
361 'type' =>
'localField:foreignField',
379 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438253614);
381 $this->subject->addData($input);
392 'type' =>
'localField:foreignField',
398 'foreign_table' =>
'foreignTable',
412 $foreignRecordResult = [
416 $GLOBALS[
'TCA'][
'foreignTable'] = array(
'foo');
418 $this->dbProphecy->exec_SELECTgetSingleRow(
'foreignField',
'foreignTable',
'uid=42')->shouldBeCalled()->willReturn($foreignRecordResult);
421 $expected[
'recordTypeValue'] =
'3';
423 $this->assertSame($expected, $this->subject->addData($input));
435 'type' =>
'uid_local:type',
441 'internal_type' =>
'db',
445 'allowed' =>
'sys_file'
455 'uid_local' =>
'sys_file_222|my_test.jpg',
459 $foreignRecordResult = [
463 $GLOBALS[
'TCA'][
'sys_file'] = array(
'foo');
465 $this->dbProphecy->exec_SELECTgetSingleRow(
'type',
'sys_file',
'uid=222')->shouldBeCalled()->willReturn($foreignRecordResult);
468 $expected[
'recordTypeValue'] =
'2';
470 $this->assertSame($expected, $this->subject->addData($input));