2 declare(strict_types = 1);
46 protected function setUp()
51 $this->backendUser->workspace = 0;
53 $this->hookFixture = GeneralUtility::makeInstance(HookFixture::class);
54 $this->hookFixture->purge();
55 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tcemain.php'][
'processDatamapClass'][__CLASS__] = HookFixture::class;
56 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tcemain.php'][
'processCmdmapClass'][__CLASS__] = HookFixture::class;
63 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tcemain.php'][
'processDatamapClass'][__CLASS__]);
64 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tcemain.php'][
'processCmdmapClass'][__CLASS__]);
65 unset($this->hookFixture);
73 $newTableIds = $this->actionService->createNewRecord(
76 [
'header' =>
'Testing #1']
81 'processDatamap_beforeStart',
82 'processDatamap_afterAllOperations'
86 'processDatamap_preProcessFieldArray',
87 'processDatamap_postProcessFieldArray',
88 'processDatamap_afterDatabaseOperations',
91 'table' => self::TABLE_Content,
92 'fieldArray' => [
'header' =>
'Testing #1',
'pid' => self::VALUE_PageId ]
102 $this->actionService->modifyRecord(
104 self::VALUE_ContentId,
105 [
'header' =>
'Testing #1']
109 'processDatamap_beforeStart',
110 'processDatamap_afterAllOperations'
114 'processDatamap_preProcessFieldArray',
115 'processDatamap_postProcessFieldArray',
116 'processDatamap_afterDatabaseOperations',
119 'table' => self::TABLE_Content,
120 'fieldArray' => [
'header' =>
'Testing #1' ]
134 $this->actionService->modifyRecords(
137 self::TABLE_Content => [
138 'uid' => $contentNewId,
139 'header' =>
'Testing #1',
140 self::FIELD_ContentHotel => $hotelNewId,
141 self::FIELD_Categories => $categoryNewId,
143 self::TABLE_Hotel => [
144 'uid' => $hotelNewId,
145 'title' =>
'Hotel #1',
147 self::TABLE_Category => [
148 'uid' => $categoryNewId,
149 'title' =>
'Category #1',
155 'processDatamap_beforeStart',
156 'processDatamap_afterAllOperations'
160 'processDatamap_preProcessFieldArray',
163 'table' => self::TABLE_Content,
165 'header' =>
'Testing #1',
166 self::FIELD_ContentHotel => $hotelNewId,
167 self::FIELD_Categories => $categoryNewId,
171 'table' => self::TABLE_Hotel,
172 'fieldArray' => [
'title' =>
'Hotel #1' ],
175 'table' => self::TABLE_Category,
176 'fieldArray' => [
'title' =>
'Category #1' ],
182 'processDatamap_postProcessFieldArray',
185 'table' => self::TABLE_Content,
186 'fieldArray' => [
'header' =>
'Testing #1' ],
189 'table' => self::TABLE_Hotel,
190 'fieldArray' => [
'title' =>
'Hotel #1' ],
193 'table' => self::TABLE_Category,
194 'fieldArray' => [
'title' =>
'Category #1' ],
200 'processDatamap_afterDatabaseOperations',
203 'table' => self::TABLE_Content,
205 'header' =>
'Testing #1',
206 self::FIELD_ContentHotel => 1,
207 self::FIELD_Categories => 1,
211 'table' => self::TABLE_Hotel,
212 'fieldArray' => [
'title' =>
'Hotel #1' ],
215 'table' => self::TABLE_Category,
216 'fieldArray' => [
'title' =>
'Category #1' ],
227 $this->actionService->modifyRecord(
229 self::VALUE_ContentId,
231 'header' =>
'Testing #1',
232 self::FIELD_ContentHotel =>
'3,4,5',
233 self::FIELD_Categories =>
'28,29,30',
238 'processDatamap_beforeStart',
239 'processDatamap_afterAllOperations'
243 'processDatamap_preProcessFieldArray',
246 'table' => self::TABLE_Content,
248 'header' =>
'Testing #1',
249 self::FIELD_ContentHotel =>
'3,4,5',
250 self::FIELD_Categories =>
'28,29,30',
257 'processDatamap_postProcessFieldArray',
258 'processDatamap_afterDatabaseOperations',
261 'table' => self::TABLE_Content,
263 'header' =>
'Testing #1',
264 self::FIELD_ContentHotel => 3,
265 self::FIELD_Categories => 3,
277 $message =
'Unexpected invocations of method "%s"';
278 foreach ($methodNames as $methodName) {
279 $invocations = $this->hookFixture->findInvocationsByMethodName($methodName);
283 sprintf($message, $methodName)
294 foreach ($methodNames as $methodName) {
305 $message =
'Unexpected hook payload amount found for method "%s"';
306 $invocations = $this->hookFixture->findInvocationsByMethodName($methodName);
307 $this->assertNotNull($invocations);
309 foreach ($assertions as $assertion) {
314 sprintf($message, $methodName)
316 $index = $indexes[0];
317 unset($invocations[$index]);
329 foreach ($haystack as $index => $item) {
330 if ($this->
equals($assertion, $item)) {
342 protected function equals(array $left, array $right)
344 foreach ($left as $key => $leftValue) {
345 $rightValue = $right[$key] ??
null;
346 if (!is_array($leftValue) && (
string)$leftValue !== (
string)$rightValue) {
349 if (is_array($leftValue)) {
350 if (!$this->
equals($leftValue, $rightValue)) {