TASK: Finish TYPO3 CMS 8 update

This commit is contained in:
Daniel Siepmann 2017-07-07 16:14:41 +02:00
parent cf902dde83
commit d61a86f8fe
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
6 changed files with 20 additions and 19 deletions

View file

@ -20,9 +20,6 @@ namespace Codappix\SearchCore\Database\Doctrine;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
/**
*
*/
class Where class Where
{ {
/** /**

View file

@ -73,13 +73,16 @@ class RelationResolver implements Singleton
*/ */
protected function resolveValue($value, array $tcaColumn) protected function resolveValue($value, array $tcaColumn)
{ {
if ($value === '' || $value === '0') { if ($value === '') {
return ''; return '';
} }
if ($tcaColumn['type'] === 'select' || $tcaColumn['type'] === 'group') { if ($tcaColumn['type'] === 'select') {
return $this->resolveForeignDbValue($value); return $this->resolveForeignDbValue($value);
} }
if ($tcaColumn['type'] === 'inline' || $tcaColumn['type'] === 'group') {
return $this->resolveInlineValue($value);
}
return ''; return '';
} }
@ -108,4 +111,9 @@ class RelationResolver implements Singleton
} }
return array_map('trim', explode(';', $value)); return array_map('trim', explode(';', $value));
} }
protected function resolveInlineValue(string $value) : array
{
return array_map('trim', explode(',', $value));
}
} }

View file

@ -50,7 +50,6 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase
->setMethods(['add', 'update', 'delete']) ->setMethods(['add', 'update', 'delete'])
->getMock(); ->getMock();
// This way TYPO3 will use our mock instead of a new instance. GeneralUtility::setSingletonInstance(\Codappix\SearchCore\Hook\DataHandler::class, new DataHandlerHook($this->subject));
$GLOBALS['T3_VAR']['getUserObj']['&' . DataHandlerHook::class] = new DataHandlerHook($this->subject);
} }
} }

View file

@ -47,7 +47,8 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
*/ */
public function deletionWillBeTriggeredForTtContent() public function deletionWillBeTriggeredForTtContent()
{ {
$this->subject->expects($this->exactly(1))->method('delete') $this->subject->expects($this->exactly(1))
->method('delete')
->with($this->equalTo('tt_content'), $this->equalTo('1')); ->with($this->equalTo('tt_content'), $this->equalTo('1'));
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class); $tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
@ -71,9 +72,9 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
->with( ->with(
$this->equalTo('tt_content'), $this->equalTo('tt_content'),
$this->callback(function ($record) { $this->callback(function ($record) {
return isset($record['uid']) && $record['uid'] === '1' return isset($record['uid']) && $record['uid'] === 1
&& isset($record['pid']) && $record['pid'] === '1' && isset($record['pid']) && $record['pid'] === 1
&& isset($record['colPos']) && $record['colPos'] === '1' && isset($record['colPos']) && $record['colPos'] === 1
; ;
}) })
); );
@ -99,7 +100,7 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
->with( ->with(
$this->equalTo('tt_content'), $this->equalTo('tt_content'),
$this->callback(function ($record) { $this->callback(function ($record) {
return isset($record['uid']) && $record['uid'] === 2 return isset($record['uid']) && $record['uid'] === '2'
&& isset($record['pid']) && $record['pid'] === 1 && isset($record['pid']) && $record['pid'] === 1
&& isset($record['header']) && $record['header'] === 'a new record' && isset($record['header']) && $record['header'] === 'a new record'
; ;

View file

@ -37,10 +37,6 @@ class RelationResolverTest extends AbstractFunctionalTestCase
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$table = 'sys_file'; $table = 'sys_file';
// Only by adding the field to showitem, it will be processed by FormEngine.
// We use this field to test inline relations, as there is only one alternative.
$GLOBALS['TCA']['sys_file']['types'][1]['showitem'] .= ',metadata';
$subject = $objectManager->get(TcaTableService::class, $table); $subject = $objectManager->get(TcaTableService::class, $table);
$record = BackendUtility::getRecord($table, 1); $record = BackendUtility::getRecord($table, 1);
$subject->prepareRecord($record); $subject->prepareRecord($record);
@ -113,8 +109,8 @@ class RelationResolverTest extends AbstractFunctionalTestCase
$this->assertEquals( $this->assertEquals(
[ [
'Category 1',
'Category 2', 'Category 2',
'Category 1',
], ],
$record['categories'], $record['categories'],
'Foreign mm select relation was not resolved as expected.' 'Foreign mm select relation was not resolved as expected.'

View file

@ -16,10 +16,10 @@ call_user_func(
], ],
't3lib/class.t3lib_tcemain.php' => [ 't3lib/class.t3lib_tcemain.php' => [
'processCmdmapClass' => [ 'processCmdmapClass' => [
$extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class, $extensionKey => \Codappix\SearchCore\Hook\DataHandler::class,
], ],
'processDatamapClass' => [ 'processDatamapClass' => [
$extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class, $extensionKey => \Codappix\SearchCore\Hook\DataHandler::class,
], ],
], ],
], ],