/** * @test */ public function addDataSetsUserPermissionsOnPageForNewContentRecord() { $input = ['tableName' => 'tt_content', 'command' => 'new', 'vanillaUid' => 123, 'parentPageRow' => ['uid' => 123, 'pid' => 321]]; $this->beUserProphecy->isAdmin()->willReturn(false); $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true); $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::CONTENT_EDIT); $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true); $result = $this->subject->addData($input); $this->assertSame(Permission::CONTENT_EDIT, $result['userPermissionOnPage']); }
/** * @test */ public function addDataSetsPermissionsToAllIfRootLevelRestrictionForTableIsIgnoredForNewContentRecord() { $input = ['tableName' => 'pages', 'command' => 'new', 'vanillaUid' => 123, 'parentPageRow' => null]; $this->beUserProphecy->isAdmin()->willReturn(false); $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true); $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true); $GLOBALS['TCA'][$input['tableName']]['ctrl']['security']['ignoreRootLevelRestriction'] = true; $result = $this->subject->addData($input); $this->assertSame(Permission::ALL, $result['userPermissionOnPage']); }