mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-25 13:56:09 +01:00
TASK: Finish TYPO3 CMS 8 update
This commit is contained in:
parent
cf902dde83
commit
d61a86f8fe
6 changed files with 20 additions and 19 deletions
|
@ -20,9 +20,6 @@ namespace Codappix\SearchCore\Database\Doctrine;
|
|||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Where
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -73,13 +73,16 @@ class RelationResolver implements Singleton
|
|||
*/
|
||||
protected function resolveValue($value, array $tcaColumn)
|
||||
{
|
||||
if ($value === '' || $value === '0') {
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($tcaColumn['type'] === 'select' || $tcaColumn['type'] === 'group') {
|
||||
if ($tcaColumn['type'] === 'select') {
|
||||
return $this->resolveForeignDbValue($value);
|
||||
}
|
||||
if ($tcaColumn['type'] === 'inline' || $tcaColumn['type'] === 'group') {
|
||||
return $this->resolveInlineValue($value);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -108,4 +111,9 @@ class RelationResolver implements Singleton
|
|||
}
|
||||
return array_map('trim', explode(';', $value));
|
||||
}
|
||||
|
||||
protected function resolveInlineValue(string $value) : array
|
||||
{
|
||||
return array_map('trim', explode(',', $value));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase
|
|||
->setMethods(['add', 'update', 'delete'])
|
||||
->getMock();
|
||||
|
||||
// This way TYPO3 will use our mock instead of a new instance.
|
||||
$GLOBALS['T3_VAR']['getUserObj']['&' . DataHandlerHook::class] = new DataHandlerHook($this->subject);
|
||||
GeneralUtility::setSingletonInstance(\Codappix\SearchCore\Hook\DataHandler::class, new DataHandlerHook($this->subject));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
|||
*/
|
||||
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'));
|
||||
|
||||
$tce = GeneralUtility::makeInstance(Typo3DataHandler::class);
|
||||
|
@ -71,9 +72,9 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
|||
->with(
|
||||
$this->equalTo('tt_content'),
|
||||
$this->callback(function ($record) {
|
||||
return isset($record['uid']) && $record['uid'] === '1'
|
||||
&& isset($record['pid']) && $record['pid'] === '1'
|
||||
&& isset($record['colPos']) && $record['colPos'] === '1'
|
||||
return isset($record['uid']) && $record['uid'] === 1
|
||||
&& isset($record['pid']) && $record['pid'] === 1
|
||||
&& isset($record['colPos']) && $record['colPos'] === 1
|
||||
;
|
||||
})
|
||||
);
|
||||
|
@ -99,7 +100,7 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
|
|||
->with(
|
||||
$this->equalTo('tt_content'),
|
||||
$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['header']) && $record['header'] === 'a new record'
|
||||
;
|
||||
|
|
|
@ -37,10 +37,6 @@ class RelationResolverTest extends AbstractFunctionalTestCase
|
|||
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
|
||||
$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);
|
||||
$record = BackendUtility::getRecord($table, 1);
|
||||
$subject->prepareRecord($record);
|
||||
|
@ -113,8 +109,8 @@ class RelationResolverTest extends AbstractFunctionalTestCase
|
|||
|
||||
$this->assertEquals(
|
||||
[
|
||||
'Category 1',
|
||||
'Category 2',
|
||||
'Category 1',
|
||||
],
|
||||
$record['categories'],
|
||||
'Foreign mm select relation was not resolved as expected.'
|
||||
|
|
|
@ -16,10 +16,10 @@ call_user_func(
|
|||
],
|
||||
't3lib/class.t3lib_tcemain.php' => [
|
||||
'processCmdmapClass' => [
|
||||
$extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class,
|
||||
$extensionKey => \Codappix\SearchCore\Hook\DataHandler::class,
|
||||
],
|
||||
'processDatamapClass' => [
|
||||
$extensionKey => '&' . \Codappix\SearchCore\Hook\DataHandler::class,
|
||||
$extensionKey => \Codappix\SearchCore\Hook\DataHandler::class,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue